Hub: Hide stacker message when player clicks on an NPC. Display correct KOTH PvP Sword display name on player item drop.

This commit is contained in:
Thanos paravantis 2016-01-05 20:48:28 +02:00
parent 3770211e66
commit 101caf12ff
4 changed files with 29 additions and 7 deletions

View File

@ -22,7 +22,7 @@ public class ItemDuelingSword extends ItemGadget
},
-3,
Material.GOLD_SWORD, (byte)0,
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10));
1000, new Ammo("Dueling Sword", "10 Swords", Material.WOOD_SWORD, (byte)0, new String[] { C.cWhite + "10 Swords to duel with" }, 1000, 10), true);
}
@Override

View File

@ -27,6 +27,7 @@ import mineplex.core.recharge.Recharge;
public abstract class ItemGadget extends Gadget
{
private boolean _preserveStaticItem;
private Ammo _ammo;
protected long _recharge;
@ -40,6 +41,14 @@ public abstract class ItemGadget extends Gadget
Free = true;
}
public ItemGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data,
long recharge, Ammo ammo, boolean preserveStaticItem)
{
this(manager, name, desc, cost, mat, data, recharge, ammo);
_preserveStaticItem = preserveStaticItem;
}
@Override
public void EnableCustom(Player player)
{
@ -81,9 +90,12 @@ public abstract class ItemGadget extends Gadget
@EventHandler
public void orderThatChest(PlayerDropItemEvent event)
{
{
if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial())
{
if (_preserveStaticItem)
return;
final Player player = event.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
@ -172,4 +184,4 @@ public abstract class ItemGadget extends Gadget
}
public abstract void ActivateCustom(Player player);
}
}

View File

@ -256,7 +256,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
_playerCountManager = new PlayerCountManager(plugin);
_customDataManager = new CustomDataManager(plugin, clientManager);
_songs = new ArrayList<NoteSong>();
try

View File

@ -30,6 +30,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.types.GadgetType;
import mineplex.core.pet.PetManager;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.projectile.ProjectileUser;
@ -94,7 +95,9 @@ public class StackerManager extends MiniPlugin implements IThrown
//Parkour Disable
if (Manager.GetParkour().InsideParkour(stacker.getLocation()))
{
UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
if (!stackee.isCustomNameVisible())
UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
return;
}
@ -141,9 +144,16 @@ public class StackerManager extends MiniPlugin implements IThrown
if (stackee instanceof LivingEntity)
{
if (Manager.getPetManager().getPets().contains(stackee) || stackee instanceof Wither || stackee instanceof EnderDragon || ((LivingEntity)stackee).isCustomNameVisible())
PetManager petManager = Manager.getPetManager();
LivingEntity livingStackee = (LivingEntity) stackee;
boolean cannotStack = petManager.getPets().contains(stackee) || stackee instanceof Wither || stackee instanceof EnderDragon;
if (cannotStack || livingStackee.isCustomNameVisible())
{
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity."));
// Prevent from showing this message when players right-click on game npc's.
if (cannotStack)
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity."));
return;
}
}