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

@ -127,7 +127,8 @@ public class Command_saconfig extends TFM_Command
sender.sendMessage("Superadmin not found: " + user_name);
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

@ -50,7 +50,7 @@ public class TFM_Util
mobtypes.put("villager", EntityType.VILLAGER);
mobtypes.put("wolf", EntityType.WOLF);
mobtypes.put("zombie", EntityType.ZOMBIE);
stop_commands.add("stop");
stop_commands.add("off");
stop_commands.add("end");
@ -115,7 +115,7 @@ public class TFM_Util
if (sender_p.getWorld().getName().equalsIgnoreCase(targetworld))
{
sender.sendMessage(ChatColor.GRAY + "Going to main world.");
sender_p.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
sender_p.teleport(Bukkit.getWorlds().get(0).getSpawnLocation());
return;
}
@ -128,7 +128,7 @@ public class TFM_Util
return;
}
}
sender.sendMessage(ChatColor.GRAY + "World " + targetworld + " not found.");
}
else
@ -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++;
@ -398,12 +407,12 @@ public class TFM_Util
public static EntityType getEntityType(String mobname) throws Exception
{
mobname = mobname.toLowerCase().trim();
if (!TFM_Util.mobtypes.containsKey(mobname))
{
throw new Exception();
}
return TFM_Util.mobtypes.get(mobname);
}
@ -532,11 +541,11 @@ public class TFM_Util
{
EjectMethod method = EjectMethod.STRIKE_ONE;
String player_ip = null;
try
{
player_ip = p.getAddress().getAddress().getHostAddress();
Integer num_kicks = TFM_Util.eject_tracker.get(player_ip);
if (num_kicks == null)
{
@ -544,7 +553,7 @@ public class TFM_Util
}
num_kicks = new Integer(num_kicks.intValue() + 1);
TFM_Util.eject_tracker.put(player_ip, num_kicks);
if (num_kicks.intValue() <= 1)
@ -563,35 +572,42 @@ public class TFM_Util
catch (Exception ex)
{
}
log.info("autoEject -> name: " + p.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
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;
}
}
}
public static void generateFlatlands()
{
generateFlatlands(TotalFreedomMod.flatlandsGenerationParams);
@ -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>>