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:
parent
3770211e66
commit
101caf12ff
@ -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
|
||||||
|
@ -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()
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user