This commit is contained in:
Steven Lawson 2011-10-14 19:29:09 -04:00
parent 5aaab9ff1e
commit e2d772bc4f
8 changed files with 68 additions and 50 deletions

View File

@ -699,8 +699,8 @@ public class TFM_Cmds_Admin implements CommandExecutor
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(target_pos, 2, playerdata);
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(0));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(1));
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
p.setGameMode(GameMode.SURVIVAL);

View File

@ -246,7 +246,7 @@ public class TFM_Cmds_General implements CommandExecutor
TFM_Util.gotoWorld(sender, "nether");
return true;
}
else if (cmd.getName().equalsIgnoreCase("banlist"))
else if (cmd.getName().equalsIgnoreCase("tfbanlist"))
{
if (args.length > 0)
{
@ -287,7 +287,7 @@ public class TFM_Cmds_General implements CommandExecutor
return true;
}
else if (cmd.getName().equalsIgnoreCase("ipbanlist"))
else if (cmd.getName().equalsIgnoreCase("tfipbanlist"))
{
if (args.length > 0)
{

View File

@ -1,10 +1,12 @@
package me.StevenLawson.TotalFreedomMod;
import java.util.Arrays;
import java.util.Set;
import java.util.logging.Logger;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
@ -112,6 +114,19 @@ public class TFM_Cmds_OP implements CommandExecutor
p.setOp(false);
p.sendMessage(TotalFreedomMod.YOU_ARE_NOT_OP);
}
if (args.length >= 1)
{
if (args[0].equalsIgnoreCase("purge"))
{
sender.sendMessage(ChatColor.GRAY + "Purging ops.txt.");
for (OfflinePlayer p : Bukkit.getOperators())
{
p.setOp(false);
}
}
}
}
else
{

View File

@ -59,7 +59,9 @@ public class TFM_EntityListener extends EntityListener
if (playerdata.getForcedDeath())
{
event.setCancelled(false);
event.setDamage(p.getHealth() + 1);
p.setFoodLevel(0);
p.setHealth(0);
event.setDamage(100);
playerdata.setForcedDeath(false);
return;
}

View File

@ -90,7 +90,7 @@ class TFM_PlayerListener extends PlayerListener
event.setTo(to);
}
if (playerdata != null)
{
if (playerdata.isCaged())
@ -99,12 +99,12 @@ class TFM_PlayerListener extends PlayerListener
if (target_pos.distance(playerdata.getCagePos()) > 2.5)
{
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(0), playerdata.getCageMaterial(1));
playerdata.setCaged(true, target_pos, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER), playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
playerdata.regenerateHistory();
playerdata.clearHistory();
TFM_Util.buildHistory(target_pos, 2, playerdata);
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(0));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(1));
TFM_Util.generateCube(target_pos, 2, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.INNER));
TFM_Util.generateCube(target_pos, 1, playerdata.getCageMaterial(TFM_UserInfo.CageLayer.OUTER));
}
}
}
@ -136,8 +136,10 @@ class TFM_PlayerListener extends PlayerListener
playerdata.incrementMsgCount();
plugin.userinfo.put(p, playerdata);
}
if (Pattern.compile("\\sbe\\s.*admin").matcher(event.getMessage().toLowerCase()).find())
String message = event.getMessage().toLowerCase();
if (Pattern.compile("\\sbe\\s.*admin").matcher(message).find()
|| Pattern.compile("\\shave\\s.*admin").matcher(message).find())
{
log.info("Kicked " + p.getName() + " for being annoying.");
p.kickPlayer("No, bitch.");
@ -161,21 +163,21 @@ class TFM_PlayerListener extends PlayerListener
boolean block_command = false;
if (command.matches("^/stop.*"))
if (Pattern.compile("^/stop").matcher(command).find())
{
if (!TFM_Util.isUserSuperadmin(player, plugin))
{
block_command = true;
}
}
else if (command.matches("^/reload.*"))
else if (Pattern.compile("^/reload").matcher(command).find())
{
if (!TFM_Util.isUserSuperadmin(player, plugin))
{
block_command = true;
}
}
if (block_command)
{
player.sendMessage(ChatColor.RED + "That command is prohibited.");

View File

@ -10,14 +10,9 @@ public class TFM_UserInfo
private boolean user_frozen = false;
private int msg_count = 0;
private int block_destroy_total = 0;
private int freecam_destroy_count = 0;
private int freecam_place_count = 0;
private boolean forced_death = false;
// -- Start Cage
private boolean user_caged = false;
private Location user_cage_pos;
private List<TFM_BlockData> user_cage_history = new ArrayList<TFM_BlockData>();
@ -27,12 +22,12 @@ public class TFM_UserInfo
public TFM_UserInfo()
{
}
public void setCaged(boolean state)
{
this.user_caged = state;
}
public void setCaged(boolean state, Location location, Material material_outer, Material material_inner)
{
this.user_caged = state;
@ -40,39 +35,45 @@ public class TFM_UserInfo
this.cage_material_outer = material_outer;
this.cage_material_inner = material_inner;
}
public boolean isCaged()
{
return this.user_caged;
}
public Material getCageMaterial(int layer)
public enum CageLayer
{
if (layer == 1)
INNER, OUTER
}
public Material getCageMaterial(CageLayer layer)
{
switch (layer)
{
return this.cage_material_inner;
}
else
{
return this.cage_material_outer;
case OUTER:
return this.cage_material_outer;
case INNER:
return this.cage_material_inner;
default:
return this.cage_material_outer;
}
}
public Location getCagePos()
{
return this.user_cage_pos;
}
public void clearHistory()
{
this.user_cage_history.clear();
}
public void insertHistoryBlock(Location location, Material material)
{
this.user_cage_history.add(new TFM_BlockData(location, material));
}
public void regenerateHistory()
{
for (TFM_BlockData blockdata : this.user_cage_history)
@ -80,7 +81,7 @@ public class TFM_UserInfo
blockdata.location.getBlock().setType(blockdata.material);
}
}
class TFM_BlockData
{
public Material material;
@ -92,9 +93,7 @@ public class TFM_UserInfo
this.material = material;
}
}
// -- End Cage
public boolean getForcedDeath()
{
return this.forced_death;
@ -144,7 +143,7 @@ public class TFM_UserInfo
{
this.block_destroy_total = 0;
}
public void incrementFreecamDestroyCount()
{
this.freecam_destroy_count++;
@ -159,7 +158,7 @@ public class TFM_UserInfo
{
this.freecam_destroy_count = 0;
}
public void incrementFreecamPlaceCount()
{
this.freecam_place_count++;

View File

@ -150,10 +150,10 @@ public class TotalFreedomMod extends JavaPlugin
this.getCommand("qdeop").setExecutor(OPCommands);
this.getCommand("qop").setExecutor(OPCommands);
this.getCommand("banlist").setExecutor(GeneralCommands);
this.getCommand("tfbanlist").setExecutor(GeneralCommands);
this.getCommand("creative").setExecutor(GeneralCommands);
this.getCommand("flatlands").setExecutor(GeneralCommands);
this.getCommand("ipbanlist").setExecutor(GeneralCommands);
this.getCommand("tfipbanlist").setExecutor(GeneralCommands);
this.getCommand("mp").setExecutor(GeneralCommands);
this.getCommand("nether").setExecutor(GeneralCommands);
this.getCommand("radar").setExecutor(GeneralCommands);

View File

@ -4,9 +4,6 @@ version: 1.7
description: Plugin for the Total Freedom server.
author: StevenLawson / Madgeek1450
commands:
banlist:
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
cage:
description: Superadmin command - Place a cage around someone.
usage: /<command> <partialname> [off|outermaterial] [water|lava]
@ -20,8 +17,8 @@ commands:
description: Telnet command - Send a chat message with chat formatting over telnet.
usage: /<command> [partialname]
deopall:
description: Superadmin command - Deop everyone on the server.
usage: /<command>
description: Superadmin command - Deop everyone on the server. Use 'purge' to clear ops.txt as well.
usage: /<command> [purge]
explosives:
description: Superadmin command - Enable/disable explosives and set effect radius.
usage: /<command> <on|off> [radius]
@ -46,9 +43,6 @@ commands:
gtfo:
description: Superadmin command - Makes someone GTFO (deop and ip ban by username).
usage: /<command> <partialname>
ipbanlist:
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
lavadmg:
description: Superadmin command - Enable/disable lava damage.
usage: /<command> <on|off>
@ -112,6 +106,12 @@ commands:
survival:
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
usage: /<command> [partialname]
tfbanlist:
description: Shows all banned player names. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
tfipbanlist:
description: Shows all banned IPs. Superadmins may optionally use 'purge' to clear the list.
usage: /<command> [purge]
tfsmite:
description: De-op, inventory clear, de-godmode, lightning, and kill your target. For naughty people only (or the entire server).
usage: /<command> [playername|all]