TotalFreedomMod/src/main/java/me/totalfreedom/totalfreedommod/command/Command_slconfig.java

349 lines
12 KiB
Java
Raw Normal View History

package me.totalfreedom.totalfreedommod.command;
2019-01-29 04:57:41 +00:00
import java.util.ArrayList;
2019-01-28 01:49:07 +00:00
import java.util.Arrays;
2019-01-29 04:57:41 +00:00
import java.util.Collections;
import java.util.Date;
2019-01-28 01:49:07 +00:00
import java.util.List;
2019-04-21 00:16:00 +00:00
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
2020-09-12 19:42:12 +00:00
import me.totalfreedom.totalfreedommod.discord.Discord;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank;
2020-08-15 22:58:48 +00:00
import me.totalfreedom.totalfreedommod.staff.StaffMember;
import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
2020-08-15 16:35:48 +00:00
@CommandParameters(description = "List, add, remove, or set the rank of staff, clean or reload the staff list, or view the info of staff.", usage = "/<command> <list | clean | reload | | setrank <username> <rank> | <add | remove | info> <username>>")
2020-08-15 22:42:46 +00:00
public class Command_slconfig extends FreedomCommand
{
@Override
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (args.length < 1)
{
return false;
}
switch (args[0])
{
case "list":
{
2020-08-15 22:42:46 +00:00
msg("Staff: " + StringUtils.join(plugin.sl.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
case "clean":
{
2020-07-20 02:10:51 +00:00
checkConsole();
2020-08-15 22:42:46 +00:00
checkRank(Rank.ADMIN);
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Cleaning staff list", true);
plugin.sl.deactivateOldEntries(true);
msg("Staff: " + StringUtils.join(plugin.sl.getAdminNames(), ", "), ChatColor.GOLD);
return true;
}
case "reload":
{
2020-08-15 22:42:46 +00:00
checkRank(Rank.ADMIN);
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Reloading the staff list", true);
plugin.sl.load();
msg("Staff list reloaded!");
return true;
}
case "setrank":
{
2020-07-20 02:10:51 +00:00
checkConsole();
2020-08-15 22:42:46 +00:00
checkRank(Rank.ADMIN);
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
if (args.length < 3)
{
return false;
}
Rank rank = Rank.findRank(args[2]);
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
if (rank == null)
{
2020-07-20 02:10:51 +00:00
msg("Unknown rank: " + args[2]);
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
return true;
}
if (rank.isConsole())
{
msg("You cannot set players to a console rank");
return true;
}
2020-08-15 22:42:46 +00:00
if (!rank.isAtLeast(Rank.TRIAL_MOD))
{
2020-08-15 22:42:46 +00:00
msg("Rank must be Trial Mod or higher.", ChatColor.RED);
return true;
}
2020-08-15 22:42:46 +00:00
StaffMember staffMember = plugin.sl.getEntryByName(args[1]);
if (staffMember == null)
{
2020-08-15 22:42:46 +00:00
msg("Unknown staff member: " + args[1]);
return true;
}
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Setting " + staffMember.getName() + "'s rank to " + rank.getName(), true);
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
2020-08-15 22:42:46 +00:00
staffMember.setRank(rank);
plugin.sl.save(staffMember);
2020-08-15 22:42:46 +00:00
Player player = getPlayer(staffMember.getName());
2018-03-03 04:29:08 +00:00
if (player != null)
{
plugin.rm.updateDisplay(player);
}
2019-04-21 00:16:00 +00:00
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
2020-08-15 22:42:46 +00:00
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
2019-04-21 00:16:00 +00:00
}
2020-08-15 22:42:46 +00:00
plugin.amp.updateAccountStatus(staffMember);
2020-08-08 05:51:09 +00:00
2020-08-15 22:42:46 +00:00
msg("Set " + staffMember.getName() + "'s rank to " + rank.getName());
return true;
}
case "info":
{
if (args.length < 2)
{
return false;
}
2020-08-15 22:42:46 +00:00
checkRank(Rank.TRIAL_MOD);
2020-08-15 22:42:46 +00:00
StaffMember staffMember = plugin.sl.getEntryByName(args[1]);
2020-08-15 22:42:46 +00:00
if (staffMember == null)
{
final Player player = getPlayer(args[1]);
if (player != null)
{
2020-08-15 22:42:46 +00:00
staffMember = plugin.sl.getAdmin(player);
}
}
2020-08-15 22:42:46 +00:00
if (staffMember == null)
{
2020-08-15 22:42:46 +00:00
msg("Staff member not found: " + args[1]);
}
else
{
2020-08-15 22:42:46 +00:00
msg(staffMember.toString());
}
return true;
}
case "add":
{
if (args.length < 2)
{
return false;
}
2020-07-20 02:10:51 +00:00
checkConsole();
2020-08-15 22:42:46 +00:00
checkRank(Rank.MOD);
2020-08-15 16:35:48 +00:00
// Player already staff?
final Player player = getPlayer(args[1]);
if (player == null)
{
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
2020-08-15 22:42:46 +00:00
if (plugin.sl.isStaff(player))
{
2020-08-15 22:42:46 +00:00
msg("That player is already a staff member.");
return true;
}
2020-08-15 16:35:48 +00:00
// Find the old staff entry
String name = player != null ? player.getName() : args[1];
2020-08-15 22:42:46 +00:00
StaffMember staffMember = null;
for (StaffMember loopStaffMember : plugin.sl.getAllStaffMembers())
{
2020-08-15 22:42:46 +00:00
if (loopStaffMember.getName().equalsIgnoreCase(name) || loopStaffMember.getIps().contains(FUtil.getIp(player)))
{
2020-08-15 22:42:46 +00:00
staffMember = loopStaffMember;
break;
}
}
2020-06-30 07:25:38 +00:00
if (plugin.pl.isPlayerImpostor(player))
{
2020-08-15 22:42:46 +00:00
msg("This player was labeled as a Player impostor and is not a staff member, therefore they cannot be added to the staff list.", ChatColor.RED);
return true;
}
2020-08-15 22:42:46 +00:00
if (staffMember == null) // New staff member
{
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
if (player == null)
{
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
msg(FreedomCommand.PLAYER_NOT_FOUND);
return true;
}
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Adding " + player.getName() + " to the staff list", true);
staffMember = new StaffMember(player);
2019-04-21 00:16:00 +00:00
2020-08-15 22:42:46 +00:00
plugin.sl.addAdmin(staffMember);
2020-05-29 10:14:21 +00:00
plugin.rm.updateDisplay(player);
2020-08-15 22:42:46 +00:00
plugin.amp.updateAccountStatus(staffMember);
}
2020-08-15 22:42:46 +00:00
else // Existing staff member
{
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Re-adding " + player.getName() + " to the staff list", true);
TotalFreedomMod Electrum Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
2016-05-12 19:40:39 +00:00
if (player != null)
{
2020-08-15 22:42:46 +00:00
String oldName = staffMember.getName();
2020-06-30 07:25:38 +00:00
if (oldName != player.getName())
2020-07-17 04:40:10 +00:00
{
2020-08-15 22:42:46 +00:00
staffMember.setName(player.getName());
plugin.sql.updateStaffMemberName(oldName, staffMember.getName());
2020-07-17 04:40:10 +00:00
}
2020-08-15 22:42:46 +00:00
staffMember.addIp(FUtil.getIp(player));
}
2020-08-15 22:42:46 +00:00
staffMember.setActive(true);
staffMember.setLastLogin(new Date());
2020-08-15 16:35:48 +00:00
if (plugin.sl.isVerifiedStaff(player))
2019-08-04 02:50:31 +00:00
{
2020-08-15 22:42:46 +00:00
plugin.sl.verifiedNoStaff.remove(player.getName());
plugin.sl.verifiedNoStaffIps.remove(player.getName());
2019-08-04 02:50:31 +00:00
}
2020-08-15 22:42:46 +00:00
plugin.sl.save(staffMember);
plugin.sl.updateTables();
2018-03-03 04:29:08 +00:00
if (player != null)
{
plugin.rm.updateDisplay(player);
}
2019-04-21 00:16:00 +00:00
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
2020-08-15 22:42:46 +00:00
plugin.dc.syncRoles(staffMember, plugin.pl.getData(player).getDiscordID());
2019-04-21 00:16:00 +00:00
}
2020-08-15 22:42:46 +00:00
plugin.amp.updateAccountStatus(staffMember);
}
if (player != null)
{
final FPlayer fPlayer = plugin.pl.getPlayer(player);
if (fPlayer.getFreezeData().isFrozen())
{
fPlayer.getFreezeData().setFrozen(false);
2020-07-20 02:10:51 +00:00
msg(player, "You have been unfrozen.");
}
2018-03-03 04:29:08 +00:00
if (!player.isOp())
{
player.setOp(true);
player.sendMessage(YOU_ARE_OP);
}
}
return true;
}
case "remove":
{
if (args.length < 2)
{
return false;
}
2020-07-20 02:10:51 +00:00
checkConsole();
2020-08-15 22:42:46 +00:00
checkRank(Rank.MOD);
Player player = getPlayer(args[1]);
2020-08-15 22:42:46 +00:00
StaffMember staffMember = player != null ? plugin.sl.getAdmin(player) : plugin.sl.getEntryByName(args[1]);
2020-08-15 22:42:46 +00:00
if (staffMember == null)
{
2020-08-15 22:42:46 +00:00
msg("Staff member not found: " + args[1]);
return true;
}
2020-08-15 22:42:46 +00:00
FUtil.staffAction(sender.getName(), "Removing " + staffMember.getName() + " from the staff list", true);
staffMember.setActive(false);
2020-08-09 03:20:06 +00:00
2020-08-15 22:42:46 +00:00
plugin.sl.save(staffMember);
plugin.sl.updateTables();
2018-03-03 04:29:08 +00:00
if (player != null)
{
plugin.rm.updateDisplay(player);
2020-09-12 19:42:12 +00:00
plugin.pl.getPlayer(player).setStaffChat(false);
2018-03-03 04:29:08 +00:00
}
2019-04-21 00:16:00 +00:00
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
{
2020-09-12 19:42:12 +00:00
Discord.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
2019-04-21 00:16:00 +00:00
}
2020-08-15 22:42:46 +00:00
plugin.amp.updateAccountStatus(staffMember);
2020-08-08 05:51:09 +00:00
return true;
}
default:
{
return false;
}
}
}
2019-01-28 01:49:07 +00:00
2019-01-29 04:57:41 +00:00
@Override
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
2019-01-28 01:49:07 +00:00
{
2020-07-01 03:21:44 +00:00
if (args.length == 1)
2019-01-29 04:57:41 +00:00
{
2020-07-01 03:21:44 +00:00
List<String> arguments = new ArrayList<>();
arguments.add("list");
2020-08-15 22:42:46 +00:00
if (plugin.sl.isStaff(sender))
2019-01-29 04:57:41 +00:00
{
2020-07-01 03:21:44 +00:00
arguments.add("info");
2019-01-29 04:57:41 +00:00
}
2020-08-15 22:42:46 +00:00
if (plugin.sl.isMod(sender))
2019-01-29 04:57:41 +00:00
{
2020-07-01 03:21:44 +00:00
arguments.add("add");
arguments.add("remove");
2019-01-29 04:57:41 +00:00
}
2020-08-15 22:42:46 +00:00
if (plugin.sl.isAdmin(sender))
2019-01-29 04:57:41 +00:00
{
2020-07-01 03:21:44 +00:00
arguments.add("reload");
arguments.add("clean");
arguments.add("setrank");
2019-01-29 04:57:41 +00:00
}
2020-07-01 03:21:44 +00:00
return arguments;
}
if (args.length == 2 && (args[0].equals("add") || args[0].equals("remove") || args[0].equals("setrank") || args[0].equals("info")))
{
return FUtil.getPlayerList();
}
if (args.length == 3 && args[0].equals("setrank"))
{
2020-08-15 22:42:46 +00:00
return Arrays.asList("TRIAL_MOD", "MOD", "ADMIN");
2019-01-29 04:57:41 +00:00
}
return Collections.emptyList();
}
2020-08-09 03:20:06 +00:00
}