mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-29 19:46:42 +00:00
Removal of Lombok
Lombok implementation removal. I have also gone through and replaced things with inline methods and variables, lambdas, and simplified loops down, removed unnecessary guard clauses, and overall cleaned up every single class. This took a long time, please do remember to follow proper naming conventions, don't include unnecessary guard clauses, follow exception rules and comment rules, and please PLEASE remember to use the DIAMOND OPERATOR rather than just inferring RAW TYPES!!! Thank you!!
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.rank;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public enum Rank implements Displayable
|
||||
@ -12,25 +11,25 @@ public enum Rank implements Displayable
|
||||
SENIOR_ADMIN("a", "Senior Admin", Type.ADMIN, "SrA", ChatColor.GOLD, org.bukkit.ChatColor.GOLD, true, true),
|
||||
ADMIN_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false),
|
||||
SENIOR_CONSOLE("the", "Console", Type.ADMIN_CONSOLE, "Console", ChatColor.DARK_PURPLE, null, false, false);
|
||||
@Getter
|
||||
|
||||
private final Type type;
|
||||
@Getter
|
||||
|
||||
private final String name;
|
||||
@Getter
|
||||
|
||||
private final String abbr;
|
||||
@Getter
|
||||
|
||||
private final String article;
|
||||
@Getter
|
||||
|
||||
private final String tag;
|
||||
@Getter
|
||||
|
||||
private final String coloredTag;
|
||||
@Getter
|
||||
|
||||
private final ChatColor color;
|
||||
@Getter
|
||||
|
||||
private final org.bukkit.ChatColor teamColor;
|
||||
@Getter
|
||||
|
||||
private final boolean hasTeam;
|
||||
@Getter
|
||||
|
||||
private final boolean hasDefaultLoginMessage;
|
||||
|
||||
Rank(String article, String name, Type type, String abbr, ChatColor color, org.bukkit.ChatColor teamColor, Boolean hasTeam, Boolean hasDefaultLoginMessage)
|
||||
@ -47,6 +46,19 @@ public enum Rank implements Displayable
|
||||
this.hasDefaultLoginMessage = hasDefaultLoginMessage;
|
||||
}
|
||||
|
||||
public static Rank findRank(String string)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Rank.valueOf(string.toUpperCase());
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
|
||||
return Rank.NON_OP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredName()
|
||||
{
|
||||
@ -99,6 +111,8 @@ public enum Rank implements Displayable
|
||||
return true;
|
||||
}
|
||||
|
||||
assert getConsoleVariant() != null;
|
||||
assert rank.getConsoleVariant() != null;
|
||||
return getConsoleVariant().getLevel() >= rank.getConsoleVariant().getLevel();
|
||||
}
|
||||
|
||||
@ -127,17 +141,55 @@ public enum Rank implements Displayable
|
||||
}
|
||||
}
|
||||
|
||||
public static Rank findRank(String string)
|
||||
public Type getType()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Rank.valueOf(string.toUpperCase());
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
return Rank.NON_OP;
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArticle()
|
||||
{
|
||||
return article;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredTag()
|
||||
{
|
||||
return coloredTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.ChatColor getTeamColor()
|
||||
{
|
||||
return teamColor;
|
||||
}
|
||||
|
||||
public boolean isHasTeam()
|
||||
{
|
||||
return hasTeam;
|
||||
}
|
||||
|
||||
public boolean isHasDefaultLoginMessage()
|
||||
{
|
||||
return hasDefaultLoginMessage;
|
||||
}
|
||||
|
||||
public enum Type
|
||||
|
@ -1,10 +1,11 @@
|
||||
package me.totalfreedom.totalfreedommod.rank;
|
||||
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -276,21 +277,21 @@ public class RankManager extends FreedomService
|
||||
}
|
||||
if (message != null)
|
||||
{
|
||||
String loginMessage = FUtil.colorize(ChatColor.AQUA + (message.contains("%name%") ? "" : player.getName() + " is ")
|
||||
return FUtil.colorize(ChatColor.AQUA + (message.contains("%name%") ? "" : player.getName() + " is ")
|
||||
+ FUtil.colorize(message).replace("%name%", player.getName())
|
||||
.replace("%rank%", display.getName())
|
||||
.replace("%coloredrank%", display.getColoredName())
|
||||
.replace("%art%", display.getArticle()));
|
||||
return loginMessage;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void updatePlayerTeam(Player player)
|
||||
{
|
||||
Displayable display = getDisplay(player);
|
||||
Scoreboard scoreboard = server.getScoreboardManager().getMainScoreboard();
|
||||
Scoreboard scoreboard = Objects.requireNonNull(server.getScoreboardManager()).getMainScoreboard();
|
||||
Team team = scoreboard.getPlayerTeam(player);
|
||||
if (!display.hasTeam())
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.rank;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public enum Title implements Displayable
|
||||
@ -12,21 +11,21 @@ public enum Title implements Displayable
|
||||
DEVELOPER("a", "Developer", ChatColor.DARK_PURPLE, org.bukkit.ChatColor.DARK_PURPLE, "Dev", true, true),
|
||||
OWNER("the", "Owner", ChatColor.of("#ff0000"), org.bukkit.ChatColor.DARK_RED, "Owner", true, true);
|
||||
|
||||
@Getter
|
||||
|
||||
private final String article;
|
||||
@Getter
|
||||
|
||||
private final String name;
|
||||
@Getter
|
||||
|
||||
private final String abbr;
|
||||
@Getter
|
||||
|
||||
private final String tag;
|
||||
@Getter
|
||||
|
||||
private final String coloredTag;
|
||||
@Getter
|
||||
|
||||
private final ChatColor color;
|
||||
@Getter
|
||||
|
||||
private final org.bukkit.ChatColor teamColor;
|
||||
@Getter
|
||||
|
||||
private final boolean hasTeam;
|
||||
private final boolean hasDefaultLoginMessage;
|
||||
|
||||
@ -66,4 +65,46 @@ public enum Title implements Displayable
|
||||
{
|
||||
return article + " " + color + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArticle()
|
||||
{
|
||||
return article;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAbbr()
|
||||
{
|
||||
return abbr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColoredTag()
|
||||
{
|
||||
return coloredTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatColor getColor()
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.bukkit.ChatColor getTeamColor()
|
||||
{
|
||||
return teamColor;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user