A few old fixes i forgot to commit.

This commit is contained in:
Steven Lawson 2012-07-22 14:06:01 -04:00
parent edd2a19ec0
commit 5dd36a9f26
8 changed files with 56 additions and 28 deletions

View File

@ -1,5 +1,5 @@
#Sun, 11 Mar 2012 23:38:55 -0500
#Sun, 22 Jul 2012 12:53:52 -0400
program.VERSION=2.5
program.BUILDNUM=59
program.BUILDDATE=03/11/2012 11\:38 PM
program.BUILDNUM=62
program.BUILDDATE=07/22/2012 12\:53 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Mar 11 23:38:55 EDT 2012
build.number=60
#Sun Jul 22 12:53:52 EDT 2012
build.number=63

View File

@ -1,5 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands;
import java.util.Arrays;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor;
@ -14,8 +15,19 @@ public class Command_rd extends TFM_Command
{
if (senderIsConsole || sender.isOp())
{
sender.sendMessage(ChatColor.GRAY + "Removing all dropped items, arrows, exp. orbs and TNT...");
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeDropEntities(true)) + " dropped enties removed.");
if (args.length == 1)
{
if (Arrays.asList("minecart", "minecarts", "cart", "carts").contains(args[0].toLowerCase()))
{
sender.sendMessage(ChatColor.GRAY + "Removing all projectiles, dropped items, exp. orbs, primed explosives, and minecarts.");
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true, true)) + " enties removed.");
}
}
else
{
sender.sendMessage(ChatColor.GRAY + "Removing all projectiles, dropped items, exp. orbs and primed explosives.");
sender.sendMessage(ChatColor.GRAY + String.valueOf(TFM_Util.wipeEntities(true)) + " enties removed.");
}
}
else
{

View File

@ -128,6 +128,7 @@ public class Command_saconfig extends TFM_Command
return true;
}
sender.sendMessage("Removing superadmin: " + user_name);
TotalFreedomMod.superadmins.remove(user_name);
if (config.contains(user_name))
@ -135,6 +136,7 @@ public class Command_saconfig extends TFM_Command
List<String> user_ips = (List<String>) config.getStringList(user_name);
for (String ip : user_ips)
{
sender.sendMessage("Removing superadmin IP: " + ip);
TotalFreedomMod.superadmin_ips.remove(ip);
}
}

View File

@ -335,7 +335,7 @@ public class TFM_PlayerListener implements Listener
playerdata.resetMsgCount();
TFM_Util.wipeDropEntities(true);
TFM_Util.wipeEntities(true);
event.setCancelled(true);
return;

View File

@ -28,7 +28,7 @@ public class TFM_Heartbeat implements Runnable
if (TotalFreedomMod.autoEntityWipe)
{
TFM_Util.wipeDropEntities(!TotalFreedomMod.allowExplosions);
TFM_Util.wipeEntities(!TotalFreedomMod.allowExplosions);
}
if (TotalFreedomMod.disableNight)

View File

@ -355,14 +355,23 @@ public class TFM_Util
}
}
public static int wipeDropEntities(boolean wipe_tnt)
public static int wipeEntities(boolean wipe_explosives)
{
return wipeEntities(wipe_explosives, false);
}
public static int wipeEntities(boolean wipe_explosives, boolean wipe_carts)
{
int removed = 0;
for (World world : Bukkit.getWorlds())
{
for (Entity ent : world.getEntities())
{
if (ent instanceof Arrow || (ent instanceof TNTPrimed && wipe_tnt) || ent instanceof Item || ent instanceof ExperienceOrb)
if (ent instanceof Projectile
|| ent instanceof Item
|| ent instanceof ExperienceOrb
|| (ent instanceof Explosive && wipe_explosives)
|| (ent instanceof Minecart && wipe_carts))
{
ent.remove();
removed++;
@ -569,24 +578,31 @@ public class TFM_Util
p.setOp(false);
p.setGameMode(GameMode.SURVIVAL);
p.getInventory().clear();
p.kickPlayer(kickMessage);
switch (method)
{
case STRIKE_ONE:
{
p.kickPlayer(kickMessage);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 1m", p.getName()));
break;
}
case STRIKE_TWO:
{
p.kickPlayer(kickMessage);
Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), String.format("tempban %s 3m", p.getName()));
break;
}
case STRIKE_THREE:
{
Bukkit.banIP(player_ip);
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
String[] ip_address_parts = player_ip.split("\\.");
Bukkit.banIP(ip_address_parts[0] + "." + ip_address_parts[1] + ".*.*");
p.setBanned(true);
p.kickPlayer(kickMessage);
break;
}
}
@ -606,9 +622,7 @@ public class TFM_Util
flatlands.generator(new CleanroomChunkGenerator(genParams));
Bukkit.getServer().createWorld(flatlands);
}
// I wrote all this before i discovered getTargetBlock >.> - might come in handy some day...
// public static final double LOOKAT_VIEW_HEIGHT = 1.65;
// public static final double LOOKAT_STEP_DISTANCE = 0.2;
//

View File

@ -119,8 +119,8 @@ commands:
description: Owner Command - Broadcasts the given message with no extra formatting.
usage: /<command> <message>
rd:
description: Remove drops, arrows, primed TNT, and expierence orbs in all worlds.
usage: /<command>
description: Remove all projectiles, dropped items, experience orbs, primed explosives, and minecarts. Minecarts are optional, based on if "carts" is included after the command.
usage: /<command> <carts>
saconfig:
description: Owner command - Manage superadmins.
usage: /<command> <list | <add|delete> <username>>