Okay thing is i don't know how to disable pvp i know i need make a onDamageEvent but I'm not sure how to integrate it or make it where others can't attack disguised players too. CODE: Code: public boolean onCommand(CommandSender sender, Command cmd, String CommandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("creeper")) { if (sender.hasPermission("vip.use")) { final Player player = (Player)sender; final Entity en = (Entity) sender; Disguise creeper = new MobDisguise(DisguiseType.CREEPER, false); DisguiseAPI.disguiseToAll(en, creeper); FlagWatcher flagwatcher = creeper.getWatcher(); flagwatcher.setCustomName(player.getDisplayName()); flagwatcher.setCustomNameVisible(true); sender.sendMessage(ChatColor.GOLD + "You have been disguised as a creeper for 5 minutes!"); Bukkit.getScheduler().runTaskLater((plugin), new Runnable(){public void run() { DisguiseAPI.undisguiseToAll((Entity) en); } }, 200); return true; } else {
@Zyu You just need to set up a listener for ondamageEvent and player interact event( if you want tk make it double-sided), and check if the player is disguises, if yes, set do event.setCancelled(true), and done? So, in what do you need more help?
Isn't there "setdiguised()" method in the player class...*runs trough javadoc*...oh yes..why not use player.hidePlayer(), player.showPlayer(), player.canSee()?
Code: public class AntiPVP implements Listener { private HashMap<UUID, Integer> incombat = new HashMap<UUID, Integer>(); @EventHandler public void setinCombat(Player p) { if ((DisguiseAPI.isDisguised(p))) { DisguiseAPI.undisguiseToAll(p); } } @EventHandler public void ondisguise(UndisguiseEvent e) { if ((this.incombat.containsKey(((Player) e).getPlayer().getUniqueId()))) e.setCancelled(true); } } This doesn't work, i might be skipping out on something
The moderators wont delete this post because others MAY be experiencing the same problem so rather than going through everything to solve it they can just be pointed to this thread (Or others(