diff --git a/.gitignore b/.gitignore
index 24d67e9b..55aa6361 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
# TFM excludes
/lib
build.properties
+git.properties
# Netbeans excludes
/nbproject/private
diff --git a/pom.xml b/pom.xml
index bd9b4a82..cc90811e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,14 +4,14 @@
me.totalfreedom
totalfreedom
- 5.0
+ 5.2
jar
UTF-8
${project.version}
- Electrum
-
+ God
+ ${maven.buildnumber}
${maven.build.timestamp}
${buildAuthor}
${buildHead}
@@ -60,7 +60,7 @@
sk89q-snapshots
- http://maven.sk89q.com/artifactory/repo
+ http://maven.sk89q.com/artifactory/repo/
@@ -159,9 +159,9 @@
net.dv8tion
JDA
- 3.5.1_339-withDependencies
+ JDA-3.6.0_354-withDependencies
system
- ${project.basedir}/lib/JDA-3.5.1_339-withDependencies.jar
+ ${project.basedir}/lib/JDA-3.6.0_354-withDependencies.jar
@@ -184,14 +184,15 @@
3.3
TotalFreedomMod.jar
- 1.7
-
- 1.7
+ 1.8
+
+ 1.8
+ org.apache.maven.plugins
maven-antrun-plugin
1.8
@@ -199,8 +200,11 @@
initialize
-
+
+
+
+
@@ -209,8 +213,10 @@
+
+
org.codehaus.mojo
@@ -224,7 +230,7 @@
- ${basedir}/build.properties
+ ${basedir}/src/main/resources/build.properties
@@ -254,26 +260,47 @@
- com.lukegb.mojo
- gitdescribe-maven-plugin
- 3.0
+ pl.project13.maven
+ git-commit-id-plugin
+ 2.2.4
- git-describe
- initialize
+ get-the-git-infos
- gitdescribe
+ revision
-
- buildHead
-
- --tags
- --always
- HEAD
-
-
+
+
+ validate-the-git-infos
+
+ validateRevision
+
+ package
+
+ ${project.basedir}/.git
+ git
+ yyyy-MM-dd HH:mm:ss
+ false
+ true
+ ${basedir}/src/main/resources/git.properties
+ properties
+ false
+ false
+
+ git.build.time
+ git.commit.id
+ git.commit.id.abbrev
+
+
+ false
+ false
+ 7
+ -dirty
+ *
+
+
@@ -292,42 +319,13 @@
maven.buildnumber
- ${basedir}/build.properties
+ ${basedir}/src/main/resources/build.properties
{0,number,#}
- buildNumber
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
- 2.3.1
-
- target/generated-sources
-
-
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 1.4
-
-
- package
-
- shade
-
-
- target/${project.name}.jar
- false
-
-
-
-
@@ -353,4 +351,4 @@
-
\ No newline at end of file
+
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
index 69134f96..e7f7d240 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/ChatManager.java
@@ -1,13 +1,13 @@
package me.totalfreedom.totalfreedommod;
+import com.google.common.base.Strings;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.FPlayer;
import me.totalfreedom.totalfreedommod.rank.Displayable;
import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FSync;
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
-import org.bukkit.Sound;
-import org.bukkit.SoundCategory;
+import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@@ -106,22 +106,40 @@ public class ChatManager extends FreedomService
event.setFormat(format);
}
- public String getOldPrefix(Displayable display)
+ public ChatColor getColor(Admin admin, Displayable display)
{
ChatColor color = display.getColor();
-
- if (color.equals(ChatColor.AQUA))
+ if (admin.getOldTags())
{
- color = ChatColor.GOLD;
+
+ if (color.equals(ChatColor.AQUA))
+ {
+ color = ChatColor.GOLD;
+ }
+ else if (color.equals(ChatColor.GOLD))
+ {
+ color = ChatColor.LIGHT_PURPLE;
+ }
}
- else if (color.equals(ChatColor.GOLD))
+ return color;
+ }
+
+ public String getColoredTag(Admin admin, Displayable display)
+ {
+ ChatColor color = display.getColor();
+ if (admin.getOldTags())
{
- color = ChatColor.LIGHT_PURPLE;
+
+ if (color.equals(ChatColor.AQUA))
+ {
+ color = ChatColor.GOLD;
+ }
+ else if (color.equals(ChatColor.GOLD))
+ {
+ color = ChatColor.LIGHT_PURPLE;
+ }
}
-
- String prefix = "(" + display.getAbbr() + ")";
-
- return color + prefix;
+ return color + display.getAbbr();
}
public void adminChat(CommandSender sender, String message)
@@ -134,9 +152,12 @@ public class ChatManager extends FreedomService
if (plugin.al.isAdmin(player))
{
Admin admin = plugin.al.getAdmin(player);
- if (admin.getOldAdminMode())
+ if (!Strings.isNullOrEmpty(admin.getAcFormat()))
{
- player.sendMessage("[" + ChatColor.AQUA + "ADMIN" + ChatColor.WHITE + "] " + ChatColor.DARK_RED + sender.getName() + " " + getOldPrefix(display) + ChatColor.WHITE + ": " + ChatColor.AQUA + message);
+ String format = admin.getAcFormat();
+ ChatColor color = getColor(admin, display);
+ String msg = format.replace("%name%", sender.getName()).replace("%rank%", display.getAbbr()).replace("%rankcolor%", color.toString()).replace("%msg%", message);
+ player.sendMessage(FUtil.colorize(msg));
}
else
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
index cf0b6375..d6781dfb 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/TotalFreedomMod.java
@@ -283,18 +283,24 @@ public class TotalFreedomMod extends AeroPlugin
try
{
final Properties props;
+ final Properties gitprops;
try (InputStream in = plugin.getResource("build.properties"))
{
props = new Properties();
props.load(in);
}
+ try (InputStream in = plugin.getResource("git.properties"))
+ {
+ gitprops = new Properties();
+ gitprops.load(in);
+ }
- author = props.getProperty("program.build.author", "unknown");
- codename = props.getProperty("program.build.codename", "unknown");
- version = props.getProperty("program.build.version", "unknown");
- number = props.getProperty("program.build.number", "1");
- date = props.getProperty("program.build.date", "unknown");
- head = props.getProperty("program.build.head", "unknown");
+ author = props.getProperty("buildAuthor", "unknown");
+ codename = props.getProperty("buildCodeName", "unknown");
+ version = props.getProperty("buildVersion", pluginVersion);
+ number = props.getProperty("buildNumber", "1");
+ date = gitprops.getProperty("git.build.time", "unknown");
+ head = gitprops.getProperty("git.commit.id.abbrev", "unknown");
}
catch (Exception ex)
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
index 1aaefda2..caaa2b30 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/admin/Admin.java
@@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.admin;
import com.google.common.collect.Lists;
import java.util.Date;
import java.util.List;
+
import lombok.Getter;
import lombok.Setter;
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
@@ -53,7 +54,10 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
private Boolean potionSpy = false;
@Getter
@Setter
- private Boolean oldAdminMode = false;
+ private String acFormat = null;
+ @Getter
+ @Setter
+ private Boolean oldTags = null;
public static final String CONFIG_FILENAME = "admins.yml";
@@ -81,7 +85,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
.append("- Rank: ").append(rank.getName()).append("\n")
.append("- Is Active: ").append(active).append("\n")
.append("- Discord ID: ").append(discordID).append("\n")
- .append("- Tag: ").append(tag);
+ .append("- Tag: ").append(tag).append("\n")
+ .append("- Admin Chat Format:").append(acFormat);
return output.toString();
}
@@ -108,7 +113,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
tag = cs.getString("tag", null);
commandSpy = cs.getBoolean("command_spy", false);
potionSpy = cs.getBoolean("potion_spy", false);
- oldAdminMode = cs.getBoolean("old_admin_mode", false);
+ acFormat = cs.getString("acformat", null);
+ oldTags = cs.getBoolean("oldtags", false);
+
}
@Override
@@ -125,7 +132,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
cs.set("tag", tag);
cs.set("command_spy", commandSpy);
cs.set("potion_spy", potionSpy);
- cs.set("old_admin_mode", oldAdminMode);
+ cs.set("acformat", acFormat);
+ cs.set("oldtags", oldTags);
}
public boolean isAtLeast(Rank pRank)
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
index eb1923e2..fd060efc 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_list.java
@@ -107,7 +107,7 @@ public class Command_list extends FreedomCommand
}
final Displayable display = plugin.rm.getDisplay(p);
- if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldAdminMode())
+ if (!senderIsConsole && plugin.al.isAdmin(playerSender) && plugin.al.getAdmin(playerSender).getOldTags())
{
n.add(getOldPrefix(display) + p.getName());
}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java
index a80b8a2e..bbedc2d2 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_myadmin.java
@@ -13,7 +13,7 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
-@CommandParameters(description = "Manage my admin entry", usage = "/ [-o ] | setlogin | clearlogin | settag | cleartag>")
+@CommandParameters(description = "Manage my admin entry", usage = "/ [-o ] | setlogin | clearlogin | settag | cleartag | setacformat | clearacformat> | oldtags>")
public class Command_myadmin extends FreedomCommand
{
@@ -174,12 +174,38 @@ public class Command_myadmin extends FreedomCommand
case "cleartag":
{
FUtil.adminAction(sender.getName(), "Clearing personal default tag" + (init == null ? "" : " for " + targetPlayer.getName()), false);
- String tag = StringUtils.join(args, " ", 1, args.length);
target.setTag(null);
plugin.al.save();
plugin.al.updateTables();
return true;
}
+ case "setacformat":
+ {
+ String format = StringUtils.join(args, " ", 1, args.length);
+ target.setAcFormat(format);
+ plugin.al.save();
+ plugin.al.updateTables();
+ msg("Set admin chat format to \"" + format + "\".", ChatColor.GRAY);
+ String example = format.replace("%name%", "ExampleAdmin").replace("%rank%", Rank.TELNET_ADMIN.getAbbr()).replace("%rankcolor%", Rank.TELNET_ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
+ msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example));
+ return true;
+ }
+ case "clearacformat":
+ {
+ target.setAcFormat(null);
+ plugin.al.save();
+ plugin.al.updateTables();
+ msg("Cleared admin chat format.", ChatColor.GRAY);
+ return true;
+ }
+ case "oldtags":
+ {
+ target.setOldTags(!target.getOldTags());
+ plugin.al.save();
+ plugin.al.updateTables();
+ msg((target.getOldTags() ? "Enabled" : "Disabled") + " old tags.");
+ return true;
+ }
default:
{
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java
deleted file mode 100644
index 933f9f6b..00000000
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_oldadminmode.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package me.totalfreedom.totalfreedommod.command;
-
-import me.totalfreedom.totalfreedommod.admin.Admin;
-import me.totalfreedom.totalfreedommod.rank.Rank;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-
-@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
-@CommandParameters(description = "Toggle old admin formatting", usage = "/", aliases = "oam")
-public class Command_oldadminmode extends FreedomCommand
-{
-
- @Override
- public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
- {
-
- Admin admin = plugin.al.getAdmin(playerSender);
- admin.setOldAdminMode(!admin.getOldAdminMode());
- plugin.al.save();
- plugin.al.updateTables();
- msg("Old admin mode has been " + (admin.getOldAdminMode() ? "enabled." : "disabled."));
-
- return true;
- }
-}
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java
index d3c721af..384d46ce 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/command/Command_totalfreedommod.java
@@ -52,7 +52,7 @@ public class Command_totalfreedommod extends FreedomCommand
msg("Running on " + ConfigEntry.SERVER_NAME.getString() + ".", ChatColor.GOLD);
msg("Created by Madgeek1450 and Prozza.", ChatColor.GOLD);
msg(String.format("Version "
- + ChatColor.BLUE + "%s %s.%s " + ChatColor.GOLD + "("
+ + ChatColor.BLUE + "%s - %s Build %s " + ChatColor.GOLD + "("
+ ChatColor.BLUE + "%s" + ChatColor.GOLD + ")",
build.codename,
build.version,
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java
index e420343c..98ac0327 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/httpd/module/Module_players.java
@@ -25,6 +25,7 @@ public class Module_players extends HTTPDModule
final JSONObject responseObject = new JSONObject();
final JSONArray players = new JSONArray();
+ final JSONArray onlineadmins = new JSONArray();
final JSONArray masterbuilders = new JSONArray();
final JSONArray superadmins = new JSONArray();
final JSONArray telnetadmins = new JSONArray();
@@ -35,6 +36,10 @@ public class Module_players extends HTTPDModule
for (Player player : Bukkit.getOnlinePlayers())
{
players.add(player.getName());
+ if (plugin.al.isAdmin(player) && !plugin.al.isAdminImpostor(player))
+ {
+ onlineadmins.add(player.getName());
+ }
}
// Admins
diff --git a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java
index e418bb66..13a00141 100644
--- a/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java
+++ b/src/main/java/me/totalfreedom/totalfreedommod/rank/Title.java
@@ -6,7 +6,7 @@ import org.bukkit.ChatColor;
public enum Title implements Displayable
{
- MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "Master-Builder"),
+ MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, "MB"),
EXECUTIVE("an", "Executive", ChatColor.RED, "Exec"),
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"),
OWNER("the", "Owner", ChatColor.BLUE, "Owner");