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, -3,
Material.GOLD_SWORD, (byte)0, 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 @Override

View File

@ -27,6 +27,7 @@ import mineplex.core.recharge.Recharge;
public abstract class ItemGadget extends Gadget public abstract class ItemGadget extends Gadget
{ {
private boolean _preserveStaticItem;
private Ammo _ammo; private Ammo _ammo;
protected long _recharge; protected long _recharge;
@ -40,6 +41,14 @@ public abstract class ItemGadget extends Gadget
Free = true; 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 @Override
public void EnableCustom(Player player) public void EnableCustom(Player player)
{ {
@ -84,6 +93,9 @@ public abstract class ItemGadget extends Gadget
{ {
if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial()) if (IsActive(event.getPlayer()) && event.getItemDrop().getItemStack().getType() == GetDisplayMaterial())
{ {
if (_preserveStaticItem)
return;
final Player player = event.getPlayer(); final Player player = event.getPlayer();
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()

View File

@ -30,6 +30,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.event.StackerEvent; import mineplex.core.event.StackerEvent;
import mineplex.core.gadget.gadgets.morph.MorphBlock; import mineplex.core.gadget.gadgets.morph.MorphBlock;
import mineplex.core.gadget.types.GadgetType; import mineplex.core.gadget.types.GadgetType;
import mineplex.core.pet.PetManager;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
@ -94,7 +95,9 @@ public class StackerManager extends MiniPlugin implements IThrown
//Parkour Disable //Parkour Disable
if (Manager.GetParkour().InsideParkour(stacker.getLocation())) if (Manager.GetParkour().InsideParkour(stacker.getLocation()))
{ {
if (!stackee.isCustomNameVisible())
UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges.")); UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
return; return;
} }
@ -141,9 +144,16 @@ public class StackerManager extends MiniPlugin implements IThrown
if (stackee instanceof LivingEntity) 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())
{ {
// 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.")); UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack this entity."));
return; return;
} }
} }