Changed to UUID saving and Fixed grammar/spelling errors.
This commit is contained in:
parent
57899690b2
commit
56a3a262ab
@ -23,13 +23,13 @@ public class ClearOnJoin implements Module, Listener
|
|||||||
private File listLocation = new File(Main.plugin.getDataFolder(), "clearonjoins.json");
|
private File listLocation = new File(Main.plugin.getDataFolder(), "clearonjoins.json");
|
||||||
private JSONArray list;
|
private JSONArray list;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings({ "unchecked", "deprecation" })
|
||||||
@Command(hook = "clearonjoin")
|
@Command(hook = "clearonjoin")
|
||||||
public void clearOnJoin(CommandSender sender, String player)
|
public void clearOnJoin(CommandSender sender, String player)
|
||||||
{
|
{
|
||||||
list.add("!" + player.toLowerCase());
|
list.add("!" + Bukkit.getServer().getOfflinePlayer(player).getUniqueId().toString());
|
||||||
saveList();
|
saveList();
|
||||||
Utils.sendMessage(sender, null, player + "'s inventory will be cleared next time they joins.");
|
Utils.sendMessage(sender, null, player + "'s inventory will be cleared next time they join.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@ -53,8 +53,9 @@ public class ClearOnJoin implements Module, Listener
|
|||||||
public void uponJoin(PlayerJoinEvent e)
|
public void uponJoin(PlayerJoinEvent e)
|
||||||
{
|
{
|
||||||
Player player = e.getPlayer();
|
Player player = e.getPlayer();
|
||||||
String playerName = player.getUniqueId().toString();
|
String playerUUID = player.getUniqueId().toString();
|
||||||
if (list.contains(playerName))
|
String playerName = player.getName();
|
||||||
|
if (list.contains(playerName) || list.contains(playerUUID))
|
||||||
{
|
{
|
||||||
e.getPlayer().getInventory().clear();
|
e.getPlayer().getInventory().clear();
|
||||||
Utils.sendMessage(player, null, "Inventory cleared.");
|
Utils.sendMessage(player, null, "Inventory cleared.");
|
||||||
@ -89,7 +90,7 @@ public class ClearOnJoin implements Module, Listener
|
|||||||
{
|
{
|
||||||
return "command clearonjoin {\n" +
|
return "command clearonjoin {\n" +
|
||||||
" [string:name] {\n" +
|
" [string:name] {\n" +
|
||||||
" help Clears that player's inventory the nect time they join.;\n" +
|
" help Clears that player's inventory the next time they join.;\n" +
|
||||||
" run clearonjoin name;\n" +
|
" run clearonjoin name;\n" +
|
||||||
" perm utils.clearonjoin.other;\n" +
|
" perm utils.clearonjoin.other;\n" +
|
||||||
" }\n" +
|
" }\n" +
|
||||||
|
Reference in New Issue
Block a user