Read description

Added command undisguise
Changed perm for undisguise to libsdisguises.undisguise
Moved where the commands are set incase of errors.
This commit is contained in:
Andrew 2013-05-21 14:23:58 +12:00
parent 39ba0083d3
commit 0bda040a60
4 changed files with 29 additions and 3 deletions

View File

@ -5,4 +5,6 @@ author: libraryaddict
depend: [ProtocolLib]
commands:
disguise:
aliases: [d, dis]
aliases: [d, dis]
undisguise:
aliases: [undis]

View File

@ -64,7 +64,7 @@ public class DisguiseCommand implements CommandExecutor {
} else
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
} else if (args[0].equalsIgnoreCase("undiguise") || args[0].equalsIgnoreCase("undis") || args[0].equalsIgnoreCase("un")) {
if (sender.hasPermission("libsdisguises.disguise.undisguise")) {
if (sender.hasPermission("libsdisguises.undisguise")) {
if (DisguiseAPI.isDisguised(p.getName())) {
DisguiseAPI.undisguiseToAll(p);
sender.sendMessage(ChatColor.RED + "You are no longer disguised");

View File

@ -26,7 +26,6 @@ import com.comphenix.protocol.reflect.StructureModifier;
public class LibsDisguises extends JavaPlugin {
public void onEnable() {
getCommand("disguise").setExecutor(new DisguiseCommand());
ProtocolLibrary.getProtocolManager().addPacketListener(
new PacketAdapter(this, ConnectionSide.SERVER_SIDE, ListenerPriority.NORMAL, Packets.Server.NAMED_ENTITY_SPAWN,
Packets.Server.ENTITY_METADATA, Packets.Server.NAMED_SOUND_EFFECT, Packets.Server.ARM_ANIMATION) {
@ -149,5 +148,7 @@ public class LibsDisguises extends JavaPlugin {
}
}
});
getCommand("disguise").setExecutor(new DisguiseCommand());
getCommand("undisguise").setExecutor(new UndisguiseCommand());
}
}

View File

@ -0,0 +1,23 @@
package me.libraryaddict.disguise;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class UndisguiseCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
Player p = (Player) sender;
if (sender.hasPermission("libsdisguises.undisguise")) {
if (DisguiseAPI.isDisguised(p.getName())) {
DisguiseAPI.undisguiseToAll(p);
sender.sendMessage(ChatColor.RED + "You are no longer disguised");
} else
sender.sendMessage(ChatColor.RED + "You are not disguised!");
} else
sender.sendMessage(ChatColor.RED + "You do not have permission to use this command.");
return true;
}
}