mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
add customization of admin format
This commit is contained in:
parent
56b712729a
commit
4cf338bfb5
@ -1,5 +1,6 @@
|
||||
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;
|
||||
@ -106,22 +107,22 @@ public class ChatManager extends FreedomService
|
||||
event.setFormat(format);
|
||||
}
|
||||
|
||||
public String getOldPrefix(Displayable display)
|
||||
public String getColoredTag(Admin admin, Displayable display)
|
||||
{
|
||||
ChatColor color = display.getColor();
|
||||
|
||||
if (color.equals(ChatColor.AQUA))
|
||||
if(admin.getOldTags())
|
||||
{
|
||||
color = ChatColor.GOLD;
|
||||
}
|
||||
else if (color.equals(ChatColor.GOLD))
|
||||
{
|
||||
color = ChatColor.LIGHT_PURPLE;
|
||||
}
|
||||
|
||||
String prefix = "(" + display.getAbbr() + ")";
|
||||
|
||||
return color + prefix;
|
||||
if (color.equals(ChatColor.AQUA))
|
||||
{
|
||||
color = ChatColor.GOLD;
|
||||
}
|
||||
else if (color.equals(ChatColor.GOLD))
|
||||
{
|
||||
color = ChatColor.LIGHT_PURPLE;
|
||||
}
|
||||
}
|
||||
return color + display.getAbbr();
|
||||
}
|
||||
|
||||
public void adminChat(CommandSender sender, String message)
|
||||
@ -134,9 +135,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 coloredTag = getColoredTag(admin, display);
|
||||
String format = admin.getAcFormat();
|
||||
String msg = format.replace("%name%", sender.getName()).replace("%tag%", coloredTag).replace("%message%", message);
|
||||
player.sendMessage(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user