Improved all commands.
This commit is contained in:
parent
a040bf26a9
commit
efd0019539
|
@ -18,7 +18,6 @@ import com.songoda.ultimatemoderation.listeners.*;
|
|||
import com.songoda.ultimatemoderation.moderate.ModerationManager;
|
||||
import com.songoda.ultimatemoderation.punish.AppliedPunishment;
|
||||
import com.songoda.ultimatemoderation.punish.PunishmentNote;
|
||||
import com.songoda.ultimatemoderation.punish.PunishmentType;
|
||||
import com.songoda.ultimatemoderation.punish.player.PunishmentManager;
|
||||
import com.songoda.ultimatemoderation.punish.template.Template;
|
||||
import com.songoda.ultimatemoderation.punish.template.TemplateManager;
|
||||
|
@ -27,18 +26,10 @@ import com.songoda.ultimatemoderation.staffchat.StaffChatManager;
|
|||
import com.songoda.ultimatemoderation.tasks.SlowModeTask;
|
||||
import com.songoda.ultimatemoderation.tickets.Ticket;
|
||||
import com.songoda.ultimatemoderation.tickets.TicketManager;
|
||||
import com.songoda.ultimatemoderation.tickets.TicketResponse;
|
||||
import com.songoda.ultimatemoderation.tickets.TicketStatus;
|
||||
import com.songoda.ultimatemoderation.utils.Methods;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class UltimateModeration extends SongodaPlugin {
|
||||
private static UltimateModeration INSTANCE;
|
||||
|
@ -97,7 +88,7 @@ public class UltimateModeration extends SongodaPlugin {
|
|||
this.commandManager.addCommand(new CommandToggleChat(this));
|
||||
this.commandManager.addCommand(new CommandUnBan(this));
|
||||
this.commandManager.addCommand(new CommandUnMute(this));
|
||||
this.commandManager.addCommand(new CommandVanish(this));
|
||||
this.commandManager.addCommand(new CommandVanish());
|
||||
this.commandManager.addCommand(new CommandWarn(this));
|
||||
|
||||
// Setup Managers
|
||||
|
|
|
@ -18,11 +18,11 @@ import java.util.List;
|
|||
|
||||
public class CommandBan extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandBan(UltimateModeration instance) {
|
||||
public CommandBan(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "Ban");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,25 +50,25 @@ public class CommandBan extends AbstractCommand {
|
|||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendMessage(sender);
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
if (plugin.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) {
|
||||
instance.getLocale().newMessage("That player is already banned.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player is already banned.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (duration == 0 && !sender.hasPermission("um.ban.permanent")) {
|
||||
instance.getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().getMessage("event.general.nopermission").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
long durationFinal = duration;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(instance, () -> {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(player, "um.ban.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot ban this player.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("You cannot ban this player.").sendPrefixedMessage(sender);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.util.List;
|
|||
|
||||
public class CommandClearChat extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandClearChat(UltimateModeration instance) {
|
||||
public CommandClearChat(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "ClearChat");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,11 +32,11 @@ public class CommandClearChat extends AbstractCommand {
|
|||
player.sendMessage(toSend);
|
||||
}
|
||||
|
||||
instance.getLocale().getMessage("command.clearchat.cleared")
|
||||
plugin.getLocale().getMessage("command.clearchat.cleared")
|
||||
.processPlaceholder("player", sender.getName()).sendPrefixedMessage(player);
|
||||
|
||||
if (player.hasPermission("um.clearchat.bypass") && !isForced(args)) {
|
||||
instance.getLocale().getMessage("command.clearchat.immune").sendMessage(player);
|
||||
plugin.getLocale().getMessage("command.clearchat.immune").sendMessage(player);
|
||||
}
|
||||
}
|
||||
return ReturnType.SUCCESS;
|
||||
|
|
|
@ -9,23 +9,23 @@ import java.util.List;
|
|||
|
||||
public class CommandHelp extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandHelp(UltimateModeration instance) {
|
||||
public CommandHelp(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "help");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
sender.sendMessage("");
|
||||
instance.getLocale().getMessage("&7Version " + instance.getDescription().getVersion() + " Created with <3 by &5&l&oSongoda")
|
||||
plugin.getLocale().getMessage("&7Version " + plugin.getDescription().getVersion() + " Created with <3 by &5&l&oSongoda")
|
||||
.sendPrefixedMessage(sender);
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(Methods.formatText("&7Welcome to UltimateModeration! To get started try using the /um command to access the moderation panel."));
|
||||
sender.sendMessage("");
|
||||
sender.sendMessage(Methods.formatText("&6Commands:"));
|
||||
for (AbstractCommand command : instance.getCommandManager().getAllCommands()) {
|
||||
for (AbstractCommand command : plugin.getCommandManager().getAllCommands()) {
|
||||
if (command.getPermissionNode() == null || sender.hasPermission(command.getPermissionNode())) {
|
||||
sender.sendMessage(Methods.formatText("&8 - &a" + command.getSyntax() + "&7 - " + command.getDescription()));
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ import java.util.List;
|
|||
|
||||
public class CommandKick extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandKick(UltimateModeration instance) {
|
||||
public CommandKick(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "Kick");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,12 +40,12 @@ public class CommandKick extends AbstractCommand {
|
|||
OfflinePlayer player = Bukkit.getPlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
instance.getLocale().newMessage("That player does not exist or is not online.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player does not exist or is not online.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && player.getPlayer().hasPermission("um.kick.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot kick this player.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("You cannot kick this player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,11 +18,11 @@ import java.util.List;
|
|||
|
||||
public class CommandMute extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandMute(UltimateModeration instance) {
|
||||
public CommandMute(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "Mute");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,18 +50,18 @@ public class CommandMute extends AbstractCommand {
|
|||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(player, "um.mute.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot mute that player.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("You cannot mute that player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
if (plugin.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) {
|
||||
instance.getLocale().newMessage("That player is already muted.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player is already muted.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ import java.util.List;
|
|||
|
||||
public class CommandRandomPlayer extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandRandomPlayer(UltimateModeration instance) {
|
||||
public CommandRandomPlayer(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "RandomPlayer");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,7 @@ public class CommandRandomPlayer extends AbstractCommand {
|
|||
players.remove(sender);
|
||||
|
||||
if (players.size() == 0) {
|
||||
instance.getLocale().newMessage("&cYou are the only one online!").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("&cYou are the only one online!").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@ import java.util.List;
|
|||
|
||||
public class CommandReload extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandReload(UltimateModeration instance) {
|
||||
public CommandReload(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "reload");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
instance.reloadConfig();
|
||||
instance.getLocale().newMessage("&7Configuration and Language files reloaded.").sendPrefixedMessage(sender);
|
||||
plugin.reloadConfig();
|
||||
plugin.getLocale().newMessage("&7Configuration and Language files reloaded.").sendPrefixedMessage(sender);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,11 @@ import java.util.List;
|
|||
|
||||
public class CommandRunTemplate extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandRunTemplate(UltimateModeration instance) {
|
||||
public CommandRunTemplate(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "RunTemplate");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,8 +27,8 @@ public class CommandRunTemplate extends AbstractCommand {
|
|||
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
if (!player.hasPlayedBefore()) {
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class CommandRunTemplate extends AbstractCommand {
|
|||
}
|
||||
String templateStr = templateBuilder.toString().trim();
|
||||
|
||||
Template template = instance.getTemplateManager().getTemplate(templateStr);
|
||||
Template template = plugin.getTemplateManager().getTemplate(templateStr);
|
||||
|
||||
if (template == null) {
|
||||
sender.sendMessage("That template does not exist...");
|
||||
|
@ -61,7 +61,7 @@ public class CommandRunTemplate extends AbstractCommand {
|
|||
return players;
|
||||
} else if (args.length == 2) {
|
||||
List<String> lines = new ArrayList<>();
|
||||
for (Template template : instance.getTemplateManager().getTemplates().values()) {
|
||||
for (Template template : plugin.getTemplateManager().getTemplates().values()) {
|
||||
lines.add(template.getName());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,19 +11,19 @@ import java.util.List;
|
|||
|
||||
public class CommandSettings extends AbstractCommand {
|
||||
|
||||
final UltimateModeration instance;
|
||||
final GuiManager guiManager;
|
||||
private final UltimateModeration plugin;
|
||||
private final GuiManager guiManager;
|
||||
|
||||
public CommandSettings(UltimateModeration instance, GuiManager manager) {
|
||||
public CommandSettings(UltimateModeration plugin, GuiManager manager) {
|
||||
super(CommandType.PLAYER_ONLY, "settings");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
this.guiManager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
Player player = (Player) sender;
|
||||
guiManager.showGUI((Player) sender, new PluginConfigGui(instance));
|
||||
guiManager.showGUI((Player) sender, new PluginConfigGui(plugin));
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,18 +13,18 @@ import java.util.List;
|
|||
|
||||
public class CommandSlowMode extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandSlowMode(UltimateModeration instance) {
|
||||
public CommandSlowMode(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "Slowmode");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
if (args.length == 0) {
|
||||
ChatListener.setSlowModeOverride(0);
|
||||
instance.getLocale().getMessage("event.slowmode.disabled").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().getMessage("event.slowmode.disabled").sendPrefixedMessage(sender);
|
||||
return ReturnType.SUCCESS;
|
||||
} else if (args.length != 1)
|
||||
return ReturnType.SYNTAX_ERROR;
|
||||
|
@ -34,7 +34,7 @@ public class CommandSlowMode extends AbstractCommand {
|
|||
ChatListener.setSlowModeOverride(delay);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(player ->
|
||||
instance.getLocale().getMessage("event.slowmode.enabled")
|
||||
plugin.getLocale().getMessage("event.slowmode.enabled")
|
||||
.processPlaceholder("delay", Methods.makeReadable(delay)).sendPrefixedMessage(player));
|
||||
|
||||
return ReturnType.SUCCESS;
|
||||
|
|
|
@ -11,11 +11,11 @@ import java.util.List;
|
|||
|
||||
public class CommandStaffChat extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandStaffChat(UltimateModeration instance) {
|
||||
public CommandStaffChat(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "StaffChat");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,26 +27,26 @@ public class CommandStaffChat extends AbstractCommand {
|
|||
Player player = (Player) sender;
|
||||
|
||||
if (channelName.trim().equalsIgnoreCase("leave")) {
|
||||
for (StaffChannel channel : instance.getStaffChatManager().getChats().values()) {
|
||||
for (StaffChannel channel : plugin.getStaffChatManager().getChats().values()) {
|
||||
if (!channel.listMembers().contains(player.getUniqueId())) continue;
|
||||
channel.removeMember(player);
|
||||
instance.getLocale().getMessage("event.staffchat.leave")
|
||||
plugin.getLocale().getMessage("event.staffchat.leave")
|
||||
.processPlaceholder("channel", channel.getChannelName()).sendPrefixedMessage(player);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
instance.getLocale().getMessage("event.staffchat.nochannels").sendPrefixedMessage(player);
|
||||
plugin.getLocale().getMessage("event.staffchat.nochannels").sendPrefixedMessage(player);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
instance.getLocale().getMessage("event.staffchat.join")
|
||||
plugin.getLocale().getMessage("event.staffchat.join")
|
||||
.processPlaceholder("channel", channelName).sendPrefixedMessage(player);
|
||||
instance.getStaffChatManager().getChat(channelName).addMember(player);
|
||||
plugin.getStaffChatManager().getChat(channelName).addMember(player);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> onTab(CommandSender sender, String... args) {
|
||||
return new ArrayList<>(instance.getStaffChatManager().getChats().keySet());
|
||||
return new ArrayList<>(plugin.getStaffChatManager().getChats().keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -10,18 +10,18 @@ import java.util.List;
|
|||
|
||||
public class CommandTicket extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandTicket(UltimateModeration instance) {
|
||||
public CommandTicket(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "Ticket");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
Player senderP = ((Player) sender);
|
||||
|
||||
new TicketManagerGui(instance, senderP, senderP);
|
||||
new TicketManagerGui(plugin, senderP, senderP);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,24 +12,24 @@ import java.util.List;
|
|||
|
||||
public class CommandToggleChat extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
/*
|
||||
* Chat is enabled by default ;)
|
||||
*/
|
||||
private boolean toggled = true;
|
||||
|
||||
public CommandToggleChat(UltimateModeration instance) {
|
||||
public CommandToggleChat(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "togglechat");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
toggled = !toggled;
|
||||
|
||||
Message message = toggled ? instance.getLocale().getMessage("command.togglechat.toggledOn")
|
||||
: instance.getLocale().getMessage("command.togglechat.toggledOff");
|
||||
Message message = toggled ? plugin.getLocale().getMessage("command.togglechat.toggledOn")
|
||||
: plugin.getLocale().getMessage("command.togglechat.toggledOff");
|
||||
|
||||
ChatListener.setChatToggled(toggled);
|
||||
|
||||
|
@ -40,7 +40,7 @@ public class CommandToggleChat extends AbstractCommand {
|
|||
if (!player.hasPermission(getPermissionNode() + ".bypass"))
|
||||
continue;
|
||||
|
||||
instance.getLocale().getMessage("command.togglechat.bypass").sendMessage(player);
|
||||
plugin.getLocale().getMessage("command.togglechat.bypass").sendMessage(player);
|
||||
}
|
||||
|
||||
if (!(sender instanceof Player))
|
||||
|
|
|
@ -10,16 +10,16 @@ import java.util.List;
|
|||
|
||||
public class CommandUltimateModeration extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandUltimateModeration(UltimateModeration instance) {
|
||||
public CommandUltimateModeration(UltimateModeration plugin) {
|
||||
super(CommandType.PLAYER_ONLY, "UltimateModeration");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||
instance.getGuiManager().showGUI((Player) sender, new MainGui(instance, (Player) sender));
|
||||
plugin.getGuiManager().showGUI((Player) sender, new MainGui(plugin, (Player) sender));
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ import java.util.List;
|
|||
|
||||
public class CommandUnBan extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandUnBan(UltimateModeration instance) {
|
||||
public CommandUnBan(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "UnBan");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -29,21 +29,21 @@ public class CommandUnBan extends AbstractCommand {
|
|||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (!instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
if (!plugin.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.BAN)) {
|
||||
instance.getLocale().newMessage("That player isn't banned.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player isn't banned.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
PlayerPunishData playerPunishData = instance.getPunishmentManager().getPlayer(player);
|
||||
PlayerPunishData playerPunishData = plugin.getPunishmentManager().getPlayer(player);
|
||||
|
||||
playerPunishData.expirePunishments(PunishmentType.BAN);
|
||||
|
||||
instance.getLocale().getMessage("event.unban.success")
|
||||
plugin.getLocale().getMessage("event.unban.success")
|
||||
.processPlaceholder("player", player.getName()).sendPrefixedMessage(sender);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -14,11 +14,11 @@ import java.util.List;
|
|||
|
||||
public class CommandUnMute extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandUnMute(UltimateModeration instance) {
|
||||
public CommandUnMute(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "UnMute");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,22 +28,22 @@ public class CommandUnMute extends AbstractCommand {
|
|||
|
||||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (player == null) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
if (!player.hasPlayedBefore()) {
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (!instance.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
if (!plugin.getPunishmentManager().getPlayer(player).getActivePunishments()
|
||||
.stream().anyMatch(appliedPunishment -> appliedPunishment.getPunishmentType() == PunishmentType.MUTE)) {
|
||||
instance.getLocale().newMessage("That player isn't muted.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player isn't muted.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
PlayerPunishData playerPunishData = instance.getPunishmentManager().getPlayer(player);
|
||||
PlayerPunishData playerPunishData = plugin.getPunishmentManager().getPlayer(player);
|
||||
|
||||
playerPunishData.expirePunishments(PunishmentType.MUTE);
|
||||
|
||||
instance.getLocale().newMessage(instance.getLocale().getMessage("event.unmute.success")
|
||||
plugin.getLocale().newMessage(plugin.getLocale().getMessage("event.unmute.success")
|
||||
.processPlaceholder("player", player.getName()).getMessage()).sendPrefixedMessage(sender);
|
||||
return ReturnType.SUCCESS;
|
||||
}
|
||||
|
|
|
@ -19,13 +19,10 @@ import java.util.UUID;
|
|||
|
||||
public class CommandVanish extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private static final List<UUID> inVanish = new ArrayList<>();
|
||||
|
||||
private static List<UUID> inVanish = new ArrayList<>();
|
||||
|
||||
public CommandVanish(UltimateModeration instance) {
|
||||
public CommandVanish() {
|
||||
super(CommandType.PLAYER_ONLY, "Vanish");
|
||||
this.instance = instance;
|
||||
}
|
||||
|
||||
public static void registerVanishedPlayers(Player player) {
|
||||
|
|
|
@ -18,11 +18,11 @@ import java.util.List;
|
|||
|
||||
public class CommandWarn extends AbstractCommand {
|
||||
|
||||
private UltimateModeration instance;
|
||||
private final UltimateModeration plugin;
|
||||
|
||||
public CommandWarn(UltimateModeration instance) {
|
||||
public CommandWarn(UltimateModeration plugin) {
|
||||
super(CommandType.CONSOLE_OK, "Warn");
|
||||
this.instance = instance;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,12 +50,12 @@ public class CommandWarn extends AbstractCommand {
|
|||
OfflinePlayer player = Bukkit.getOfflinePlayer(args[0]);
|
||||
|
||||
if (!player.hasPlayedBefore()) {
|
||||
instance.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("That player does not exist.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
if (sender instanceof Player && VaultPermissions.hasPermission(player, "um.warning.exempt")) {
|
||||
instance.getLocale().newMessage("You cannot warn that player.").sendPrefixedMessage(sender);
|
||||
plugin.getLocale().newMessage("You cannot warn that player.").sendPrefixedMessage(sender);
|
||||
return ReturnType.FAILURE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue