diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/RTPCommand.java b/src/main/java/dev/zontreck/essentials/commands/teleport/RTPCommand.java index cb624e1..bbaeee0 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/RTPCommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/RTPCommand.java @@ -59,9 +59,8 @@ public class RTPCommand { //boolean found_place= false; RandomPositionFactory.beginRTP(pla, pla.serverLevel()); - return; - - + + } }); diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java index 9612043..e2bf5d4 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TPACommand.java @@ -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); diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java index 05f39e7..0c95e0b 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TPAHereCommand.java @@ -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); diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportActioner.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportActioner.java index 66185d9..e4a0546 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportActioner.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportActioner.java @@ -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){ diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportContainer.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportContainer.java index 9aed23d..12f08db 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportContainer.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportContainer.java @@ -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 { diff --git a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportRunnable.java b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportRunnable.java index 1764cf1..2580cd9 100644 --- a/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportRunnable.java +++ b/src/main/java/dev/zontreck/essentials/commands/teleport/TeleportRunnable.java @@ -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() { diff --git a/src/main/java/dev/zontreck/essentials/commands/warps/WarpCommand.java b/src/main/java/dev/zontreck/essentials/commands/warps/WarpCommand.java index 46bcc7c..ffc3d39 100644 --- a/src/main/java/dev/zontreck/essentials/commands/warps/WarpCommand.java +++ b/src/main/java/dev/zontreck/essentials/commands/warps/WarpCommand.java @@ -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; diff --git a/src/main/java/dev/zontreck/essentials/events/TeleportEvent.java b/src/main/java/dev/zontreck/essentials/events/TeleportEvent.java index 9b32540..e142a4a 100644 --- a/src/main/java/dev/zontreck/essentials/events/TeleportEvent.java +++ b/src/main/java/dev/zontreck/essentials/events/TeleportEvent.java @@ -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; diff --git a/src/main/java/dev/zontreck/essentials/homes/Homes.java b/src/main/java/dev/zontreck/essentials/homes/Homes.java index 08c3a72..300834a 100644 --- a/src/main/java/dev/zontreck/essentials/homes/Homes.java +++ b/src/main/java/dev/zontreck/essentials/homes/Homes.java @@ -14,7 +14,7 @@ import net.minecraft.nbt.Tag; import net.minecraftforge.common.MinecraftForge; public class Homes { - private Map homes = new HashMap<>(); + private final Map homes = new HashMap<>(); public String playerID; public Homes(String playerID) diff --git a/src/main/java/dev/zontreck/essentials/rtp/RTP.java b/src/main/java/dev/zontreck/essentials/rtp/RTP.java index 71cabe8..186a81b 100644 --- a/src/main/java/dev/zontreck/essentials/rtp/RTP.java +++ b/src/main/java/dev/zontreck/essentials/rtp/RTP.java @@ -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 BLACKLIST = Lists.of(Blocks.LAVA, Blocks.WATER, Blocks.BEDROCK); + private final List 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 diff --git a/src/main/java/dev/zontreck/essentials/rtp/RandomPositionFactory.java b/src/main/java/dev/zontreck/essentials/rtp/RandomPositionFactory.java index 1b32db2..8d9aa3a 100644 --- a/src/main/java/dev/zontreck/essentials/rtp/RandomPositionFactory.java +++ b/src/main/java/dev/zontreck/essentials/rtp/RandomPositionFactory.java @@ -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; diff --git a/src/main/java/dev/zontreck/essentials/util/FileHandler.java b/src/main/java/dev/zontreck/essentials/util/FileHandler.java index c08e351..abc95b2 100644 --- a/src/main/java/dev/zontreck/essentials/util/FileHandler.java +++ b/src/main/java/dev/zontreck/essentials/util/FileHandler.java @@ -19,7 +19,6 @@ public class FileHandler try { Files.write(Paths.get(filePath), newContent.getBytes()); } catch (IOException e) { - return; } } } diff --git a/src/main/java/dev/zontreck/essentials/warps/Warp.java b/src/main/java/dev/zontreck/essentials/warps/Warp.java index 61225e1..57fa866 100644 --- a/src/main/java/dev/zontreck/essentials/warps/Warp.java +++ b/src/main/java/dev/zontreck/essentials/warps/Warp.java @@ -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 { + } } /** diff --git a/src/main/java/dev/zontreck/essentials/warps/Warps.java b/src/main/java/dev/zontreck/essentials/warps/Warps.java index 5f33239..ba985ab 100644 --- a/src/main/java/dev/zontreck/essentials/warps/Warps.java +++ b/src/main/java/dev/zontreck/essentials/warps/Warps.java @@ -17,7 +17,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; public class Warps { - private Map warps = new HashMap<>(); + private final Map warps = new HashMap<>(); private Warps(){