Remove bloat
This commit is contained in:
parent
125e3b66db
commit
8be187c73b
|
|
@ -960,37 +960,6 @@ public class BlockEventHandler implements Listener
|
|||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onInventoryPickupItem(InventoryPickupItemEvent event)
|
||||
{
|
||||
//prevent hoppers from picking-up items dropped by players on death
|
||||
|
||||
InventoryHolder holder = event.getInventory().getHolder();
|
||||
if (holder instanceof HopperMinecart || holder instanceof Hopper)
|
||||
{
|
||||
Item item = event.getItem();
|
||||
List<MetadataValue> data = item.getMetadata("GP_ITEMOWNER");
|
||||
//if this is marked as belonging to a player
|
||||
if (data != null && data.size() > 0)
|
||||
{
|
||||
UUID ownerID = (UUID) data.get(0).value();
|
||||
|
||||
//has that player unlocked his drops?
|
||||
OfflinePlayer owner = GriefPrevention.instance.getServer().getOfflinePlayer(ownerID);
|
||||
if (owner.isOnline())
|
||||
{
|
||||
PlayerData playerData = this.dataStore.getPlayerData(ownerID);
|
||||
|
||||
//if locked, don't allow pickup
|
||||
if (!playerData.dropsAreUnlocked)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onItemFrameBrokenByBoat(final HangingBreakEvent event)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -516,9 +516,6 @@ public class EntityEventHandler implements Listener
|
|||
new PendingItemProtection(deathLocation, playerID, expirationTime, stack));
|
||||
}
|
||||
|
||||
//allow the player to receive a message about how to unlock any drops
|
||||
playerData.dropsAreUnlocked = false;
|
||||
playerData.receivedDropUnlockAdvertisement = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2171,34 +2171,6 @@ public class GriefPrevention extends JavaPlugin
|
|||
return true;
|
||||
}
|
||||
|
||||
//unlockItems
|
||||
else if (cmd.getName().equalsIgnoreCase("unlockdrops") && player != null)
|
||||
{
|
||||
PlayerData playerData;
|
||||
|
||||
if (player.hasPermission("griefprevention.unlockothersdrops") && args.length == 1)
|
||||
{
|
||||
Player otherPlayer = Bukkit.getPlayer(args[0]);
|
||||
if (otherPlayer == null)
|
||||
{
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PlayerNotFound2);
|
||||
return true;
|
||||
}
|
||||
|
||||
playerData = this.dataStore.getPlayerData(otherPlayer.getUniqueId());
|
||||
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockOthersConfirmation, otherPlayer.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||
GriefPrevention.sendMessage(player, TextMode.Success, Messages.DropUnlockConfirmation);
|
||||
}
|
||||
|
||||
playerData.dropsAreUnlocked = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//deletealladminclaims
|
||||
else if (player != null && cmd.getName().equalsIgnoreCase("deletealladminclaims"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -331,11 +331,6 @@ class PlayerEventHandler implements Listener
|
|||
}
|
||||
|
||||
this.deathTimestamps.put(player.getUniqueId(), now);
|
||||
|
||||
//these are related to locking dropped items on death to prevent theft
|
||||
PlayerData playerData = instance.dataStore.getPlayerData(player.getUniqueId());
|
||||
playerData.dropsAreUnlocked = false;
|
||||
playerData.receivedDropUnlockAdvertisement = false;
|
||||
}
|
||||
|
||||
//when a player gets kicked...
|
||||
|
|
@ -790,40 +785,6 @@ class PlayerEventHandler implements Listener
|
|||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
//FEATURE: lock dropped items to player who dropped them
|
||||
|
||||
//who owns this stack?
|
||||
Item item = event.getItem();
|
||||
List<MetadataValue> data = item.getMetadata("GP_ITEMOWNER");
|
||||
if (data != null && data.size() > 0)
|
||||
{
|
||||
UUID ownerID = (UUID) data.get(0).value();
|
||||
|
||||
//has that player unlocked his drops?
|
||||
OfflinePlayer owner = instance.getServer().getOfflinePlayer(ownerID);
|
||||
String ownerName = GriefPrevention.lookupPlayerName(ownerID);
|
||||
if (owner.isOnline() && !player.equals(owner))
|
||||
{
|
||||
PlayerData playerData = this.dataStore.getPlayerData(ownerID);
|
||||
|
||||
//if locked, don't allow pickup
|
||||
if (!playerData.dropsAreUnlocked)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
//if hasn't been instructed how to unlock, send explanatory messages
|
||||
if (!playerData.receivedDropUnlockAdvertisement)
|
||||
{
|
||||
GriefPrevention.sendMessage(owner.getPlayer(), TextMode.Instr, Messages.DropUnlockAdvertisement);
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, Messages.PickupBlockedExplanation, ownerName);
|
||||
playerData.receivedDropUnlockAdvertisement = true;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//the rest of this code is specific to pvp worlds
|
||||
if (!instance.pvpRulesApply(player.getWorld())) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -166,10 +166,6 @@ commands:
|
|||
usage: /TransferClaim <player>
|
||||
aliases: giveclaim
|
||||
permission: griefprevention.transferclaim
|
||||
unlockdrops:
|
||||
description: Allows other players to pick up the items you dropped when you died.
|
||||
usage: /UnlockDrops
|
||||
permission: griefprevention.unlockdrops
|
||||
claimslist:
|
||||
description: Lists information about a player's claim blocks and claims.
|
||||
usage: /ClaimsList or /ClaimsList <player>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user