2020-04-04 03:17:29 +02:00
|
|
|
package me.libraryaddict.disguise.commands.interactions;
|
|
|
|
|
|
|
|
import me.libraryaddict.disguise.DisguiseAPI;
|
|
|
|
import me.libraryaddict.disguise.disguisetypes.DisguiseType;
|
2020-06-27 11:01:58 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.DisguiseUtilities;
|
2020-04-04 03:17:29 +02:00
|
|
|
import me.libraryaddict.disguise.utilities.LibsEntityInteract;
|
|
|
|
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
|
|
|
import org.bukkit.entity.Entity;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by libraryaddict on 4/04/2020.
|
|
|
|
*/
|
|
|
|
public class UndisguiseEntityInteraction implements LibsEntityInteract {
|
|
|
|
@Override
|
|
|
|
public void onInteract(Player p, Entity entity) {
|
|
|
|
String entityName;
|
|
|
|
|
|
|
|
if (entity instanceof Player) {
|
|
|
|
entityName = entity.getName();
|
|
|
|
} else {
|
|
|
|
entityName = DisguiseType.getType(entity).toReadable();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (DisguiseAPI.isDisguised(entity)) {
|
|
|
|
DisguiseAPI.undisguiseToAll(entity);
|
|
|
|
|
|
|
|
if (entity instanceof Player)
|
2020-06-27 11:01:58 +02:00
|
|
|
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER, entityName);
|
2020-04-04 03:17:29 +02:00
|
|
|
else
|
2020-06-27 11:01:58 +02:00
|
|
|
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT, entityName);
|
2020-04-04 03:17:29 +02:00
|
|
|
} else {
|
|
|
|
if (entity instanceof Player)
|
2020-06-27 11:01:58 +02:00
|
|
|
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_PLAYER_FAIL, entityName);
|
2020-04-04 03:17:29 +02:00
|
|
|
else
|
2020-06-27 11:01:58 +02:00
|
|
|
DisguiseUtilities.sendMessage(p, LibsMsg.LISTEN_UNDISG_ENT_FAIL, entityName);
|
2020-04-04 03:17:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|