Fix /premium. Fixes #1850

Add ArmorStand to list of wipeable entities
Add /whohas clear. Resolves #1836
This commit is contained in:
JeromSar 2016-10-02 23:05:03 +02:00
parent c10b08df27
commit 9fa4c0662c
3 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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())
{

View File

@ -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 = "/<command> <item> [smite]", aliases = "wh")
@CommandParameters(description = "See who has a block and optionally clears the item.", usage = "/<command> <item> 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);
}
}
}