2016-06-18 17:16:32 +02:00
|
|
|
package me.libraryaddict.disguise.commands;
|
|
|
|
|
2017-06-19 19:06:35 +02:00
|
|
|
import me.libraryaddict.disguise.DisguiseAPI;
|
2019-01-03 03:13:03 +01:00
|
|
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
2016-06-18 17:16:32 +02:00
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2017-06-19 11:23:02 +02:00
|
|
|
public class UndisguiseCommand implements CommandExecutor {
|
2016-06-18 17:16:32 +02:00
|
|
|
|
|
|
|
@Override
|
2017-06-19 11:23:02 +02:00
|
|
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
|
|
|
if (sender.getName().equals("CONSOLE")) {
|
2017-06-19 19:06:35 +02:00
|
|
|
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
2016-06-18 17:16:32 +02:00
|
|
|
return true;
|
|
|
|
}
|
2017-06-19 19:06:35 +02:00
|
|
|
|
2017-06-19 11:23:02 +02:00
|
|
|
if (sender.hasPermission("libsdisguises.undisguise")) {
|
|
|
|
if (DisguiseAPI.isDisguised((Entity) sender)) {
|
2016-06-18 17:16:32 +02:00
|
|
|
DisguiseAPI.undisguiseToAll((Player) sender);
|
2017-06-19 19:06:35 +02:00
|
|
|
sender.sendMessage(LibsMsg.UNDISG.get());
|
2017-06-19 11:23:02 +02:00
|
|
|
} else {
|
2017-06-19 19:19:46 +02:00
|
|
|
sender.sendMessage(LibsMsg.NOT_DISGUISED.get());
|
2016-06-18 17:16:32 +02:00
|
|
|
}
|
2017-06-19 11:23:02 +02:00
|
|
|
} else {
|
2017-06-19 19:06:35 +02:00
|
|
|
sender.sendMessage(LibsMsg.NO_PERM.get());
|
2016-06-18 17:16:32 +02:00
|
|
|
}
|
2017-06-19 19:06:35 +02:00
|
|
|
|
2016-06-18 17:16:32 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|