mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-11 13:33:54 +00:00
Merge branch 'TFM1.12-Alpha' of https://github.com/TFPatches/TotalFreedomMod into TFM1.12-Alpha
This commit is contained in:
@ -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
|
||||
{
|
||||
|
@ -283,18 +283,24 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
||||
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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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 = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag>")
|
||||
@CommandParameters(description = "Manage my admin entry", usage = "/<command> [-o <admin>] <clearips | clearip <ip> | setlogin <message> | clearlogin | settag <tag> | cleartag | setacformat <format> | 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:
|
||||
{
|
||||
|
@ -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 = "/<command>", 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;
|
||||
}
|
||||
}
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
Reference in New Issue
Block a user