Apply code cleanup

This commit is contained in:
zontreck 2024-01-15 20:34:31 -07:00
parent ca869f6d2b
commit f0dec14b80
14 changed files with 20 additions and 34 deletions

View file

@ -59,7 +59,6 @@ public class RTPCommand {
//boolean found_place= false;
RandomPositionFactory.beginRTP(pla, pla.serverLevel());
return;
}

View file

@ -82,7 +82,7 @@ public class TPACommand {
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
ClickEvent ce2 = Clickable.command("/tpdeny "+cont.TeleportID.toString());
ClickEvent ce2 = Clickable.command("/tpdeny "+ cont.TeleportID);
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);

View file

@ -80,7 +80,7 @@ public class TPAHereCommand {
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
ClickEvent ce2 = Clickable.command("/tpdeny "+cont.TeleportID.toString());
ClickEvent ce2 = Clickable.command("/tpdeny "+ cont.TeleportID);
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);

View file

@ -26,10 +26,7 @@ public class TeleportActioner
public static boolean isBlacklistedDimension(ServerLevel level)
{
WorldPosition pos = new WorldPosition(Vector3.ZERO, level);
if(AEServerConfig.getInstance().teleport.Blacklist.contains(pos.Dimension))
{
return true;
} else return false;
return AEServerConfig.getInstance().teleport.Blacklist.contains(pos.Dimension);
}
public static void ApplyTeleportEffect(ServerPlayer player){

View file

@ -28,10 +28,7 @@ public class TeleportContainer implements Comparable{
public boolean has_expired(){
if(Instant.now().getEpochSecond() > (StartedAt + (60)))
{
return true;
}else return false;
return Instant.now().getEpochSecond() > (StartedAt + (60));
}
public TeleportContainer (UUID From, UUID To)
@ -58,8 +55,7 @@ public class TeleportContainer implements Comparable{
@Override
public int compareTo(Object o) {
if(o instanceof TeleportContainer){
TeleportContainer cont = (TeleportContainer)o;
if(o instanceof TeleportContainer cont){
if(cont.FromPlayer != FromPlayer){
return -1;
}else {

View file

@ -36,7 +36,7 @@ public class TeleportRunnable extends Task
Action.PlayerInst.onUpdateAbilities();
DelayedExecutorService.getInstance().schedule(new Task("tp_action",true){
public TeleportContainer container=Action;
public final TeleportContainer container=Action;
@Override
public void run()
{

View file

@ -45,7 +45,7 @@ public class WarpCommand {
TeleportDestination dest = warp.destination;
ServerLevel dimL=(ServerLevel) dest.getActualDimension();
ServerLevel dimL= dest.getActualDimension();
final int type = warp.RTP ? 1 : 0;

View file

@ -7,7 +7,7 @@ import net.minecraftforge.eventbus.api.Event;
@Cancelable
public class TeleportEvent extends Event
{
private TeleportContainer container;
private final TeleportContainer container;
public TeleportEvent(TeleportContainer container)
{
this.container=container;

View file

@ -14,7 +14,7 @@ import net.minecraft.nbt.Tag;
import net.minecraftforge.common.MinecraftForge;
public class Homes {
private Map<String, Home> homes = new HashMap<>();
private final Map<String, Home> homes = new HashMap<>();
public String playerID;
public Homes(String playerID)

View file

@ -46,11 +46,11 @@ public class RTP
SearchDirection=1;
}
}
private int SearchDirection;
private final int SearchDirection;
private Thread containingThread;
private Heightmap.Types heightMapType;
private final Heightmap.Types heightMapType;
public WorldPosition position;
private List<Block> BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER, Blocks.BEDROCK);
private final List<Block> BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER, Blocks.BEDROCK);
protected int tries;
protected int lastThreadDelay = 15;
@ -64,10 +64,7 @@ public class RTP
public boolean isDimension(ServerLevel level)
{
String dim = WorldPosition.getDim(level);
if(dim.equals(position.Dimension))
{
return true;
}else return false;
return dim.equals(position.Dimension);
}
/**
@ -201,10 +198,7 @@ public class RTP
if (b.isAir() && b2.isAir()) {
if (!b3.isAir()) {
if (BLACKLIST.contains(b3.getBlock())) {
return false;
} else
return true;
return !BLACKLIST.contains(b3.getBlock());
} else
return false;
} else

View file

@ -22,7 +22,7 @@ public class RandomPositionFactory {
RTP tmp = new RTP(level);
tmp.position = new WorldPosition(new Vector3(0,0,0), WorldPosition.getDim(level));
Thread tx = new Thread(new RandomPositionLocator(tmp));
tx.setName("RTPTask-"+String.valueOf(DelayedExecutorService.getNext()));
tx.setName("RTPTask-"+ DelayedExecutorService.getNext());
tx.start();
return tmp;

View file

@ -19,7 +19,6 @@ public class FileHandler
try {
Files.write(Paths.get(filePath), newContent.getBytes());
} catch (IOException e) {
return;
}
}
}

View file

@ -123,7 +123,8 @@ public class Warp {
{
ACLEntry entry = ACL.addEntry(name, ID);
MinecraftForge.EVENT_BUS.post(new WarpAccessControlListUpdatedEvent(this, entry, true));
}else return;
}else {
}
}
/**

View file

@ -17,7 +17,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
public class Warps
{
private Map<String,Warp> warps = new HashMap<>();
private final Map<String,Warp> warps = new HashMap<>();
private Warps(){