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;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
@ -106,9 +107,11 @@ public class ChatManager extends FreedomService
|
|||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOldPrefix(Displayable display)
|
public String getColoredTag(Admin admin, Displayable display)
|
||||||
{
|
{
|
||||||
ChatColor color = display.getColor();
|
ChatColor color = display.getColor();
|
||||||
|
if(admin.getOldTags())
|
||||||
|
{
|
||||||
|
|
||||||
if (color.equals(ChatColor.AQUA))
|
if (color.equals(ChatColor.AQUA))
|
||||||
{
|
{
|
||||||
@ -118,10 +121,8 @@ public class ChatManager extends FreedomService
|
|||||||
{
|
{
|
||||||
color = ChatColor.LIGHT_PURPLE;
|
color = ChatColor.LIGHT_PURPLE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
String prefix = "(" + display.getAbbr() + ")";
|
return color + display.getAbbr();
|
||||||
|
|
||||||
return color + prefix;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adminChat(CommandSender sender, String message)
|
public void adminChat(CommandSender sender, String message)
|
||||||
@ -134,9 +135,12 @@ public class ChatManager extends FreedomService
|
|||||||
if (plugin.al.isAdmin(player))
|
if (plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
Admin admin = plugin.al.getAdmin(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
|
else
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod.admin;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
import me.totalfreedom.totalfreedommod.LogViewer.LogsRegistrationMode;
|
||||||
@ -53,7 +54,10 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
private Boolean potionSpy = false;
|
private Boolean potionSpy = false;
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private Boolean oldAdminMode = false;
|
private String acFormat = null;
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private Boolean oldTags = null;
|
||||||
|
|
||||||
public static final String CONFIG_FILENAME = "admins.yml";
|
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("- Rank: ").append(rank.getName()).append("\n")
|
||||||
.append("- Is Active: ").append(active).append("\n")
|
.append("- Is Active: ").append(active).append("\n")
|
||||||
.append("- Discord ID: ").append(discordID).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();
|
return output.toString();
|
||||||
}
|
}
|
||||||
@ -108,7 +113,9 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
tag = cs.getString("tag", null);
|
tag = cs.getString("tag", null);
|
||||||
commandSpy = cs.getBoolean("command_spy", false);
|
commandSpy = cs.getBoolean("command_spy", false);
|
||||||
potionSpy = cs.getBoolean("potion_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
|
@Override
|
||||||
@ -125,7 +132,8 @@ public class Admin implements ConfigLoadable, ConfigSavable, Validatable
|
|||||||
cs.set("tag", tag);
|
cs.set("tag", tag);
|
||||||
cs.set("command_spy", commandSpy);
|
cs.set("command_spy", commandSpy);
|
||||||
cs.set("potion_spy", potionSpy);
|
cs.set("potion_spy", potionSpy);
|
||||||
cs.set("old_admin_mode", oldAdminMode);
|
cs.set("acformat", acFormat);
|
||||||
|
cs.set("oldtags", oldTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAtLeast(Rank pRank)
|
public boolean isAtLeast(Rank pRank)
|
||||||
|
Loading…
Reference in New Issue
Block a user