From 9fa4c0662c12b0db7bedc802a3e04a134b7b73c4 Mon Sep 17 00:00:00 2001 From: JeromSar Date: Sun, 2 Oct 2016 23:05:03 +0200 Subject: [PATCH] Fix /premium. Fixes #1850 Add ArmorStand to list of wipeable entities Add /whohas clear. Resolves #1836 --- .../me/totalfreedom/totalfreedommod/EntityWiper.java | 2 ++ .../totalfreedommod/command/Command_premium.java | 12 +++++++----- .../totalfreedommod/command/Command_whohas.java | 8 ++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java index 1f157717..b5dce0a9 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/EntityWiper.java @@ -12,6 +12,7 @@ import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.entity.AreaEffectCloud; +import org.bukkit.entity.ArmorStand; import org.bukkit.entity.Boat; import org.bukkit.entity.EnderCrystal; import org.bukkit.entity.EnderSignal; @@ -58,6 +59,7 @@ public class EntityWiper extends FreedomService wipables.add(Minecart.class); wipables.add(Boat.class); wipables.add(FallingBlock.class); + wipables.add(ArmorStand.class); } @Override diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java index 8d526e11..f2c68025 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_premium.java @@ -44,12 +44,14 @@ public class Command_premium extends FreedomCommand { try { - final URL getUrl = new URL("https://minecraft.net/haspaid.jsp?user=" + name); + final URL getUrl = new URL("http://axis.iaero.me/accstatus?username=" + name + "&format=plain"); final URLConnection urlConnection = getUrl.openConnection(); - // Read the response - final BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); - final String message = ("false".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes"); - in.close(); + final String message; + try ( // Read the response + BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()))) + { + message = (!"PREMIUM".equalsIgnoreCase(in.readLine()) ? ChatColor.RED + "No" : ChatColor.DARK_GREEN + "Yes"); + } if (!plugin.isEnabled()) { diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java index b7747dfb..9cc2e255 100644 --- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java +++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_whohas.java @@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; @CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH) -@CommandParameters(description = "See who has a block and optionally smite.", usage = "/ [smite]", aliases = "wh") +@CommandParameters(description = "See who has a block and optionally clears the item.", usage = "/ clear", aliases = "wh") public class Command_whohas extends FreedomCommand { @@ -24,7 +24,7 @@ public class Command_whohas extends FreedomCommand return false; } - final boolean doSmite = args.length >= 2 && "smite".equalsIgnoreCase(args[1]); + final boolean doClear = args.length >= 2 && "clear".equalsIgnoreCase(args[1]); final String materialName = args[0]; Material material = Material.matchMaterial(materialName); @@ -52,9 +52,9 @@ public class Command_whohas extends FreedomCommand if (player.getInventory().contains(material)) { players.add(player.getName()); - if (doSmite && !plugin.al.isAdmin(player)) + if (doClear && !plugin.al.isAdmin(player)) { - Command_smite.smite(player); + player.getInventory().remove(material); } } }