mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-26 17:05:01 +00:00
Cleaned up and standardized output messages.
Code tidy.
This commit is contained in:
parent
11c10cd83d
commit
4007a8c37a
@ -1,9 +1,9 @@
|
|||||||
annotation.processing.enabled=true
|
annotation.processing.enabled=true
|
||||||
annotation.processing.enabled.in.editor=false
|
annotation.processing.enabled.in.editor=false
|
||||||
annotation.processing.processor.options=
|
|
||||||
annotation.processing.processors.list=
|
|
||||||
annotation.processing.run.all.processors=true
|
annotation.processing.run.all.processors=true
|
||||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
|
||||||
|
application.title=TotalFreedomMod
|
||||||
|
application.vendor=Michael
|
||||||
build.classes.dir=${build.dir}/classes
|
build.classes.dir=${build.dir}/classes
|
||||||
build.classes.excludes=**/*.java,**/*.form
|
build.classes.excludes=**/*.java,**/*.form
|
||||||
# This directory is removed when the project is cleaned:
|
# This directory is removed when the project is cleaned:
|
||||||
@ -24,14 +24,13 @@ debug.test.classpath=\
|
|||||||
dist.dir=dist
|
dist.dir=dist
|
||||||
dist.jar=${dist.dir}/TotalFreedomMod.jar
|
dist.jar=${dist.dir}/TotalFreedomMod.jar
|
||||||
dist.javadoc.dir=${dist.dir}/javadoc
|
dist.javadoc.dir=${dist.dir}/javadoc
|
||||||
|
endorsed.classpath=
|
||||||
excludes=
|
excludes=
|
||||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\repositories\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
file.reference.bukkit-0.0.1-SNAPSHOT.jar-2=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
||||||
file.reference.Essentials.jar=C:\\repositories\\Essentials\\BuildAll\\dist\\lib\\Essentials.jar
|
|
||||||
includes=**
|
includes=**
|
||||||
jar.compress=false
|
jar.compress=false
|
||||||
javac.classpath=\
|
javac.classpath=\
|
||||||
${file.reference.bukkit-0.0.1-SNAPSHOT.jar}:\
|
${file.reference.bukkit-0.0.1-SNAPSHOT.jar-2}
|
||||||
${file.reference.Essentials.jar}
|
|
||||||
# Space-separated list of extra javac options
|
# Space-separated list of extra javac options
|
||||||
javac.compilerargs=
|
javac.compilerargs=
|
||||||
javac.deprecation=false
|
javac.deprecation=false
|
||||||
|
@ -21,16 +21,15 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
private final TotalFreedomModEntityListener entityListener = new TotalFreedomModEntityListener(this);
|
private final TotalFreedomModEntityListener entityListener = new TotalFreedomModEntityListener(this);
|
||||||
private final TotalFreedomModBlockListener blockListener = new TotalFreedomModBlockListener(this);
|
private final TotalFreedomModBlockListener blockListener = new TotalFreedomModBlockListener(this);
|
||||||
//private final TotalFreedomModPlayerListener playerListener = new TotalFreedomModPlayerListener(this);
|
//private final TotalFreedomModPlayerListener playerListener = new TotalFreedomModPlayerListener(this);
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
protected static Configuration CONFIG;
|
protected static Configuration CONFIG;
|
||||||
private List<String> superadmins = new ArrayList<String>();
|
private List<String> superadmins = new ArrayList<String>();
|
||||||
public Boolean allowExplosions = false;
|
public Boolean allowExplosions = false;
|
||||||
public Boolean allowLavaDamage = false;
|
public Boolean allowLavaDamage = false;
|
||||||
public Boolean allowFire = false;
|
public Boolean allowFire = false;
|
||||||
|
|
||||||
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_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
|
|
||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
@ -39,7 +38,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
if (CONFIG.getString("superadmins", null) == null) //Generate config file:
|
if (CONFIG.getString("superadmins", null) == null) //Generate config file:
|
||||||
{
|
{
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Generating default config file (plugins/TotalFreedomMod/config.yml)...");
|
log.log(Level.INFO, "[Total Freedom Mod] - Generating default config file (plugins/TotalFreedomMod/config.yml)...");
|
||||||
CONFIG.setProperty("superadmins", new String[] {"Madgeek1450", "markbyron"});
|
CONFIG.setProperty("superadmins", new String[]
|
||||||
|
{
|
||||||
|
"Madgeek1450", "markbyron"
|
||||||
|
});
|
||||||
CONFIG.setProperty("allow_explosions", false);
|
CONFIG.setProperty("allow_explosions", false);
|
||||||
CONFIG.setProperty("allow_lava_damage", false);
|
CONFIG.setProperty("allow_lava_damage", false);
|
||||||
CONFIG.setProperty("allow_fire", false);
|
CONFIG.setProperty("allow_fire", false);
|
||||||
@ -50,14 +52,14 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
allowExplosions = CONFIG.getBoolean("allow_explosions", false);
|
||||||
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
allowLavaDamage = CONFIG.getBoolean("allow_lava_damage", false);
|
||||||
allowFire = CONFIG.getBoolean("allow_fire", false);
|
allowFire = CONFIG.getBoolean("allow_fire", false);
|
||||||
|
|
||||||
PluginManager pm = this.getServer().getPluginManager();
|
PluginManager pm = this.getServer().getPluginManager();
|
||||||
pm.registerEvent(Event.Type.ENTITY_EXPLODE, entityListener, Event.Priority.High, this);
|
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_COMBUST, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
pm.registerEvent(Event.Type.ENTITY_DAMAGE, entityListener, Event.Priority.High, this);
|
||||||
pm.registerEvent(Event.Type.BLOCK_IGNITE, blockListener, 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_BURN, blockListener, Event.Priority.High, 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 superadmins: " + implodeStringList(", ", superadmins));
|
||||||
}
|
}
|
||||||
@ -66,21 +68,21 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
log.log(Level.INFO, "[Total Freedom Mod] - Disabled.");
|
log.log(Level.INFO, "[Total Freedom Mod] - Disabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||||
{
|
{
|
||||||
Player player = null;
|
Player player = null;
|
||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
player = (Player)sender;
|
player = (Player) sender;
|
||||||
log.log(Level.INFO, String.format("[PLAYER_COMMAND] %s(%s): /%s %s", player.getName(), player.getDisplayName().replaceAll("\\xA7.", ""), commandLabel, implodeStringList(" ", Arrays.asList(args))));
|
log.log(Level.INFO, String.format("[PLAYER_COMMAND] %s(%s): /%s %s", player.getName(), player.getDisplayName().replaceAll("\\xA7.", ""), commandLabel, implodeStringList(" ", Arrays.asList(args))));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.log(Level.INFO, String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, implodeStringList(" ", Arrays.asList(args))));
|
log.log(Level.INFO, String.format("[CONSOLE_COMMAND] %s: /%s %s", sender.getName(), commandLabel, implodeStringList(" ", Arrays.asList(args))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cmd.getName().equalsIgnoreCase("opme"))
|
if (cmd.getName().equalsIgnoreCase("opme"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@ -90,41 +92,54 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
if (isUserSuperadmin(sender.getName()))
|
if (isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
|
tfBroadcastMessage(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY);
|
||||||
sender.setOp(true);
|
sender.setOp(true);
|
||||||
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
sender.sendMessage(YOU_ARE_OP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("listreal") || cmd.getName().equalsIgnoreCase("list"))
|
else if (cmd.getName().equalsIgnoreCase("listreal") || cmd.getName().equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
StringBuilder onlineStats = new StringBuilder();
|
StringBuilder onlineStats = new StringBuilder();
|
||||||
StringBuilder onlineUsers = new StringBuilder();
|
StringBuilder onlineUsers = new StringBuilder();
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
onlineStats.append(String.format("There are %d out of a maximum %d players online.", Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers()));
|
onlineStats.append(String.format("There are %d out of a maximum %d players online.", Bukkit.getOnlinePlayers().length, Bukkit.getMaxPlayers()));
|
||||||
|
|
||||||
onlineUsers.append("Connected players: ");
|
onlineUsers.append("Connected players: ");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (first) first = false;
|
if (first)
|
||||||
else onlineUsers.append(", ");
|
{
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onlineUsers.append(", ");
|
||||||
|
}
|
||||||
|
|
||||||
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||||
{
|
{
|
||||||
onlineUsers.append(p.getName());
|
onlineUsers.append(p.getName());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (p.isOp()) onlineUsers.append("[OP]").append(p.getName());
|
if (p.isOp())
|
||||||
else onlineUsers.append(p.getName());
|
{
|
||||||
|
onlineUsers.append("[OP]").append(p.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onlineUsers.append(p.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,51 +148,66 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(Bukkit.getOnlinePlayers().length);
|
||||||
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
onlineStats.append(ChatColor.BLUE).append(" out of a maximum ").append(ChatColor.RED).append(Bukkit.getMaxPlayers());
|
||||||
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
onlineStats.append(ChatColor.BLUE).append(" players online.");
|
||||||
|
|
||||||
onlineUsers.append("Connected players: ");
|
onlineUsers.append("Connected players: ");
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (first) first = false;
|
if (first)
|
||||||
else onlineUsers.append(", ");
|
{
|
||||||
|
first = false;
|
||||||
if (p.isOp()) onlineUsers.append(ChatColor.RED).append(p.getName());
|
}
|
||||||
else onlineUsers.append(p.getName());
|
else
|
||||||
|
{
|
||||||
|
onlineUsers.append(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p.isOp())
|
||||||
|
{
|
||||||
|
onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onlineUsers.append(p.getName());
|
||||||
|
}
|
||||||
|
|
||||||
onlineUsers.append(ChatColor.WHITE);
|
onlineUsers.append(ChatColor.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage(onlineStats.toString());
|
sender.sendMessage(onlineStats.toString());
|
||||||
sender.sendMessage(onlineUsers.toString());
|
sender.sendMessage(onlineUsers.toString());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("deopall"))
|
else if (cmd.getName().equalsIgnoreCase("deopall"))
|
||||||
{
|
{
|
||||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||||
{
|
{
|
||||||
|
tfBroadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (!isUserSuperadmin(p.getName()) && !p.getName().equals(sender.getName()))
|
if (!isUserSuperadmin(p.getName()) && !p.getName().equals(sender.getName()))
|
||||||
{
|
{
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
p.sendMessage(YOU_ARE_NOT_OP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tfBroadcastMessage(ChatColor.YELLOW + sender.getName() + " de-op'd everyone on the server.");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("opall"))
|
else if (cmd.getName().equalsIgnoreCase("opall"))
|
||||||
{
|
{
|
||||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||||
{
|
{
|
||||||
|
tfBroadcastMessage(String.format("(%s: Opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||||
|
|
||||||
boolean doSetGamemode = false;
|
boolean doSetGamemode = false;
|
||||||
GameMode targetGamemode = GameMode.CREATIVE;
|
GameMode targetGamemode = GameMode.CREATIVE;
|
||||||
if (args.length != 0)
|
if (args.length != 0)
|
||||||
@ -193,29 +223,32 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
targetGamemode = GameMode.SURVIVAL;
|
targetGamemode = GameMode.SURVIVAL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
p.setOp(true);
|
p.setOp(true);
|
||||||
if (doSetGamemode) p.setGameMode(targetGamemode);
|
p.sendMessage(YOU_ARE_OP);
|
||||||
|
|
||||||
|
if (doSetGamemode)
|
||||||
|
{
|
||||||
|
p.setGameMode(targetGamemode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tfBroadcastMessage(ChatColor.YELLOW + sender.getName() + " op'd everyone on the server.");
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
else if (cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
boolean matched_player = false;
|
boolean matched_player = false;
|
||||||
@ -223,10 +256,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
matched_player = true;
|
matched_player = true;
|
||||||
|
|
||||||
|
tfBroadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
p.setOp(true);
|
p.setOp(true);
|
||||||
|
p.sendMessage(YOU_ARE_OP);
|
||||||
tfBroadcastMessage("Oping " + p.getName());
|
|
||||||
p.sendMessage(ChatColor.YELLOW + "You are now op!");
|
|
||||||
}
|
}
|
||||||
if (!matched_player)
|
if (!matched_player)
|
||||||
{
|
{
|
||||||
@ -237,16 +269,16 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
else if (cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
if (sender.isOp() || player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
boolean matched_player = false;
|
boolean matched_player = false;
|
||||||
@ -254,10 +286,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
matched_player = true;
|
matched_player = true;
|
||||||
|
|
||||||
|
tfBroadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
p.sendMessage(YOU_ARE_NOT_OP);
|
||||||
tfBroadcastMessage("De-opping " + p.getName());
|
|
||||||
p.sendMessage(ChatColor.YELLOW + "You have been de-op'd.");
|
|
||||||
}
|
}
|
||||||
if (!matched_player)
|
if (!matched_player)
|
||||||
{
|
{
|
||||||
@ -268,10 +299,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("survival"))
|
else if (cmd.getName().equalsIgnoreCase("survival"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@ -289,7 +320,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
@ -308,14 +339,14 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
p = matches.get(0);
|
p = matches.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Setting " + p.getName() + " to game mode 'Survival'.");
|
sender.sendMessage("Setting " + p.getName() + " to game mode 'Survival'.");
|
||||||
p.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
|
p.sendMessage(sender.getName() + " set your game mode to 'Survival'.");
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("creative"))
|
else if (cmd.getName().equalsIgnoreCase("creative"))
|
||||||
{
|
{
|
||||||
if (player == null)
|
if (player == null)
|
||||||
{
|
{
|
||||||
@ -333,7 +364,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Player p;
|
Player p;
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
@ -352,14 +383,14 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
p = matches.get(0);
|
p = matches.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Setting " + p.getName() + " to game mode 'Creative'.");
|
sender.sendMessage("Setting " + p.getName() + " to game mode 'Creative'.");
|
||||||
p.sendMessage(sender.getName() + " set your game mode to 'Creative'.");
|
p.sendMessage(sender.getName() + " set your game mode to 'Creative'.");
|
||||||
p.setGameMode(GameMode.CREATIVE);
|
p.setGameMode(GameMode.CREATIVE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("wildcard"))
|
else if (cmd.getName().equalsIgnoreCase("wildcard"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
@ -368,7 +399,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
sender.sendMessage("What the hell are you trying to do, you stupid idiot...");
|
sender.sendMessage("What the hell are you trying to do, you stupid idiot...");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String base_command = implodeStringList(" ", Arrays.asList(args));
|
String base_command = implodeStringList(" ", Arrays.asList(args));
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
@ -382,35 +413,35 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("say"))
|
else if (cmd.getName().equalsIgnoreCase("say"))
|
||||||
{
|
{
|
||||||
if (args.length == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player == null || sender.isOp())
|
if (player == null || sender.isOp())
|
||||||
{
|
{
|
||||||
String message = implodeStringList(" ", Arrays.asList(args));
|
String message = implodeStringList(" ", Arrays.asList(args));
|
||||||
tfBroadcastMessage(ChatColor.LIGHT_PURPLE + "[Server:" + sender.getName() + "] " + message);
|
tfBroadcastMessage(String.format("[Server:%s] %s", sender.getName(), message), ChatColor.LIGHT_PURPLE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("gtfo"))
|
else if (cmd.getName().equalsIgnoreCase("gtfo"))
|
||||||
{
|
{
|
||||||
if (args.length != 1)
|
if (args.length != 1)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
Player p;
|
Player p;
|
||||||
@ -424,45 +455,47 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
p = matches.get(0);
|
p = matches.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.getServer().dispatchCommand(sender, "smite " + p.getName());
|
Bukkit.getServer().dispatchCommand(sender, "smite " + p.getName());
|
||||||
|
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
|
|
||||||
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
String user_ip = p.getAddress().getAddress().toString().replaceAll("/", "").trim();
|
||||||
|
|
||||||
tfBroadcastMessage(String.format("%sBanning: %s, IP: %s.", ChatColor.RED, p.getName(), user_ip));
|
tfBroadcastMessage(String.format("Banning: %s, IP: %s.", p.getName(), user_ip), ChatColor.RED);
|
||||||
Bukkit.banIP(user_ip);
|
Bukkit.banIP(user_ip);
|
||||||
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
Bukkit.getOfflinePlayer(p.getName()).setBanned(true);
|
||||||
|
|
||||||
p.kickPlayer("GTFO");
|
p.kickPlayer("GTFO");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("stop"))
|
else if (cmd.getName().equalsIgnoreCase("stop"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
|
tfBroadcastMessage("Server is going offline.", ChatColor.GRAY);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Bukkit.shutdown();
|
Bukkit.shutdown();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("explosives"))
|
else if (cmd.getName().equalsIgnoreCase("explosives"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
@ -470,26 +503,26 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
this.allowExplosions = true;
|
this.allowExplosions = true;
|
||||||
sender.sendMessage("Explosives are now enabled. Don't blow your fingers off!");
|
sender.sendMessage("Explosives are now enabled.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.allowExplosions = false;
|
this.allowExplosions = false;
|
||||||
sender.sendMessage("Explosives are now disabled. Funtime is over...");
|
sender.sendMessage("Explosives are now disabled.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("fire"))
|
else if (cmd.getName().equalsIgnoreCase("fire"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
@ -497,7 +530,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
this.allowFire = true;
|
this.allowFire = true;
|
||||||
@ -513,10 +546,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(cmd.getName().equalsIgnoreCase("lavadmg"))
|
else if (cmd.getName().equalsIgnoreCase("lavadmg"))
|
||||||
{
|
{
|
||||||
if (player == null || isUserSuperadmin(sender.getName()))
|
if (player == null || isUserSuperadmin(sender.getName()))
|
||||||
{
|
{
|
||||||
@ -524,7 +557,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[0].equalsIgnoreCase("on"))
|
if (args[0].equalsIgnoreCase("on"))
|
||||||
{
|
{
|
||||||
this.allowLavaDamage = true;
|
this.allowLavaDamage = true;
|
||||||
@ -540,18 +573,20 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
{
|
{
|
||||||
sender.sendMessage(MSG_NO_PERMS);
|
sender.sendMessage(MSG_NO_PERMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tfBroadcastMessage(String message)
|
public static void tfBroadcastMessage(String message, ChatColor color)
|
||||||
{
|
{
|
||||||
|
log.info(message);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
p.sendMessage(message);
|
p.sendMessage(color + message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +603,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUserSuperadmin(String userName)
|
private boolean isUserSuperadmin(String userName)
|
||||||
{
|
{
|
||||||
return superadmins.contains(userName);
|
return superadmins.contains(userName);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: TotalFreedomMod
|
name: TotalFreedomMod
|
||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 1.1.2
|
version: 1.2.0
|
||||||
description: Plugin for the Total Freedom server
|
description: Plugin for the Total Freedom server
|
||||||
author: StevenLawson / Madgeek1450
|
author: StevenLawson / Madgeek1450
|
||||||
commands:
|
commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user