mirror of
https://github.com/TheDeus-Group/TFM-4.3-Reloaded.git
synced 2024-12-23 03:54:56 +00:00
Cleaned up and standardized output messages.
Code tidy.
This commit is contained in:
parent
11c10cd83d
commit
4007a8c37a
3 changed files with 135 additions and 101 deletions
|
@ -1,9 +1,9 @@
|
|||
annotation.processing.enabled=true
|
||||
annotation.processing.enabled.in.editor=false
|
||||
annotation.processing.processor.options=
|
||||
annotation.processing.processors.list=
|
||||
annotation.processing.run.all.processors=true
|
||||
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.excludes=**/*.java,**/*.form
|
||||
# This directory is removed when the project is cleaned:
|
||||
|
@ -24,14 +24,13 @@ debug.test.classpath=\
|
|||
dist.dir=dist
|
||||
dist.jar=${dist.dir}/TotalFreedomMod.jar
|
||||
dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar=C:\\repositories\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
||||
file.reference.Essentials.jar=C:\\repositories\\Essentials\\BuildAll\\dist\\lib\\Essentials.jar
|
||||
file.reference.bukkit-0.0.1-SNAPSHOT.jar-2=C:\\github\\Bukkit\\target\\bukkit-0.0.1-SNAPSHOT.jar
|
||||
includes=**
|
||||
jar.compress=false
|
||||
javac.classpath=\
|
||||
${file.reference.bukkit-0.0.1-SNAPSHOT.jar}:\
|
||||
${file.reference.Essentials.jar}
|
||||
${file.reference.bukkit-0.0.1-SNAPSHOT.jar-2}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
|
|
@ -21,16 +21,15 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
private final TotalFreedomModEntityListener entityListener = new TotalFreedomModEntityListener(this);
|
||||
private final TotalFreedomModBlockListener blockListener = new TotalFreedomModBlockListener(this);
|
||||
//private final TotalFreedomModPlayerListener playerListener = new TotalFreedomModPlayerListener(this);
|
||||
|
||||
private static final Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
protected static Configuration CONFIG;
|
||||
private List<String> superadmins = new ArrayList<String>();
|
||||
public Boolean allowExplosions = false;
|
||||
public Boolean allowLavaDamage = 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 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()
|
||||
{
|
||||
|
@ -39,7 +38,10 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
if (CONFIG.getString("superadmins", null) == null) //Generate config file:
|
||||
{
|
||||
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_lava_damage", false);
|
||||
CONFIG.setProperty("allow_fire", false);
|
||||
|
@ -72,7 +74,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
Player player = null;
|
||||
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))));
|
||||
}
|
||||
else
|
||||
|
@ -80,7 +82,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
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)
|
||||
{
|
||||
|
@ -90,8 +92,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
{
|
||||
if (isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
tfBroadcastMessage(String.format("(%s: Opping %s)", sender.getName(), sender.getName()), ChatColor.GRAY);
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||
sender.sendMessage(YOU_ARE_OP);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -101,7 +104,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
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 onlineUsers = new StringBuilder();
|
||||
|
@ -114,8 +117,14 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (first) first = false;
|
||||
else onlineUsers.append(", ");
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
|
||||
if (sender.getName().equalsIgnoreCase("remotebukkit"))
|
||||
{
|
||||
|
@ -123,8 +132,14 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
if (p.isOp()) onlineUsers.append("[OP]").append(p.getName());
|
||||
else onlineUsers.append(p.getName());
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append("[OP]").append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,11 +153,23 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
boolean first = true;
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (first) first = false;
|
||||
else onlineUsers.append(", ");
|
||||
if (first)
|
||||
{
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(", ");
|
||||
}
|
||||
|
||||
if (p.isOp()) onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||
else onlineUsers.append(p.getName());
|
||||
if (p.isOp())
|
||||
{
|
||||
onlineUsers.append(ChatColor.RED).append(p.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
onlineUsers.append(p.getName());
|
||||
}
|
||||
|
||||
onlineUsers.append(ChatColor.WHITE);
|
||||
}
|
||||
|
@ -153,19 +180,20 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("deopall"))
|
||||
else if (cmd.getName().equalsIgnoreCase("deopall"))
|
||||
{
|
||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||
{
|
||||
tfBroadcastMessage(String.format("(%s: De-opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!isUserSuperadmin(p.getName()) && !p.getName().equals(sender.getName()))
|
||||
{
|
||||
p.setOp(false);
|
||||
p.sendMessage(YOU_ARE_NOT_OP);
|
||||
}
|
||||
}
|
||||
|
||||
tfBroadcastMessage(ChatColor.YELLOW + sender.getName() + " de-op'd everyone on the server.");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -174,10 +202,12 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("opall"))
|
||||
else if (cmd.getName().equalsIgnoreCase("opall"))
|
||||
{
|
||||
if (isUserSuperadmin(sender.getName()) || player == null)
|
||||
{
|
||||
tfBroadcastMessage(String.format("(%s: Opping everyone)", sender.getName()), ChatColor.GRAY);
|
||||
|
||||
boolean doSetGamemode = false;
|
||||
GameMode targetGamemode = GameMode.CREATIVE;
|
||||
if (args.length != 0)
|
||||
|
@ -197,10 +227,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.setOp(true);
|
||||
if (doSetGamemode) p.setGameMode(targetGamemode);
|
||||
}
|
||||
p.sendMessage(YOU_ARE_OP);
|
||||
|
||||
tfBroadcastMessage(ChatColor.YELLOW + sender.getName() + " op'd everyone on the server.");
|
||||
if (doSetGamemode)
|
||||
{
|
||||
p.setGameMode(targetGamemode);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -209,7 +242,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
||||
else if (cmd.getName().equalsIgnoreCase("qop")) //Quick OP
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -223,10 +256,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
{
|
||||
matched_player = true;
|
||||
|
||||
tfBroadcastMessage(String.format("(%s: Opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
p.setOp(true);
|
||||
|
||||
tfBroadcastMessage("Oping " + p.getName());
|
||||
p.sendMessage(ChatColor.YELLOW + "You are now op!");
|
||||
p.sendMessage(YOU_ARE_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
|
@ -240,7 +272,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
||||
else if (cmd.getName().equalsIgnoreCase("qdeop")) //Quick De-op
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -254,10 +286,9 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
{
|
||||
matched_player = true;
|
||||
|
||||
tfBroadcastMessage(String.format("(%s: De-opping %s)", sender.getName(), p.getName()), ChatColor.GRAY);
|
||||
p.setOp(false);
|
||||
|
||||
tfBroadcastMessage("De-opping " + p.getName());
|
||||
p.sendMessage(ChatColor.YELLOW + "You have been de-op'd.");
|
||||
p.sendMessage(YOU_ARE_NOT_OP);
|
||||
}
|
||||
if (!matched_player)
|
||||
{
|
||||
|
@ -271,7 +302,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("survival"))
|
||||
else if (cmd.getName().equalsIgnoreCase("survival"))
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
|
@ -315,7 +346,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("creative"))
|
||||
else if (cmd.getName().equalsIgnoreCase("creative"))
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
|
@ -359,7 +390,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("wildcard"))
|
||||
else if (cmd.getName().equalsIgnoreCase("wildcard"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
|
@ -385,7 +416,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("say"))
|
||||
else if (cmd.getName().equalsIgnoreCase("say"))
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
|
@ -395,7 +426,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
if (player == null || sender.isOp())
|
||||
{
|
||||
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
|
||||
{
|
||||
|
@ -404,7 +435,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("gtfo"))
|
||||
else if (cmd.getName().equalsIgnoreCase("gtfo"))
|
||||
{
|
||||
if (args.length != 1)
|
||||
{
|
||||
|
@ -431,7 +462,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
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.getOfflinePlayer(p.getName()).setBanned(true);
|
||||
|
||||
|
@ -444,10 +475,12 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("stop"))
|
||||
else if (cmd.getName().equalsIgnoreCase("stop"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
tfBroadcastMessage("Server is going offline.", ChatColor.GRAY);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.kickPlayer("Server is going offline, come back in a few minutes.");
|
||||
|
@ -462,7 +495,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("explosives"))
|
||||
else if (cmd.getName().equalsIgnoreCase("explosives"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
|
@ -474,12 +507,12 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
if (args[0].equalsIgnoreCase("on"))
|
||||
{
|
||||
this.allowExplosions = true;
|
||||
sender.sendMessage("Explosives are now enabled. Don't blow your fingers off!");
|
||||
sender.sendMessage("Explosives are now enabled.");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.allowExplosions = false;
|
||||
sender.sendMessage("Explosives are now disabled. Funtime is over...");
|
||||
sender.sendMessage("Explosives are now disabled.");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -489,7 +522,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("fire"))
|
||||
else if (cmd.getName().equalsIgnoreCase("fire"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
|
@ -516,7 +549,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
|
||||
return true;
|
||||
}
|
||||
else if(cmd.getName().equalsIgnoreCase("lavadmg"))
|
||||
else if (cmd.getName().equalsIgnoreCase("lavadmg"))
|
||||
{
|
||||
if (player == null || isUserSuperadmin(sender.getName()))
|
||||
{
|
||||
|
@ -547,11 +580,13 @@ public class TotalFreedomMod extends JavaPlugin
|
|||
return false;
|
||||
}
|
||||
|
||||
public static void tfBroadcastMessage(String message)
|
||||
public static void tfBroadcastMessage(String message, ChatColor color)
|
||||
{
|
||||
log.info(message);
|
||||
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
p.sendMessage(message);
|
||||
p.sendMessage(color + message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: TotalFreedomMod
|
||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||
version: 1.1.2
|
||||
version: 1.2.0
|
||||
description: Plugin for the Total Freedom server
|
||||
author: StevenLawson / Madgeek1450
|
||||
commands:
|
||||
|
|
Loading…
Reference in a new issue