Disable on tp and do not allow mounts
This commit is contained in:
parent
9fad633b88
commit
675642a100
@ -1112,6 +1112,17 @@ public class GadgetManager extends MiniPlugin
|
||||
event.setCancelled(true);
|
||||
player.sendMessage(F.main("Cosmetics", "You cannot enable particles while vanished!"));
|
||||
}
|
||||
if (event.getGadget().getGadgetType() == GadgetType.MORPH)
|
||||
{
|
||||
if (event.getGadget() instanceof MorphDinnerbone)
|
||||
{
|
||||
if (_mountManager.getActive(player) != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(player, F.main("Cosmetics", "You cannot morph into " + event.getGadget().getName() + " with an active mount!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -13,13 +13,16 @@ import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.skin.SkinData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.LineFormat;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilText;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.event.StackerEvent;
|
||||
@ -29,6 +32,7 @@ import mineplex.core.gadget.event.PlayerToggleSwimEvent;
|
||||
import mineplex.core.gadget.gadgets.item.ItemEtherealPearl;
|
||||
import mineplex.core.gadget.gadgets.morph.managers.UtilMorph;
|
||||
import mineplex.core.gadget.types.MorphGadget;
|
||||
import mineplex.core.mount.event.MountActivateEvent;
|
||||
import mineplex.core.utils.UtilGameProfile;
|
||||
|
||||
public class MorphDinnerbone extends MorphGadget
|
||||
@ -158,4 +162,24 @@ public class MorphDinnerbone extends MorphGadget
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void activateMount(MountActivateEvent event)
|
||||
{
|
||||
if (isActive(event.getPlayer()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Cosmetics", "You cannot use mounts while morphed as " + getName() + "!"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
if (isActive(event.getPlayer()))
|
||||
{
|
||||
disable(event.getPlayer());
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Cosmetics", "You were unmorphed from " + getName() + "!"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
package mineplex.core.mount.event;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.mount.Mount;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
public class MountActivateEvent extends Event
|
||||
import mineplex.core.mount.Mount;
|
||||
|
||||
public class MountActivateEvent extends Event implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
@ -42,11 +42,13 @@ public class MountActivateEvent extends Event
|
||||
return _player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel)
|
||||
{
|
||||
_cancelled = cancel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
|
Loading…
Reference in New Issue
Block a user