2011-09-20 02:52:08 +00:00
|
|
|
package me.StevenLawson.TotalFreedomMod;
|
|
|
|
|
2011-09-26 15:26:52 +00:00
|
|
|
import java.io.File;
|
2011-10-12 18:13:10 +00:00
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
2011-09-26 22:28:01 +00:00
|
|
|
import java.net.InetSocketAddress;
|
2011-09-21 03:31:59 +00:00
|
|
|
import java.util.ArrayList;
|
2011-10-01 17:59:46 +00:00
|
|
|
import java.util.HashMap;
|
2011-09-21 03:31:59 +00:00
|
|
|
import java.util.List;
|
2011-10-10 12:09:19 +00:00
|
|
|
import java.util.Map;
|
2011-10-12 18:13:10 +00:00
|
|
|
import java.util.jar.JarFile;
|
2011-09-20 02:52:08 +00:00
|
|
|
import java.util.logging.Level;
|
|
|
|
import java.util.logging.Logger;
|
2011-10-12 18:13:10 +00:00
|
|
|
import java.util.zip.ZipEntry;
|
2011-09-20 02:52:08 +00:00
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
import org.bukkit.ChatColor;
|
2011-09-25 06:17:32 +00:00
|
|
|
import org.bukkit.Location;
|
2011-10-10 12:09:19 +00:00
|
|
|
import org.bukkit.Material;
|
2011-10-02 04:18:52 +00:00
|
|
|
import org.bukkit.World;
|
2011-10-10 12:09:19 +00:00
|
|
|
import org.bukkit.block.Block;
|
2011-09-20 02:52:08 +00:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-10-12 19:33:31 +00:00
|
|
|
import org.bukkit.configuration.file.FileConfiguration;
|
|
|
|
import org.bukkit.configuration.file.YamlConfiguration;
|
2011-10-02 04:18:52 +00:00
|
|
|
import org.bukkit.entity.*;
|
2011-09-23 03:22:10 +00:00
|
|
|
import org.bukkit.event.Event;
|
|
|
|
import org.bukkit.plugin.PluginManager;
|
2011-09-20 02:52:08 +00:00
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
|
|
|
public class TotalFreedomMod extends JavaPlugin
|
|
|
|
{
|
2011-10-01 17:59:46 +00:00
|
|
|
public TotalFreedomMod tfm = this;
|
|
|
|
|
2011-10-02 04:23:22 +00:00
|
|
|
private final TFM_EntityListener entityListener = new TFM_EntityListener(this);
|
|
|
|
private final TFM_BlockListener blockListener = new TFM_BlockListener(this);
|
|
|
|
private final TFM_PlayerListener playerListener = new TFM_PlayerListener(this);
|
2011-10-01 17:59:46 +00:00
|
|
|
|
2011-09-26 15:26:52 +00:00
|
|
|
private static final Logger log = Logger.getLogger("Minecraft");
|
2011-10-01 17:59:46 +00:00
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
public boolean allPlayersFrozen = false;
|
|
|
|
public static Map<Player, TFM_UserInfo> userinfo = new HashMap<Player, TFM_UserInfo>();
|
2011-10-01 17:59:46 +00:00
|
|
|
|
2011-10-10 12:09:19 +00:00
|
|
|
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
2011-10-12 22:45:43 +00:00
|
|
|
public static final String CONFIG_FILE = "config.yml";
|
2011-10-02 16:15:16 +00:00
|
|
|
public static final String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
|
|
|
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
|
|
|
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
|
|
|
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
2011-10-01 17:59:46 +00:00
|
|
|
|
2011-10-02 16:15:16 +00:00
|
|
|
@Override
|
|
|
|
public void onEnable()
|
|
|
|
{
|
2011-10-12 20:25:26 +00:00
|
|
|
loadTFMConfig();
|
2011-10-02 16:15:16 +00:00
|
|
|
registerEventHandlers();
|
|
|
|
registerCommands();
|
2011-10-12 22:45:43 +00:00
|
|
|
|
|
|
|
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
2011-09-30 19:32:13 +00:00
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
log.log(Level.INFO, getDescription().getName() + " - Enabled! - Version: " + getDescription().getVersion() + " by Madgeek1450");
|
|
|
|
log.log(Level.INFO, getDescription().getName() + " - Loaded superadmin names: " + implodeStringList(", ", superadmins));
|
|
|
|
log.log(Level.INFO, getDescription().getName() + " - Loaded superadmin IPs: " + implodeStringList(", ", superadmin_ips));
|
|
|
|
log.log(Level.INFO, getDescription().getName() + " - Auto drop deleter is " + (autoEntityWipe ? "enabled" : "disabled") + ".");
|
2011-10-02 16:15:16 +00:00
|
|
|
}
|
2011-09-26 15:26:52 +00:00
|
|
|
|
2011-10-02 16:15:16 +00:00
|
|
|
@Override
|
|
|
|
public void onDisable()
|
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
Bukkit.getScheduler().cancelTasks(this);
|
|
|
|
log.log(Level.INFO, getDescription().getName() + " - Disabled.");
|
|
|
|
}
|
|
|
|
|
|
|
|
class TFM_Heartbeat implements Runnable
|
|
|
|
{
|
|
|
|
private TotalFreedomMod plugin;
|
|
|
|
|
|
|
|
TFM_Heartbeat(TotalFreedomMod instance)
|
|
|
|
{
|
|
|
|
this.plugin = instance;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void run()
|
|
|
|
{
|
|
|
|
for (Player p : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
TFM_UserInfo playerdata = TotalFreedomMod.userinfo.get(p);
|
|
|
|
if (playerdata != null)
|
|
|
|
{
|
|
|
|
playerdata.resetMsgCount();
|
|
|
|
playerdata.resetBlockDestroyCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (plugin.autoEntityWipe)
|
|
|
|
{
|
|
|
|
plugin.wipeDropEntities();
|
|
|
|
}
|
|
|
|
}
|
2011-09-26 15:26:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-02 16:15:16 +00:00
|
|
|
public void tfm_broadcastMessage(String message, ChatColor color)
|
2011-09-26 15:26:52 +00:00
|
|
|
{
|
|
|
|
log.info(message);
|
|
|
|
|
|
|
|
for (Player p : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
p.sendMessage(color + message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-02 16:15:16 +00:00
|
|
|
public void tfm_broadcastMessage(String message)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
|
|
|
log.info(ChatColor.stripColor(message));
|
|
|
|
|
|
|
|
for (Player p : Bukkit.getOnlinePlayers())
|
|
|
|
{
|
|
|
|
p.sendMessage(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-26 15:26:52 +00:00
|
|
|
public String implodeStringList(String glue, List<String> pieces)
|
|
|
|
{
|
|
|
|
StringBuilder output = new StringBuilder();
|
|
|
|
for (int i = 0; i < pieces.size(); i++)
|
|
|
|
{
|
|
|
|
if (i != 0)
|
|
|
|
{
|
|
|
|
output.append(glue);
|
|
|
|
}
|
|
|
|
output.append(pieces.get(i));
|
|
|
|
}
|
|
|
|
return output.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
public String formatLocation(Location in_loc)
|
|
|
|
{
|
|
|
|
return String.format("%s: (%d, %d, %d)",
|
|
|
|
in_loc.getWorld().getName(),
|
|
|
|
Math.round(in_loc.getX()),
|
|
|
|
Math.round(in_loc.getY()),
|
|
|
|
Math.round(in_loc.getZ()));
|
|
|
|
}
|
|
|
|
|
2011-09-26 22:28:01 +00:00
|
|
|
public boolean isUserSuperadmin(CommandSender user)
|
2011-09-26 15:26:52 +00:00
|
|
|
{
|
2011-09-26 22:28:01 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
if (!(user instanceof Player))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2011-09-28 17:42:21 +00:00
|
|
|
|
2011-09-26 22:28:01 +00:00
|
|
|
if (Bukkit.getOnlineMode())
|
|
|
|
{
|
|
|
|
if (superadmins.contains(user.getName()))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Player p = (Player) user;
|
|
|
|
if (p != null)
|
|
|
|
{
|
|
|
|
InetSocketAddress ip_address_obj = p.getAddress();
|
|
|
|
if (ip_address_obj != null)
|
|
|
|
{
|
|
|
|
String user_ip = ip_address_obj.getAddress().toString().replaceAll("/", "").trim();
|
|
|
|
if (user_ip != null && !user_ip.isEmpty())
|
|
|
|
{
|
|
|
|
if (superadmin_ips.contains(user_ip))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
log.severe("Exception in TotalFreedomMod.isUserSuperadmin: " + ex.getMessage());
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2011-09-26 15:26:52 +00:00
|
|
|
}
|
2011-10-01 17:59:46 +00:00
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
public int wipeDropEntities()
|
2011-10-01 17:59:46 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
int removed = 0;
|
|
|
|
for (World world : Bukkit.getWorlds())
|
2011-10-01 17:59:46 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
for (Entity ent : world.getEntities())
|
2011-10-01 17:59:46 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
if (ent instanceof Arrow || (ent instanceof TNTPrimed && !this.allowExplosions) || ent instanceof Item || ent instanceof ExperienceOrb)
|
|
|
|
{
|
|
|
|
ent.remove();
|
|
|
|
removed++;
|
|
|
|
}
|
2011-10-01 17:59:46 +00:00
|
|
|
}
|
|
|
|
}
|
2011-10-12 22:45:43 +00:00
|
|
|
return removed;
|
|
|
|
}
|
2011-10-02 04:18:52 +00:00
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
public void gotoWorld(CommandSender sender, String targetworld)
|
|
|
|
{
|
|
|
|
if (sender instanceof Player)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
Player sender_p = (Player) sender;
|
|
|
|
|
|
|
|
if (sender_p.getWorld().getName().equalsIgnoreCase(targetworld))
|
|
|
|
{
|
|
|
|
sender.sendMessage(ChatColor.GRAY + "Going to main world.");
|
|
|
|
Bukkit.getServer().dispatchCommand(sender, "world 0");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (World world : Bukkit.getWorlds())
|
|
|
|
{
|
|
|
|
if (world.getName().equalsIgnoreCase(targetworld))
|
|
|
|
{
|
|
|
|
sender.sendMessage(ChatColor.GRAY + "Going to world: " + targetworld);
|
|
|
|
Bukkit.getServer().dispatchCommand(sender, "mv tp " + targetworld);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sender.sendMessage("This command may not be used from the console.");
|
2011-10-02 04:18:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
public void buildHistory(Location location, int length, TFM_UserInfo playerdata)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
Block center_block = location.getBlock();
|
|
|
|
for (int x_offset = -length; x_offset <= length; x_offset++)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
for (int y_offset = -length; y_offset <= length; y_offset++)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
for (int z_offset = -length; z_offset <= length; z_offset++)
|
2011-10-02 04:18:52 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
Block block = center_block.getRelative(x_offset, y_offset, z_offset);
|
|
|
|
playerdata.insertHistoryBlock(block.getLocation(), block.getType());
|
2011-10-02 04:18:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-01 17:59:46 +00:00
|
|
|
}
|
2011-10-02 16:15:16 +00:00
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
public void generateCube(Location location, int length, Material material)
|
|
|
|
{
|
|
|
|
Block center_block = location.getBlock();
|
|
|
|
for (int x_offset = -length; x_offset <= length; x_offset++)
|
|
|
|
{
|
|
|
|
for (int y_offset = -length; y_offset <= length; y_offset++)
|
|
|
|
{
|
|
|
|
for (int z_offset = -length; z_offset <= length; z_offset++)
|
|
|
|
{
|
|
|
|
center_block.getRelative(x_offset, y_offset, z_offset).setType(material);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean allowFirePlace = false;
|
|
|
|
public Boolean allowFireSpread = false;
|
|
|
|
public Boolean allowLavaDamage = false;
|
|
|
|
public boolean allowLavaPlace = false;
|
|
|
|
public boolean allowWaterPlace = false;
|
|
|
|
public Boolean allowExplosions = false;
|
|
|
|
public double explosiveRadius = 4.0D;
|
|
|
|
public boolean autoEntityWipe = true;
|
|
|
|
public boolean nukeMonitor = true;
|
|
|
|
public int nukeMonitorCountBreak = 100;
|
|
|
|
public double nukeMonitorRange = 10.0D;
|
|
|
|
public int freecamTriggerCount = 10;
|
|
|
|
public Boolean preprocessLogEnabled = true;
|
|
|
|
public List<String> superadmins = new ArrayList<String>();
|
|
|
|
public List<String> superadmin_ips = new ArrayList<String>();
|
|
|
|
|
2011-10-12 20:25:26 +00:00
|
|
|
private void loadTFMConfig()
|
2011-10-02 16:15:16 +00:00
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
log.info(getDescription().getName() + " Loading configuration...");
|
|
|
|
|
|
|
|
createDefaultConfiguration(CONFIG_FILE);
|
|
|
|
|
|
|
|
FileConfiguration config = YamlConfiguration.loadConfiguration(new File(getDataFolder(), CONFIG_FILE));
|
|
|
|
|
|
|
|
allowFirePlace = config.getBoolean("allow_fire_place", allowFirePlace);
|
|
|
|
allowFireSpread = config.getBoolean("allow_fire_spread", allowFireSpread);
|
|
|
|
allowLavaDamage = config.getBoolean("allow_lava_damage", allowLavaDamage);
|
|
|
|
allowLavaPlace = config.getBoolean("allow_lava_place", allowLavaPlace);
|
|
|
|
allowWaterPlace = config.getBoolean("allow_water_place", allowWaterPlace);
|
|
|
|
allowExplosions = config.getBoolean("allow_explosions", allowExplosions);
|
|
|
|
explosiveRadius = config.getDouble("explosiveRadius", explosiveRadius);
|
|
|
|
autoEntityWipe = config.getBoolean("auto_wipe", autoEntityWipe);
|
|
|
|
nukeMonitor = config.getBoolean("nuke_monitor", nukeMonitor);
|
|
|
|
nukeMonitorCountBreak = config.getInt("nuke_monitor_count", nukeMonitorCountBreak);
|
|
|
|
nukeMonitorRange = config.getDouble("nuke_monitor_range", nukeMonitorRange);
|
|
|
|
freecamTriggerCount = config.getInt("freecam_trigger_count", freecamTriggerCount);
|
|
|
|
preprocessLogEnabled = config.getBoolean("preprocess_log", preprocessLogEnabled);
|
2011-10-12 18:13:10 +00:00
|
|
|
|
2011-10-12 19:33:31 +00:00
|
|
|
superadmins = (List<String>) config.getList("superadmins", null);
|
2011-10-12 18:13:10 +00:00
|
|
|
if (superadmins == null)
|
2011-10-02 16:15:16 +00:00
|
|
|
{
|
2011-10-12 18:13:10 +00:00
|
|
|
superadmins = new ArrayList<String>();
|
|
|
|
superadmins.add("Madgeek1450");
|
|
|
|
superadmins.add("markbyron");
|
|
|
|
}
|
|
|
|
|
2011-10-12 19:33:31 +00:00
|
|
|
superadmin_ips = (List<String>) config.getList("superadmin_ips", null);
|
2011-10-12 18:13:10 +00:00
|
|
|
if (superadmin_ips == null)
|
|
|
|
{
|
|
|
|
superadmin_ips = new ArrayList<String>();
|
2011-10-12 22:45:43 +00:00
|
|
|
superadmin_ips.add("127.0.0.1");
|
2011-10-12 18:13:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void createDefaultConfiguration(String name)
|
|
|
|
{
|
|
|
|
File actual = new File(getDataFolder(), name);
|
|
|
|
if (!actual.exists())
|
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
log.info(getDescription().getName() + ": Installing default configuration file template: " + actual.getPath());
|
2011-10-12 18:13:10 +00:00
|
|
|
InputStream input = null;
|
|
|
|
try
|
|
|
|
{
|
|
|
|
JarFile file = new JarFile(getFile());
|
2011-10-12 20:25:26 +00:00
|
|
|
ZipEntry copy = file.getEntry(name);
|
2011-10-12 18:13:10 +00:00
|
|
|
if (copy == null)
|
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
log.severe(getDescription().getName() + ": Unable to read default configuration: " + actual.getPath());
|
2011-10-12 18:13:10 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
input = file.getInputStream(copy);
|
|
|
|
}
|
|
|
|
catch (IOException ioex)
|
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
log.severe(getDescription().getName() + ": Unable to read default configuration: " + actual.getPath());
|
2011-10-12 18:13:10 +00:00
|
|
|
}
|
|
|
|
if (input != null)
|
|
|
|
{
|
|
|
|
FileOutputStream output = null;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
2011-10-12 20:25:26 +00:00
|
|
|
getDataFolder().mkdirs();
|
2011-10-12 18:13:10 +00:00
|
|
|
output = new FileOutputStream(actual);
|
|
|
|
byte[] buf = new byte[8192];
|
|
|
|
int length = 0;
|
|
|
|
while ((length = input.read(buf)) > 0)
|
2011-10-02 16:15:16 +00:00
|
|
|
{
|
2011-10-12 18:13:10 +00:00
|
|
|
output.write(buf, 0, length);
|
|
|
|
}
|
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
log.info(getDescription().getName() + ": Default configuration file written: " + actual.getPath());
|
2011-10-12 18:13:10 +00:00
|
|
|
}
|
|
|
|
catch (IOException ioex)
|
|
|
|
{
|
2011-10-12 22:45:43 +00:00
|
|
|
log.log(Level.SEVERE, getDescription().getName() + ": Unable to write default configuration: " + actual.getPath(), ioex);
|
2011-10-12 18:13:10 +00:00
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (input != null)
|
|
|
|
{
|
|
|
|
input.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (IOException ioex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
2011-10-02 16:15:16 +00:00
|
|
|
{
|
2011-10-12 18:13:10 +00:00
|
|
|
if (output != null)
|
|
|
|
{
|
|
|
|
output.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (IOException ioex)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-02 16:15:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void registerEventHandlers()
|
|
|
|
{
|
|
|
|
PluginManager pm = this.getServer().getPluginManager();
|
|
|
|
|
|
|
|
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.ENTITY_COMBUST, entityListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.EXPLOSION_PRIME, entityListener, Event.Priority.High, this);
|
|
|
|
|
|
|
|
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.BLOCK_BURN, blockListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.BLOCK_PLACE, blockListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.BLOCK_BREAK, blockListener, Event.Priority.Normal, this);
|
|
|
|
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_COMMAND_PREPROCESS, playerListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_INTERACT, playerListener, Event.Priority.High, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_MOVE, playerListener, Event.Priority.Normal, this);
|
|
|
|
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Event.Priority.Normal, this);
|
|
|
|
}
|
|
|
|
|
2011-10-12 22:45:43 +00:00
|
|
|
private TFM_Cmds_OP OPCommands = new TFM_Cmds_OP(this);
|
|
|
|
private TFM_Cmds_Override OverrideCommands = new TFM_Cmds_Override(this);
|
|
|
|
private TFM_Cmds_General GeneralCommands = new TFM_Cmds_General(this);
|
|
|
|
private TFM_Cmds_AntiBlock AntiblockCommands = new TFM_Cmds_AntiBlock(this);
|
|
|
|
private TFM_Cmds_Admin AdminCommands = new TFM_Cmds_Admin(this);
|
|
|
|
|
2011-10-02 16:15:16 +00:00
|
|
|
private void registerCommands()
|
|
|
|
{
|
|
|
|
this.getCommand("opme").setExecutor(OPCommands);
|
|
|
|
this.getCommand("opall").setExecutor(OPCommands);
|
|
|
|
this.getCommand("deopall").setExecutor(OPCommands);
|
|
|
|
this.getCommand("qop").setExecutor(OPCommands);
|
|
|
|
this.getCommand("qdeop").setExecutor(OPCommands);
|
|
|
|
|
|
|
|
this.getCommand("creative").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("survival").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("status").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("radar").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("mp").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("rd").setExecutor(GeneralCommands);
|
2011-10-03 01:50:04 +00:00
|
|
|
this.getCommand("flatlands").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("skylands").setExecutor(GeneralCommands);
|
2011-10-10 12:09:19 +00:00
|
|
|
this.getCommand("nether").setExecutor(GeneralCommands);
|
|
|
|
this.getCommand("banlist").setExecutor(GeneralCommands);
|
2011-10-12 19:03:34 +00:00
|
|
|
this.getCommand("ipbanlist").setExecutor(GeneralCommands);
|
2011-10-02 16:15:16 +00:00
|
|
|
|
|
|
|
this.getCommand("fr").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("gtfo").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("gadmin").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("wildcard").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("nonuke").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("prelog").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("cake").setExecutor(AdminCommands);
|
2011-10-03 21:41:09 +00:00
|
|
|
this.getCommand("gcmd").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("qjail").setExecutor(AdminCommands);
|
|
|
|
this.getCommand("umd").setExecutor(AdminCommands);
|
2011-10-05 19:07:45 +00:00
|
|
|
this.getCommand("csay").setExecutor(AdminCommands);
|
2011-10-10 12:09:19 +00:00
|
|
|
this.getCommand("cage").setExecutor(AdminCommands);
|
2011-10-11 02:26:11 +00:00
|
|
|
this.getCommand("orbit").setExecutor(AdminCommands);
|
2011-10-02 16:15:16 +00:00
|
|
|
|
|
|
|
this.getCommand("explosives").setExecutor(AntiblockCommands);
|
|
|
|
this.getCommand("lavadmg").setExecutor(AntiblockCommands);
|
|
|
|
this.getCommand("lavaplace").setExecutor(AntiblockCommands);
|
|
|
|
this.getCommand("firespread").setExecutor(AntiblockCommands);
|
|
|
|
this.getCommand("fireplace").setExecutor(AntiblockCommands);
|
|
|
|
this.getCommand("waterplace").setExecutor(AntiblockCommands);
|
|
|
|
|
|
|
|
this.getCommand("say").setExecutor(OverrideCommands);
|
|
|
|
this.getCommand("stop").setExecutor(OverrideCommands);
|
|
|
|
this.getCommand("list").setExecutor(OverrideCommands);
|
|
|
|
this.getCommand("listreal").setExecutor(OverrideCommands);
|
|
|
|
}
|
2011-09-20 02:52:08 +00:00
|
|
|
}
|