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:
Paldiu
2020-12-25 14:46:43 -05:00
parent 210b0f8b43
commit 5c0f77c7c5
170 changed files with 3302 additions and 2383 deletions

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.bridge;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import me.totalfreedom.bukkittelnet.BukkitTelnet;
@ -10,8 +9,8 @@ import me.totalfreedom.bukkittelnet.api.TelnetPreLoginEvent;
import me.totalfreedom.bukkittelnet.api.TelnetRequestDataTagsEvent;
import me.totalfreedom.bukkittelnet.session.ClientSession;
import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;

View File

@ -36,16 +36,47 @@ import org.bukkit.scheduler.BukkitTask;
public class CoreProtectBridge extends FreedomService
{
private CoreProtectAPI coreProtectAPI = null;
public static Map<Player, FUtil.PaginationList<String>> HISTORY_MAP = new HashMap<>();
private final List<String> tables = Arrays.asList("co_sign", "co_session", "co_container", "co_block");
private final HashMap<String, Long> cooldown = new HashMap<>();
public static Map<Player, FUtil.PaginationList<String>> HISTORY_MAP = new HashMap<>();
private CoreProtectAPI coreProtectAPI = null;
private BukkitTask wiper;
public static Long getSecondsLeft(long prevTime, int timeAdd)
{
return prevTime / 1000L + timeAdd - System.currentTimeMillis() / 1000L;
}
// Unix timestamp converter taken from Functions class in CoreProtect, not my code
public static String getTimeAgo(int logTime, int currentTime)
{
StringBuilder message = new StringBuilder();
double timeSince = (double)currentTime - ((double)logTime + 0.0D);
timeSince /= 60.0D;
if (timeSince < 60.0D)
{
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/m ago");
}
if (message.length() == 0)
{
timeSince /= 60.0D;
if (timeSince < 24.0D)
{
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/h ago");
}
}
if (message.length() == 0)
{
timeSince /= 24.0D;
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/d ago");
}
return message.toString();
}
@Override
public void onStart()
{
@ -62,8 +93,8 @@ public class CoreProtectBridge extends FreedomService
try
{
final Plugin coreProtectPlugin = Bukkit.getServer().getPluginManager().getPlugin("CoreProtect");
if (coreProtectPlugin != null && coreProtectPlugin instanceof CoreProtect)
assert coreProtectPlugin != null;
if (coreProtectPlugin instanceof CoreProtect)
{
coreProtect = (CoreProtect)coreProtectPlugin;
}
@ -187,7 +218,7 @@ public class CoreProtectBridge extends FreedomService
/* As CoreProtect doesn't have an API method for deleting all of the data for a specific world
we have to do this manually via SQL */
Connection connection = null;
Connection connection;
try
{
String host = ConfigEntry.COREPROTECT_MYSQL_HOST.getString();
@ -237,40 +268,6 @@ public class CoreProtectBridge extends FreedomService
}
}
public static Long getSecondsLeft(long prevTime, int timeAdd)
{
return prevTime / 1000L + timeAdd - System.currentTimeMillis() / 1000L;
}
// Unix timestamp converter taken from Functions class in CoreProtect, not my code
public static String getTimeAgo(int logTime, int currentTime)
{
StringBuilder message = new StringBuilder();
double timeSince = (double)currentTime - ((double)logTime + 0.0D);
timeSince /= 60.0D;
if (timeSince < 60.0D)
{
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/m ago");
}
if (message.length() == 0)
{
timeSince /= 60.0D;
if (timeSince < 24.0D)
{
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/h ago");
}
}
if (message.length() == 0)
{
timeSince /= 24.0D;
message.append((new DecimalFormat("0.00")).format(timeSince)).append("/d ago");
}
return message.toString();
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerInteract(PlayerInteractEvent event)
{

View File

@ -42,7 +42,8 @@ public class EssentialsBridge extends FreedomService
try
{
final Plugin essentials = server.getPluginManager().getPlugin("Essentials");
if (essentials != null && essentials instanceof Essentials)
assert essentials != null;
if (essentials instanceof Essentials)
{
essentialsPlugin = (Essentials)essentials;
}
@ -113,7 +114,15 @@ public class EssentialsBridge extends FreedomService
User user = getEssentialsUser(username);
if (user != null)
{
return FUtil.getField(user, "lastActivity");
Long l = FUtil.getField(user, "lastActivity");
if (l != null)
{
return l;
}
else
{
return 0L;
}
}
}
catch (Exception ex)
@ -150,7 +159,7 @@ public class EssentialsBridge extends FreedomService
if (inventoryType == InventoryType.PLAYER && fPlayer.isInvSee())
{
final InventoryHolder inventoryHolder = inventory.getHolder();
if (inventoryHolder != null && inventoryHolder instanceof HumanEntity)
if (inventoryHolder instanceof HumanEntity)
{
Player invOwner = (Player)inventoryHolder;
Rank recieverRank = plugin.rm.getRank(player);
@ -203,6 +212,7 @@ public class EssentialsBridge extends FreedomService
}
}
// TODO: Actually use this for something or remove it.
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerQuit(PlayerQuitEvent event)
{

View File

@ -75,6 +75,11 @@ public class LibsDisguisesBridge extends FreedomService
}
}
public boolean isDisguisesEnabled()
{
return !BlockedDisguises.disabled;
}
public void setDisguisesEnabled(boolean state)
{
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
@ -87,11 +92,6 @@ public class LibsDisguisesBridge extends FreedomService
BlockedDisguises.disabled = !state;
}
public boolean isDisguisesEnabled()
{
return !BlockedDisguises.disabled;
}
public boolean isEnabled()
{
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();

View File

@ -60,8 +60,7 @@ public class WorldEditBridge extends FreedomService
{
for (int i = 0; i < count; i++)
{
com.sk89q.worldedit.entity.Player fuckyou = bukkitPlayer;
session.undo(session.getBlockBag(fuckyou), fuckyou);
session.undo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
}
}
}
@ -84,8 +83,7 @@ public class WorldEditBridge extends FreedomService
{
for (int i = 0; i < count; i++)
{
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
session.redo(session.getBlockBag(fuckyou), fuckyou);
session.redo(session.getBlockBag(bukkitPlayer), bukkitPlayer);
}
}
}