mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Misc
This commit is contained in:
parent
e5cce52e5c
commit
ff88c7bffe
@ -6,26 +6,35 @@ import org.bukkit.entity.Player;
|
|||||||
|
|
||||||
public class RadarData implements Comparator<RadarData>
|
public class RadarData implements Comparator<RadarData>
|
||||||
{
|
{
|
||||||
Player player;
|
Player player;
|
||||||
double distance;
|
double distance;
|
||||||
Location location;
|
Location location;
|
||||||
|
|
||||||
public RadarData(Player inplayer, double indistance, Location inlocation)
|
|
||||||
{
|
|
||||||
this.player = inplayer;
|
|
||||||
this.distance = indistance;
|
|
||||||
this.location = inlocation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public RadarData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public RadarData(Player inplayer, double indistance, Location inlocation)
|
||||||
public int compare(RadarData t1, RadarData t2)
|
{
|
||||||
{
|
this.player = inplayer;
|
||||||
if (t1.distance > t2.distance) return 1;
|
this.distance = indistance;
|
||||||
else if (t1.distance < t2.distance) return -1;
|
this.location = inlocation;
|
||||||
else return 0;
|
}
|
||||||
}
|
|
||||||
|
public RadarData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(RadarData t1, RadarData t2)
|
||||||
|
{
|
||||||
|
if (t1.distance > t2.distance)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else if (t1.distance < t2.distance)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ public class TFUserInfo
|
|||||||
private boolean user_frozen = false;
|
private boolean user_frozen = false;
|
||||||
private int msg_count = 0;
|
private int msg_count = 0;
|
||||||
private int bd_count = 0;
|
private int bd_count = 0;
|
||||||
|
|
||||||
public TFUserInfo()
|
public TFUserInfo()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -14,6 +14,7 @@ public class TFUserInfo
|
|||||||
{
|
{
|
||||||
return this.user_frozen;
|
return this.user_frozen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFrozen(boolean fr)
|
public void setFrozen(boolean fr)
|
||||||
{
|
{
|
||||||
this.user_frozen = fr;
|
this.user_frozen = fr;
|
||||||
@ -23,23 +24,27 @@ public class TFUserInfo
|
|||||||
{
|
{
|
||||||
this.msg_count = 0;
|
this.msg_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementMsgCount()
|
public void incrementMsgCount()
|
||||||
{
|
{
|
||||||
this.msg_count++;
|
this.msg_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMsgCount()
|
public int getMsgCount()
|
||||||
{
|
{
|
||||||
return this.msg_count;
|
return this.msg_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void incrementBlockDestroyCount()
|
public void incrementBlockDestroyCount()
|
||||||
{
|
{
|
||||||
this.bd_count++;
|
this.bd_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBlockDestroyCount()
|
public int getBlockDestroyCount()
|
||||||
{
|
{
|
||||||
return this.bd_count;
|
return this.bd_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetBlockDestroyCount()
|
public void resetBlockDestroyCount()
|
||||||
{
|
{
|
||||||
this.bd_count = 0;
|
this.bd_count = 0;
|
||||||
|
@ -7,16 +7,20 @@ import java.util.Arrays;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.*;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.util.config.Configuration;
|
import org.bukkit.util.config.Configuration;
|
||||||
@ -35,20 +39,25 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public List<String> superadmins = new ArrayList<String>();
|
public List<String> superadmins = new ArrayList<String>();
|
||||||
public List<String> superadmin_ips = new ArrayList<String>();
|
public List<String> superadmin_ips = new ArrayList<String>();
|
||||||
public Boolean allowExplosions = false;
|
public Boolean allowExplosions = false;
|
||||||
|
public boolean allowFirePlace = false;
|
||||||
|
public Boolean allowFireSpread = false;
|
||||||
public Boolean allowLavaDamage = false;
|
public Boolean allowLavaDamage = false;
|
||||||
public Boolean allowFire = false;
|
public boolean allowLavaPlace = false;
|
||||||
|
public boolean allowWaterPlace = false;
|
||||||
|
public boolean autoEntityWipe = false;
|
||||||
public double explosiveRadius = 4.0;
|
public double explosiveRadius = 4.0;
|
||||||
public Boolean preprocessLogEnabled = false;
|
|
||||||
public boolean nukeMonitor = true;
|
public boolean nukeMonitor = true;
|
||||||
public double nukeMonitorRange = 10.0;
|
|
||||||
public int nukeMonitorCount = 40;
|
public int nukeMonitorCount = 40;
|
||||||
public boolean allPlayersFrozen = false;
|
public double nukeMonitorRange = 10.0;
|
||||||
|
public Boolean preprocessLogEnabled = false;
|
||||||
|
|
||||||
|
public boolean allPlayersFrozen = false;
|
||||||
public HashMap userinfo = new HashMap();
|
public HashMap userinfo = new HashMap();
|
||||||
|
|
||||||
public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
public final static String MSG_NO_PERMS = ChatColor.YELLOW + "You do not have permission to use this command.";
|
||||||
public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
public final static String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||||
public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
public final static String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
|
public final static String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
@ -67,25 +76,34 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
"0.0.0.0"
|
"0.0.0.0"
|
||||||
});
|
});
|
||||||
CONFIG.setProperty("allow_explosions", false);
|
CONFIG.setProperty("allow_explosions", false);
|
||||||
|
CONFIG.setProperty("allow_fire_place", false);
|
||||||
|
CONFIG.setProperty("allow_fire_spread", false);
|
||||||
CONFIG.setProperty("allow_lava_damage", false);
|
CONFIG.setProperty("allow_lava_damage", false);
|
||||||
CONFIG.setProperty("allow_fire", false);
|
CONFIG.setProperty("allow_lava_place", false);
|
||||||
|
CONFIG.setProperty("allow_water_place", false);
|
||||||
|
CONFIG.setProperty("auto_wipe", false);
|
||||||
CONFIG.setProperty("explosiveRadius", 4.0);
|
CONFIG.setProperty("explosiveRadius", 4.0);
|
||||||
CONFIG.setProperty("preprocess_log", false);
|
|
||||||
CONFIG.setProperty("nuke_monitor", true);
|
CONFIG.setProperty("nuke_monitor", true);
|
||||||
CONFIG.setProperty("nuke_monitor_range", 10.0);
|
|
||||||
CONFIG.setProperty("nuke_monitor_count", 40);
|
CONFIG.setProperty("nuke_monitor_count", 40);
|
||||||
|
CONFIG.setProperty("nuke_monitor_range", 10.0);
|
||||||
|
CONFIG.setProperty("preprocess_log", false);
|
||||||
CONFIG.save();
|
CONFIG.save();
|
||||||
}
|
}
|
||||||
CONFIG.load();
|
CONFIG.load();
|
||||||
superadmins = CONFIG.getStringList("superadmins", null);
|
superadmins = CONFIG.getStringList("superadmins", null);
|
||||||
superadmin_ips = CONFIG.getStringList("superadmin_ips", null);
|
superadmin_ips = CONFIG.getStringList("superadmin_ips", null);
|
||||||
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
||||||
|
allowFirePlace = CONFIG.getBoolean("allow_fire_place", false);
|
||||||
|
allowFireSpread = CONFIG.getBoolean("allow_fire_spread", false);
|
||||||
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
||||||
allowFire = CONFIG.getBoolean("allow_fire", false);
|
allowLavaPlace = CONFIG.getBoolean("allow_lava_place", false);
|
||||||
|
allowWaterPlace = CONFIG.getBoolean("allow_water_place", false);
|
||||||
|
autoEntityWipe = CONFIG.getBoolean("auto_wipe", false);
|
||||||
explosiveRadius = CONFIG.getDouble("explosiveRadius", 4.0);
|
explosiveRadius = CONFIG.getDouble("explosiveRadius", 4.0);
|
||||||
preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false);
|
nukeMonitor = CONFIG.getBoolean("nuke_monitor", true);
|
||||||
nukeMonitorRange = CONFIG.getDouble("nuke_monitor_range", 10.0);
|
|
||||||
nukeMonitorCount = CONFIG.getInt("nuke_monitor_count", 40);
|
nukeMonitorCount = CONFIG.getInt("nuke_monitor_count", 40);
|
||||||
|
nukeMonitorRange = CONFIG.getDouble("nuke_monitor_range", 10.0);
|
||||||
|
preprocessLogEnabled = CONFIG.getBoolean("preprocess_log", false);
|
||||||
|
|
||||||
PluginManager pm = this.getServer().getPluginManager();
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
|
|
||||||
@ -105,14 +123,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Event.Priority.Normal, this);
|
pm.registerEvent(Event.Type.PLAYER_CHAT, playerListener, Event.Priority.Normal, this);
|
||||||
|
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
log.log(Level.INFO, "[Total Freedom Mod] - Enabled! - Version: " + this.getDescription().getVersion() + " by Madgeek1450");
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmins: " + implodeStringList(", ", superadmins));
|
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmin names: " + implodeStringList(", ", superadmins));
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod] - Loaded superadmin IPs: " + implodeStringList(", ", superadmins));
|
||||||
|
log.log(Level.INFO, "[Total Freedom Mod] - Auto drop deleter is " + (autoEntityWipe ? "enabled" : "disabled") + ".");
|
||||||
|
|
||||||
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable()
|
Bukkit.getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
tfm.resetCounts();
|
tfm.tfHeartbeat();
|
||||||
}
|
}
|
||||||
}, 100L, 100L);
|
}, 100L, 100L);
|
||||||
}
|
}
|
||||||
@ -608,7 +628,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("fire"))
|
else if (cmd.getName().equalsIgnoreCase("firespread"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender))
|
if (player == null || isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
@ -619,13 +639,40 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
this.allowFire = true;
|
this.allowFireSpread = true;
|
||||||
sender.sendMessage("Fire is now enabled.");
|
sender.sendMessage("Fire spread is now enabled.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.allowFire = false;
|
this.allowFireSpread = false;
|
||||||
sender.sendMessage("Fire is now disabled.");
|
sender.sendMessage("Fire spread is now disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("fireplace"))
|
||||||
|
{
|
||||||
|
if (player == null || isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
|
{
|
||||||
|
this.allowFirePlace = true;
|
||||||
|
sender.sendMessage("Fire placement is now enabled.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.allowFirePlace = false;
|
||||||
|
sender.sendMessage("Fire placement is now disabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -662,6 +709,60 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("lavaplace"))
|
||||||
|
{
|
||||||
|
if (player == null || isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
|
{
|
||||||
|
this.allowLavaPlace = true;
|
||||||
|
sender.sendMessage("Lava placement is now enabled.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.allowLavaPlace = false;
|
||||||
|
sender.sendMessage("Lava placement is now disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (cmd.getName().equalsIgnoreCase("waterplace"))
|
||||||
|
{
|
||||||
|
if (player == null || isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
if (args.length != 1)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
|
{
|
||||||
|
this.allowWaterPlace = true;
|
||||||
|
sender.sendMessage("Water placement is now enabled.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.allowWaterPlace = false;
|
||||||
|
sender.sendMessage("Water placement is now disabled.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("radar"))
|
else if (cmd.getName().equalsIgnoreCase("radar"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
@ -709,19 +810,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("rd"))
|
else if (cmd.getName().equalsIgnoreCase("rd"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null || sender.isOp())
|
||||||
{
|
{
|
||||||
sender.sendMessage("This command can only be used in-game.");
|
sender.sendMessage(ChatColor.GRAY + "Removing all dropped items, arrows, exp. orbs and TNT...");
|
||||||
return true;
|
sender.sendMessage(ChatColor.GRAY + String.valueOf(wipeDropEntities()) + " dropped enties removed.");
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isOp())
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Using WorldEdit to remove all dropped items, arrows, and TNT.");
|
|
||||||
|
|
||||||
Bukkit.getServer().dispatchCommand(sender, "remove items -1");
|
|
||||||
Bukkit.getServer().dispatchCommand(sender, "remove arrows -1");
|
|
||||||
Bukkit.getServer().dispatchCommand(sender, "remove tnt -1");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -732,17 +824,24 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("mp"))
|
else if (cmd.getName().equalsIgnoreCase("mp"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null || sender.isOp())
|
||||||
{
|
{
|
||||||
sender.sendMessage("This command can only be used in-game.");
|
sender.sendMessage(ChatColor.GRAY + "Purging all mobs...");
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender.isOp())
|
int removed = 0;
|
||||||
{
|
for (World world : Bukkit.getWorlds())
|
||||||
sender.sendMessage(ChatColor.GRAY + "Using MobLimiter to purge all mobs.");
|
{
|
||||||
|
for (Entity ent : world.getEntities())
|
||||||
|
{
|
||||||
|
if (ent instanceof Creature || ent instanceof Ghast || ent instanceof Slime)
|
||||||
|
{
|
||||||
|
ent.remove();
|
||||||
|
removed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bukkit.getServer().dispatchCommand(sender, "moblimiter purge");
|
sender.sendMessage(ChatColor.GRAY + String.valueOf(removed) + " mobs removed.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -795,7 +894,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
if (mode.equals("list"))
|
if (mode.equals("list"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GOLD + "[Real Name]:[Display Name] - Hash:");
|
sender.sendMessage(ChatColor.GRAY + "[ Real Name ] : [ Display Name ] - Hash:");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
@ -803,7 +902,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
String hash = p.getUniqueId().toString().substring(0, 4);
|
String hash = p.getUniqueId().toString().substring(0, 4);
|
||||||
if (mode.equals("list"))
|
if (mode.equals("list"))
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.GOLD + String.format("[%s]:[%s] - %s",
|
sender.sendMessage(ChatColor.GRAY + String.format("[ %s ] : [ %s ] - %s",
|
||||||
p.getName(),
|
p.getName(),
|
||||||
ChatColor.stripColor(p.getDisplayName()),
|
ChatColor.stripColor(p.getDisplayName()),
|
||||||
hash));
|
hash));
|
||||||
@ -950,39 +1049,74 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
else if (cmd.getName().equalsIgnoreCase("nonuke"))
|
else if (cmd.getName().equalsIgnoreCase("nonuke"))
|
||||||
{
|
{
|
||||||
if (args.length < 1)
|
if (player == null || isUserSuperadmin(sender))
|
||||||
{
|
{
|
||||||
return false;
|
if (args.length < 1)
|
||||||
}
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (args.length >= 2)
|
if (args.length >= 2)
|
||||||
{
|
{
|
||||||
this.nukeMonitorRange = Double.parseDouble(args[1]);
|
this.nukeMonitorRange = Double.parseDouble(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.length >= 3)
|
|
||||||
{
|
|
||||||
this.nukeMonitorCount = Integer.parseInt(args[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args.length >= 3)
|
||||||
{
|
{
|
||||||
this.nukeMonitor = true;
|
this.nukeMonitorCount = Integer.parseInt(args[2]);
|
||||||
sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled.");
|
}
|
||||||
sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + this.nukeMonitorRange + " blocks.");
|
|
||||||
sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + this.nukeMonitorCount + " blocks destroyed per 5 seconds.");
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
|
{
|
||||||
|
this.nukeMonitor = true;
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Nuke monitor is enabled.");
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Anti-freecam range is set to " + this.nukeMonitorRange + " blocks.");
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "Block throttle rate is set to " + this.nukeMonitorCount + " blocks destroyed per 5 seconds.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.nukeMonitor = false;
|
||||||
|
sender.sendMessage("Nuke monitor is disabled.");
|
||||||
|
}
|
||||||
|
|
||||||
|
CONFIG.load();
|
||||||
|
CONFIG.setProperty("nuke_monitor", this.nukeMonitor);
|
||||||
|
CONFIG.setProperty("nuke_monitor_range", this.nukeMonitorRange);
|
||||||
|
CONFIG.setProperty("nuke_monitor_count", this.nukeMonitorCount);
|
||||||
|
CONFIG.save();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.nukeMonitor = false;
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
sender.sendMessage("Nuke monitor is disabled.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CONFIG.load();
|
return true;
|
||||||
CONFIG.setProperty("nuke_monitor", this.nukeMonitor);
|
}
|
||||||
CONFIG.setProperty("nuke_monitor_range", this.nukeMonitorRange);
|
else if (cmd.getName().equalsIgnoreCase("cake"))
|
||||||
CONFIG.setProperty("nuke_monitor_count", this.nukeMonitorCount);
|
{
|
||||||
CONFIG.save();
|
if (player == null || isUserSuperadmin(sender))
|
||||||
|
{
|
||||||
|
StringBuilder output = new StringBuilder();
|
||||||
|
Random randomGenerator = new Random();
|
||||||
|
|
||||||
|
for (String word : CAKE_LYRICS.split(" "))
|
||||||
|
{
|
||||||
|
String color_code = Integer.toHexString(1 + randomGenerator.nextInt(14));
|
||||||
|
output.append("§").append(color_code).append(word).append(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
ItemStack heldItem = new ItemStack(Material.CAKE, 1);
|
||||||
|
p.getInventory().setItem(p.getInventory().firstEmpty(), heldItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
tfBroadcastMessage(output.toString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1005,6 +1139,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void tfBroadcastMessage(String message)
|
||||||
|
{
|
||||||
|
log.info(ChatColor.stripColor(message));
|
||||||
|
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
p.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String implodeStringList(String glue, List<String> pieces)
|
public String implodeStringList(String glue, List<String> pieces)
|
||||||
{
|
{
|
||||||
StringBuilder output = new StringBuilder();
|
StringBuilder output = new StringBuilder();
|
||||||
@ -1070,7 +1214,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetCounts()
|
private void tfHeartbeat()
|
||||||
{
|
{
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
@ -1081,5 +1225,27 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
playerdata.resetBlockDestroyCount();
|
playerdata.resetBlockDestroyCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.autoEntityWipe)
|
||||||
|
{
|
||||||
|
wipeDropEntities();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int wipeDropEntities()
|
||||||
|
{
|
||||||
|
int removed = 0;
|
||||||
|
for (World world : Bukkit.getWorlds())
|
||||||
|
{
|
||||||
|
for (Entity ent : world.getEntities())
|
||||||
|
{
|
||||||
|
if (ent instanceof Arrow || ent instanceof TNTPrimed || ent instanceof Item || ent instanceof ExperienceOrb)
|
||||||
|
{
|
||||||
|
ent.remove();
|
||||||
|
removed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return removed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockBurn(BlockBurnEvent event)
|
public void onBlockBurn(BlockBurnEvent event)
|
||||||
{
|
{
|
||||||
if (!plugin.allowFire)
|
if (!plugin.allowFireSpread)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -36,7 +36,7 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
@Override
|
@Override
|
||||||
public void onBlockIgnite(BlockIgniteEvent event)
|
public void onBlockIgnite(BlockIgniteEvent event)
|
||||||
{
|
{
|
||||||
if (!plugin.allowFire)
|
if (!plugin.allowFirePlace)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
@ -102,54 +102,94 @@ public class TotalFreedomModBlockListener extends BlockListener
|
|||||||
public void onBlockPlace(BlockPlaceEvent event)
|
public void onBlockPlace(BlockPlaceEvent event)
|
||||||
{
|
{
|
||||||
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
ItemStack is = new ItemStack(event.getBlockPlaced().getType(), 1, (short) 0, event.getBlockPlaced().getData());
|
||||||
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
if (is.getType() == Material.LAVA || is.getType() == Material.STATIONARY_LAVA)
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
if (plugin.allowLavaPlace)
|
||||||
|
|
||||||
int slot = player.getInventory().getHeldItemSlot();
|
|
||||||
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
|
||||||
player.getInventory().setItem(slot, heldItem);
|
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?");
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
|
||||||
{
|
|
||||||
Player player = event.getPlayer();
|
|
||||||
|
|
||||||
int slot = player.getInventory().getHeldItemSlot();
|
|
||||||
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
|
||||||
player.getInventory().setItem(slot, heldItem);
|
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?");
|
|
||||||
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (is.getType() == Material.TNT)
|
|
||||||
{
|
|
||||||
Player p = event.getPlayer();
|
|
||||||
|
|
||||||
if (!plugin.allowExplosions)
|
|
||||||
{
|
{
|
||||||
Player player = event.getPlayer();
|
log.info(String.format("%s placed lava @ %s",
|
||||||
|
p.getName(),
|
||||||
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
int slot = player.getInventory().getHeldItemSlot();
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int slot = p.getInventory().getHeldItemSlot();
|
||||||
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
player.getInventory().setItem(slot, heldItem);
|
p.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
p.sendMessage(ChatColor.GOLD + "LAVA NO FUN, YOU EAT COOKIE INSTEAD, NO?");
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (is.getType() == Material.WATER || is.getType() == Material.STATIONARY_WATER)
|
||||||
|
{
|
||||||
|
if (plugin.allowWaterPlace)
|
||||||
|
{
|
||||||
|
log.info(String.format("%s placed water @ %s",
|
||||||
|
p.getName(),
|
||||||
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
int slot = p.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
p.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
p.sendMessage(ChatColor.GOLD + "Does this look like a waterpark to you?");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (is.getType() == Material.FIRE)
|
||||||
|
{
|
||||||
|
if (plugin.allowFirePlace)
|
||||||
|
{
|
||||||
|
log.info(String.format("%s placed fire @ %s",
|
||||||
|
p.getName(),
|
||||||
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int slot = p.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
p.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
p.sendMessage(ChatColor.GOLD + "It's gettin (too) hot in here...");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (is.getType() == Material.TNT)
|
||||||
|
{
|
||||||
|
if (plugin.allowExplosions)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed TNT @ %s",
|
log.info(String.format("%s placed TNT @ %s",
|
||||||
p.getName(),
|
p.getName(),
|
||||||
plugin.formatLocation(event.getBlock().getLocation())));
|
plugin.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int slot = p.getInventory().getHeldItemSlot();
|
||||||
|
ItemStack heldItem = new ItemStack(Material.COOKIE, 1);
|
||||||
|
p.getInventory().setItem(slot, heldItem);
|
||||||
|
|
||||||
|
p.sendMessage(ChatColor.GRAY + "TNT is currently disabled.");
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class TotalFreedomModEntityListener extends EntityListener
|
|||||||
@Override
|
@Override
|
||||||
public void onEntityCombust(EntityCombustEvent event)
|
public void onEntityCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
if (!plugin.allowFire)
|
if (!plugin.allowFireSpread)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -88,11 +88,11 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
|||||||
{
|
{
|
||||||
Location from = event.getFrom();
|
Location from = event.getFrom();
|
||||||
Location to = event.getTo().clone();
|
Location to = event.getTo().clone();
|
||||||
|
|
||||||
to.setX(from.getX());
|
to.setX(from.getX());
|
||||||
to.setY(from.getY());
|
to.setY(from.getY());
|
||||||
to.setZ(from.getZ());
|
to.setZ(from.getZ());
|
||||||
|
|
||||||
event.setTo(to);
|
event.setTo(to);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,18 +106,18 @@ class TotalFreedomModPlayerListener extends PlayerListener
|
|||||||
public void onPlayerChat(PlayerChatEvent event)
|
public void onPlayerChat(PlayerChatEvent event)
|
||||||
{
|
{
|
||||||
Player p = event.getPlayer();
|
Player p = event.getPlayer();
|
||||||
|
|
||||||
TFUserInfo playerdata = (TFUserInfo) plugin.userinfo.get(p);
|
TFUserInfo playerdata = (TFUserInfo) plugin.userinfo.get(p);
|
||||||
if (playerdata != null)
|
if (playerdata != null)
|
||||||
{
|
{
|
||||||
playerdata.incrementMsgCount();
|
playerdata.incrementMsgCount();
|
||||||
|
|
||||||
if (playerdata.getMsgCount() > 10)
|
if (playerdata.getMsgCount() > 10)
|
||||||
{
|
{
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
p.kickPlayer("No Spamming");
|
p.kickPlayer("No Spamming");
|
||||||
plugin.tfBroadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
plugin.tfBroadcastMessage(p.getName() + " was automatically kicked for spamming chat.", ChatColor.RED);
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,9 @@ version: 1.4
|
|||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
|
cake:
|
||||||
|
description: For the people that are still alive.
|
||||||
|
usage: /<command>
|
||||||
creative:
|
creative:
|
||||||
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
|
description: Quickly change your own gamemode to creative, or define someone's username to change theirs.
|
||||||
usage: /<command> [partialname]
|
usage: /<command> [partialname]
|
||||||
@ -13,8 +16,11 @@ commands:
|
|||||||
explosives:
|
explosives:
|
||||||
description: Superadmin command - Enable/disable explosives and set effect radius.
|
description: Superadmin command - Enable/disable explosives and set effect radius.
|
||||||
usage: /<command> <on|off> [radius]
|
usage: /<command> <on|off> [radius]
|
||||||
fire:
|
fireplace:
|
||||||
description: Superadmin command - Enable/disable fire.
|
description: Superadmin command - Enable/disable fire placement.
|
||||||
|
usage: /<command> <on|off>
|
||||||
|
firespread:
|
||||||
|
description: Superadmin command - Enable/disable fire spread.
|
||||||
usage: /<command> <on|off>
|
usage: /<command> <on|off>
|
||||||
fr:
|
fr:
|
||||||
description: Superadmin command - Freeze all players (toggles on and off).
|
description: Superadmin command - Freeze all players (toggles on and off).
|
||||||
@ -28,6 +34,9 @@ commands:
|
|||||||
lavadmg:
|
lavadmg:
|
||||||
description: Superadmin command - Enable/disable lava damage.
|
description: Superadmin command - Enable/disable lava damage.
|
||||||
usage: /<command> <on|off>
|
usage: /<command> <on|off>
|
||||||
|
lavaplace:
|
||||||
|
description: Superadmin command - Enable/disable lava placement.
|
||||||
|
usage: /<command> <on|off>
|
||||||
list:
|
list:
|
||||||
description: Lists the real names of all online players.
|
description: Lists the real names of all online players.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -73,6 +82,9 @@ commands:
|
|||||||
survival:
|
survival:
|
||||||
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
description: Quickly change your own gamemode to survival, or define someone's username to change theirs.
|
||||||
usage: /<command> [partialname]
|
usage: /<command> [partialname]
|
||||||
|
waterplace:
|
||||||
|
description: Superadmin command - Enable/disable water placement.
|
||||||
|
usage: /<command> <on|off>
|
||||||
wildcard:
|
wildcard:
|
||||||
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
description: Superadmin command - Run any command on all users, username placeholder = ?.
|
||||||
usage: /<command> [fluff] ? [fluff] ?
|
usage: /<command> [fluff] ? [fluff] ?
|
Loading…
Reference in New Issue
Block a user