mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-02 04:56:40 +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:
@ -4,6 +4,7 @@ import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
@ -22,7 +23,7 @@ import org.bukkit.entity.Player;
|
||||
public class Command_tempban extends FreedomCommand
|
||||
{
|
||||
|
||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
@ -44,12 +45,12 @@ public class Command_tempban extends FreedomCommand
|
||||
}
|
||||
|
||||
final String username;
|
||||
final List<String> ips = new ArrayList<>();
|
||||
|
||||
final Player player = getPlayer(args[0]);
|
||||
final PlayerData entry;
|
||||
if (player == null)
|
||||
{
|
||||
final PlayerData entry = plugin.pl.getData(args[0]);
|
||||
entry = plugin.pl.getData(args[0]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
@ -58,15 +59,15 @@ public class Command_tempban extends FreedomCommand
|
||||
}
|
||||
|
||||
username = entry.getName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
else
|
||||
{
|
||||
final PlayerData entry = plugin.pl.getData(player);
|
||||
entry = plugin.pl.getData(player);
|
||||
username = player.getName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
final List<String> ips = new ArrayList<>(entry.getIps());
|
||||
|
||||
assert player != null;
|
||||
final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
|
||||
|
||||
Date expires = FUtil.parseDateOffset("30m");
|
||||
@ -93,7 +94,7 @@ public class Command_tempban extends FreedomCommand
|
||||
for (int z = -1; z <= 1; z++)
|
||||
{
|
||||
final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z);
|
||||
targetPos.getWorld().strikeLightningEffect(strike_pos);
|
||||
Objects.requireNonNull(targetPos.getWorld()).strikeLightningEffect(strike_pos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,14 +108,7 @@ public class Command_tempban extends FreedomCommand
|
||||
|
||||
Ban ban;
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
ban = Ban.forPlayer(player, sender, null, reason);
|
||||
}
|
||||
else
|
||||
{
|
||||
ban = Ban.forPlayerName(username, sender, null, reason);
|
||||
}
|
||||
ban = Ban.forPlayer(player, sender, null, reason);
|
||||
|
||||
for (String ip : ips)
|
||||
{
|
||||
|
Reference in New Issue
Block a user