Track items dropped by a player, prevent them from being party shared

This commit is contained in:
TfT_02 2013-04-17 15:19:50 +02:00
parent 42a30b4521
commit 3ffcaae122
3 changed files with 6 additions and 1 deletions

View File

@ -29,6 +29,7 @@ Version 1.4.06-dev
! ExperienceAPI methods will now throw InvalidSkillException if the skill name passed in is invalid.
! Changed default value for recently-hurt cooldown between teleports, this is also fully configurable now
! Changed the amount of info messages in the console when enabling/disabling, enable Verbose_Logging to enable them again
! Items dropped by players are now being tracked and are not being shared with party members
Version 1.4.05
+ Added option to allow refreshing of chunks after block-breaking abilities. (Disabled by default)

View File

@ -164,6 +164,7 @@ public class PlayerListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerDropItemEvent(PlayerDropItemEvent event) {
Player player = event.getPlayer();
Item drop = event.getItemDrop();
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer.getAbilityMode(AbilityType.GIGA_DRILL_BREAKER) || mcMMOPlayer.getAbilityMode(AbilityType.SUPER_BREAKER)) {
@ -171,6 +172,8 @@ public class PlayerListener implements Listener {
return;
}
drop.setMetadata(mcMMO.droppedItemKey, mcMMO.metadataValue);
SkillUtils.removeAbilityBuff(event.getItemDrop().getItemStack());
}
@ -234,7 +237,7 @@ public class PlayerListener implements Listener {
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
if (mcMMOPlayer.inParty() && ItemUtils.isShareable(dropStack)) {
if (!drop.hasMetadata(mcMMO.droppedItemKey) && mcMMOPlayer.inParty() && ItemUtils.isShareable(dropStack)) {
event.setCancelled(ShareHandler.handleItemShare(drop, mcMMOPlayer));
if (event.isCancelled()) {

View File

@ -93,6 +93,7 @@ public class mcMMO extends JavaPlugin {
public final static String tntMetadataKey = "mcMMO: Tracked TNT";
public final static String customNameKey = "mcMMO: Custom Name";
public final static String customVisibleKey = "mcMMO: Name Visibility";
public final static String droppedItemKey = "mcMMO: Tracked Item";
public static FixedMetadataValue metadataValue;