Change the way entity interaction works for commands to a cleaner method
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package me.libraryaddict.disguise.commands.undisguise;
|
||||
|
||||
import me.libraryaddict.disguise.DisguiseConfig;
|
||||
import me.libraryaddict.disguise.LibsDisguises;
|
||||
import me.libraryaddict.disguise.commands.interactions.UndisguiseEntityInteraction;
|
||||
import me.libraryaddict.disguise.utilities.LibsPremium;
|
||||
import me.libraryaddict.disguise.utilities.translations.LibsMsg;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -10,10 +12,9 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UndisguiseEntityCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (sender instanceof Player && !sender.isOp()&&
|
||||
if (sender instanceof Player && !sender.isOp() &&
|
||||
(!LibsPremium.isPremium() || LibsPremium.getPaidInformation() == LibsPremium.getPluginInformation())) {
|
||||
sender.sendMessage(ChatColor.RED + "Please purchase Lib's Disguises to enable player commands");
|
||||
return true;
|
||||
@@ -23,12 +24,16 @@ public class UndisguiseEntityCommand implements CommandExecutor {
|
||||
sender.sendMessage(LibsMsg.NO_CONSOLE.get());
|
||||
return true;
|
||||
}
|
||||
if (sender.hasPermission("libsdisguises.undisguiseentity")) {
|
||||
LibsDisguises.getInstance().getListener().setDisguiseEntity(sender.getName(), null);
|
||||
sender.sendMessage(LibsMsg.UND_ENTITY.get());
|
||||
} else {
|
||||
|
||||
if (!sender.hasPermission("libsdisguises.undisguiseentity")) {
|
||||
sender.sendMessage(LibsMsg.NO_PERM.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
LibsDisguises.getInstance().getListener().addInteraction(sender.getName(), new UndisguiseEntityInteraction(),
|
||||
DisguiseConfig.getDisguiseEntityExpire());
|
||||
sender.sendMessage(LibsMsg.UND_ENTITY.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user