mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 19:46:42 +00:00
TotalFreedomMod Electrum
Version 5.0 This TotalFreedomMod release implements many changes. Most notably, the internals have been completely revamped. TotalFreedomMod now relies on the Aero library for core mechanics such as command handling and services. Another important change is the UUID system. In TotalFreedomMod Electrum, it has been completely removed. The core reason for this is that the system as a whole was very bugged. Additionally, it did not solve the primary reason for its conception: preserving player data when the player changes their username. This is because TotalFreedomMod servers usually run in offline-mode. This meaning that some of the players joining do not have a registerd Mojang UUID whatsoever. All in all, the UUID system was buggy, and it did not fix the reason it was implemented, so it has been completely removed. The admin list and the ban list now use usernames and IPs again. Lastly, many smaller changes have been implemented. Due to the amount of changes, they have not been named individualy. Please refer to the issues below for more details. Fixes #342 Fixes #350 Fixes #380 Fixes #684 Fixes #704 Fixes #716 Fixes #735 Fixes #745 Fixes #784 Fixes #765 Fixes #791 Fixes #805 Fixes #826 Fixes #883 Fixes #1524 Fixes #1534 Fixes #1536 Fixes #1538 Fixes #1545 Fixes #1546 Fixes #1568 Fixes #1627 Resolves #403 Resolves #435 Resolves #597 Resolves #603 Resolves #628 Resolves #690 Resolves #708 Resolves #747 Resolves #748 Resolves #749 Resolves #764 Resolves #767 Resolves #782 Resolves #809 Resolves #803 Resolves #811 Resolves #813 Resolves #830 Resolves #848 Resolves #856 Resolves #876 Resolves #908 Resolves #992 Resolves #1018 Resolves #1432 Resolves #1446 Resolves #1494 Resolves #1501 Resolves #1526 Resolves #1540 Resolves #1550 Resolves #1560 Resolves #1561 Resolves #1578 Resolves #1613
This commit is contained in:
@ -2,7 +2,7 @@ package me.totalfreedom.totalfreedommod.rank;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public interface RankBase
|
||||
public interface Displayable
|
||||
{
|
||||
|
||||
public String getName();
|
||||
@ -17,8 +17,4 @@ public interface RankBase
|
||||
|
||||
public String getColoredLoginMessage();
|
||||
|
||||
public boolean isAtLeast(RankBase rank);
|
||||
|
||||
public int getLevel();
|
||||
|
||||
}
|
@ -3,18 +3,17 @@ package me.totalfreedom.totalfreedommod.rank;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum Rank implements RankBase
|
||||
public enum Rank implements Displayable
|
||||
{
|
||||
|
||||
IMPOSTOR(Type.PLAYER, "an", "Imp", ChatColor.YELLOW),
|
||||
NON_OP(Type.PLAYER, "a", "", ChatColor.GREEN),
|
||||
OP(Type.PLAYER, "an", "OP", ChatColor.RED),
|
||||
SUPER_ADMIN(Type.ADMIN, "a", "SA", ChatColor.GOLD),
|
||||
TELNET_ADMIN(Type.ADMIN, "a", "STA", ChatColor.DARK_GREEN),
|
||||
SENIOR_ADMIN(Type.ADMIN, "a", "SrA", ChatColor.LIGHT_PURPLE),
|
||||
TELNET_CONSOLE(),
|
||||
SENIOR_CONSOLE();
|
||||
//
|
||||
IMPOSTOR("an", "Impostor", Type.PLAYER, "Imp", ChatColor.YELLOW),
|
||||
NON_OP("a", "Non-Op", Type.PLAYER, "", ChatColor.GREEN),
|
||||
OP("an", "Op", Type.PLAYER, "OP", ChatColor.RED),
|
||||
SUPER_ADMIN("a", "Super Admin", Type.ADMIN, "SA", ChatColor.AQUA),
|
||||
TELNET_ADMIN("a", "Telnet Admin", Type.ADMIN, "STA", ChatColor.DARK_GREEN),
|
||||
SENIOR_ADMIN("a", "Senior Admin", Type.ADMIN, "SrA", ChatColor.GOLD),
|
||||
TELNET_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE),
|
||||
SENIOR_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE);
|
||||
@Getter
|
||||
private final Type type;
|
||||
@Getter
|
||||
@ -23,58 +22,30 @@ public enum Rank implements RankBase
|
||||
@Getter
|
||||
private final String tag;
|
||||
@Getter
|
||||
private final String coloredTag;
|
||||
@Getter
|
||||
private final ChatColor color;
|
||||
|
||||
private Rank()
|
||||
{
|
||||
this("Console", Type.ADMIN_CONSOLE, "the", "Console", ChatColor.DARK_PURPLE);
|
||||
}
|
||||
|
||||
private Rank(Type type, String determiner, String tag, ChatColor color)
|
||||
{
|
||||
this.type = type;
|
||||
|
||||
// Name
|
||||
final String[] nameParts = name().toLowerCase().split("_");
|
||||
String tempName = "";
|
||||
for (String part : nameParts)
|
||||
{
|
||||
tempName += Character.toUpperCase(part.charAt(0)) + part.substring(1) + " ";
|
||||
}
|
||||
name = tempName.trim();
|
||||
|
||||
this.determiner = determiner;
|
||||
this.tag = tag.length() > 0 ? "[" + tag + "]" : "";
|
||||
|
||||
// Colors
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
private Rank(String name, Type type, String determiner, String tag, ChatColor color)
|
||||
private Rank(String determiner, String name, Type type, String abbr, ChatColor color)
|
||||
{
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.determiner = determiner;
|
||||
this.tag = "[" + tag + "]";
|
||||
this.tag = abbr.isEmpty() ? "" : "[" + abbr + "]";
|
||||
this.coloredTag = abbr.isEmpty() ? "" : ChatColor.DARK_GRAY + "[" + color + abbr + ChatColor.DARK_GRAY + "]" + color;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredName()
|
||||
{
|
||||
return getColor() + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredTag()
|
||||
{
|
||||
return getColor() + getTag();
|
||||
return color + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredLoginMessage()
|
||||
{
|
||||
return determiner + " " + getColoredName();
|
||||
return determiner + " " + color + ChatColor.ITALIC + name;
|
||||
}
|
||||
|
||||
public boolean isConsole()
|
||||
@ -82,16 +53,24 @@ public enum Rank implements RankBase
|
||||
return getType() == Type.ADMIN_CONSOLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel()
|
||||
{
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAtLeast(RankBase rank)
|
||||
public boolean isAtLeast(Rank rank)
|
||||
{
|
||||
return getLevel() >= rank.getLevel();
|
||||
if (getLevel() < rank.getLevel())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!hasConsoleVariant() || !rank.hasConsoleVariant())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return getConsoleVariant().getLevel() >= rank.getConsoleVariant().getLevel();
|
||||
}
|
||||
|
||||
public boolean isAdmin()
|
||||
@ -99,7 +78,7 @@ public enum Rank implements RankBase
|
||||
return getType() == Type.ADMIN || getType() == Type.ADMIN_CONSOLE;
|
||||
}
|
||||
|
||||
public boolean hasConsole()
|
||||
public boolean hasConsoleVariant()
|
||||
{
|
||||
return getConsoleVariant() != null;
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
package me.totalfreedom.totalfreedommod.rank;
|
||||
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.pravian.aero.util.ChatUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
@ -34,7 +34,7 @@ public class RankManager extends FreedomService
|
||||
{
|
||||
}
|
||||
|
||||
public RankBase getDisplay(CommandSender sender)
|
||||
public Displayable getDisplay(CommandSender sender)
|
||||
{
|
||||
if (!(sender instanceof Player))
|
||||
{
|
||||
@ -64,7 +64,7 @@ public class RankManager extends FreedomService
|
||||
}
|
||||
|
||||
// If the player's an owner, display that
|
||||
if (MainConfig.get(ConfigEntry.SERVER_OWNERS, List.class).contains(player.getName()))
|
||||
if (ConfigEntry.SERVER_OWNERS.getList().contains(player.getName()))
|
||||
{
|
||||
return Title.OWNER;
|
||||
}
|
||||
@ -94,7 +94,14 @@ public class RankManager extends FreedomService
|
||||
return Rank.SENIOR_CONSOLE;
|
||||
}
|
||||
|
||||
return admin.getRank();
|
||||
Rank rank = admin.getRank();
|
||||
|
||||
// Get console
|
||||
if (rank.hasConsoleVariant())
|
||||
{
|
||||
rank = rank.getConsoleVariant();
|
||||
}
|
||||
return rank;
|
||||
}
|
||||
|
||||
public Rank getRank(Player player)
|
||||
@ -122,13 +129,13 @@ public class RankManager extends FreedomService
|
||||
|
||||
// Unban admins
|
||||
boolean isAdmin = plugin.al.isAdmin(player);
|
||||
fPlayer.setSuperadminIdVerified(false);
|
||||
if (isAdmin)
|
||||
{
|
||||
// Verify strict IP match
|
||||
if (!plugin.al.isIdentityMatched(player))
|
||||
{
|
||||
FUtil.bcastMsg("Warning: " + player.getName() + " is an admin, but is using an account not registered to one of their ip-list.", ChatColor.RED);
|
||||
fPlayer.setSuperadminIdVerified(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -153,7 +160,7 @@ public class RankManager extends FreedomService
|
||||
// Set display
|
||||
if (isAdmin || FUtil.DEVELOPERS.contains(player.getName()))
|
||||
{
|
||||
final RankBase display = getDisplay(player);
|
||||
final Displayable display = getDisplay(player);
|
||||
String loginMsg = display.getColoredLoginMessage();
|
||||
|
||||
if (isAdmin)
|
||||
@ -161,17 +168,17 @@ public class RankManager extends FreedomService
|
||||
Admin admin = plugin.al.getAdmin(player);
|
||||
if (admin.hasLoginMessage())
|
||||
{
|
||||
loginMsg = admin.getLoginMessage();
|
||||
loginMsg = ChatUtils.colorize(admin.getLoginMessage());
|
||||
}
|
||||
}
|
||||
|
||||
FUtil.bcastMsg(ChatColor.AQUA + player.getName() + " is " + loginMsg);
|
||||
plugin.pl.getPlayer(player).setTag(display.getColoredTag());
|
||||
|
||||
String displayName = display.getColor() + player.getName();
|
||||
try
|
||||
{
|
||||
String displayName = display.getColor() + player.getName();
|
||||
player.setPlayerListName(displayName.substring(0, Math.min(displayName.length(), 16)));
|
||||
player.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
|
@ -3,72 +3,41 @@ package me.totalfreedom.totalfreedommod.rank;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
public enum Title implements RankBase
|
||||
public enum Title implements Displayable
|
||||
{
|
||||
|
||||
DEVELOPER("a", "Dev", ChatColor.DARK_PURPLE),
|
||||
OWNER("the", "Owner", ChatColor.BLUE);
|
||||
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, "Dev"),
|
||||
OWNER("the", "Owner", ChatColor.BLUE, "Owner");
|
||||
|
||||
private final String determiner;
|
||||
@Getter
|
||||
private final String name;
|
||||
private final String determiner;
|
||||
@Getter
|
||||
private final String tag;
|
||||
@Getter
|
||||
private final ChatColor color;
|
||||
private final String coloredTag;
|
||||
@Getter
|
||||
private final String colorString;
|
||||
private final ChatColor color;
|
||||
|
||||
private Title(String determiner, String tag, ChatColor... colors)
|
||||
private Title(String determiner, String name, ChatColor color, String tag)
|
||||
{
|
||||
final String[] nameParts = name().toLowerCase().split("_");
|
||||
String tempName = "";
|
||||
for (String part : nameParts)
|
||||
{
|
||||
tempName = Character.toUpperCase(part.charAt(0)) + part.substring(1) + " ";
|
||||
}
|
||||
name = tempName.trim();
|
||||
|
||||
this.determiner = determiner;
|
||||
this.name = name;
|
||||
this.tag = "[" + tag + "]";
|
||||
|
||||
this.color = colors[0];
|
||||
String tColor = "";
|
||||
for (ChatColor lColor : colors)
|
||||
{
|
||||
tColor += lColor.toString();
|
||||
}
|
||||
colorString = tColor;
|
||||
this.coloredTag = ChatColor.DARK_GRAY + "[" + color + tag + ChatColor.DARK_GRAY + "]" + color;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredName()
|
||||
{
|
||||
return getColorString() + getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredTag()
|
||||
{
|
||||
return getColorString() + getTag();
|
||||
return color + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredLoginMessage()
|
||||
{
|
||||
return determiner + " " + getColoredName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel()
|
||||
{
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAtLeast(RankBase rank)
|
||||
{
|
||||
return getLevel() >= rank.getLevel();
|
||||
return determiner + " " + color + ChatColor.ITALIC + name;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user