Apply code cleanup
This commit is contained in:
parent
ca869f6d2b
commit
f0dec14b80
14 changed files with 20 additions and 34 deletions
|
@ -59,7 +59,6 @@ public class RTPCommand {
|
||||||
|
|
||||||
//boolean found_place= false;
|
//boolean found_place= false;
|
||||||
RandomPositionFactory.beginRTP(pla, pla.serverLevel());
|
RandomPositionFactory.beginRTP(pla, pla.serverLevel());
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class TPACommand {
|
||||||
|
|
||||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||||
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
|
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");
|
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
|
||||||
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class TPAHereCommand {
|
||||||
|
|
||||||
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
ce = Clickable.command("/tpaccept "+cont.TeleportID.toString());
|
||||||
he = HoverTip.get(ChatColor.DARK_GREEN + "Accept tp request");
|
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");
|
HoverEvent he2 = HoverTip.get(ChatColor.DARK_RED+"Deny this request");
|
||||||
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
s = Style.EMPTY.withFont(Style.DEFAULT_FONT).withClickEvent(ce).withHoverEvent(he);
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,7 @@ public class TeleportActioner
|
||||||
public static boolean isBlacklistedDimension(ServerLevel level)
|
public static boolean isBlacklistedDimension(ServerLevel level)
|
||||||
{
|
{
|
||||||
WorldPosition pos = new WorldPosition(Vector3.ZERO, level);
|
WorldPosition pos = new WorldPosition(Vector3.ZERO, level);
|
||||||
if(AEServerConfig.getInstance().teleport.Blacklist.contains(pos.Dimension))
|
return AEServerConfig.getInstance().teleport.Blacklist.contains(pos.Dimension);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
} else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ApplyTeleportEffect(ServerPlayer player){
|
public static void ApplyTeleportEffect(ServerPlayer player){
|
||||||
|
|
|
@ -28,10 +28,7 @@ public class TeleportContainer implements Comparable{
|
||||||
|
|
||||||
|
|
||||||
public boolean has_expired(){
|
public boolean has_expired(){
|
||||||
if(Instant.now().getEpochSecond() > (StartedAt + (60)))
|
return Instant.now().getEpochSecond() > (StartedAt + (60));
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TeleportContainer (UUID From, UUID To)
|
public TeleportContainer (UUID From, UUID To)
|
||||||
|
@ -58,8 +55,7 @@ public class TeleportContainer implements Comparable{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Object o) {
|
public int compareTo(Object o) {
|
||||||
if(o instanceof TeleportContainer){
|
if(o instanceof TeleportContainer cont){
|
||||||
TeleportContainer cont = (TeleportContainer)o;
|
|
||||||
if(cont.FromPlayer != FromPlayer){
|
if(cont.FromPlayer != FromPlayer){
|
||||||
return -1;
|
return -1;
|
||||||
}else {
|
}else {
|
||||||
|
|
|
@ -36,7 +36,7 @@ public class TeleportRunnable extends Task
|
||||||
Action.PlayerInst.onUpdateAbilities();
|
Action.PlayerInst.onUpdateAbilities();
|
||||||
|
|
||||||
DelayedExecutorService.getInstance().schedule(new Task("tp_action",true){
|
DelayedExecutorService.getInstance().schedule(new Task("tp_action",true){
|
||||||
public TeleportContainer container=Action;
|
public final TeleportContainer container=Action;
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class WarpCommand {
|
||||||
|
|
||||||
TeleportDestination dest = warp.destination;
|
TeleportDestination dest = warp.destination;
|
||||||
|
|
||||||
ServerLevel dimL=(ServerLevel) dest.getActualDimension();
|
ServerLevel dimL= dest.getActualDimension();
|
||||||
|
|
||||||
|
|
||||||
final int type = warp.RTP ? 1 : 0;
|
final int type = warp.RTP ? 1 : 0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraftforge.eventbus.api.Event;
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public class TeleportEvent extends Event
|
public class TeleportEvent extends Event
|
||||||
{
|
{
|
||||||
private TeleportContainer container;
|
private final TeleportContainer container;
|
||||||
public TeleportEvent(TeleportContainer container)
|
public TeleportEvent(TeleportContainer container)
|
||||||
{
|
{
|
||||||
this.container=container;
|
this.container=container;
|
||||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.nbt.Tag;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
|
||||||
public class Homes {
|
public class Homes {
|
||||||
private Map<String, Home> homes = new HashMap<>();
|
private final Map<String, Home> homes = new HashMap<>();
|
||||||
|
|
||||||
public String playerID;
|
public String playerID;
|
||||||
public Homes(String playerID)
|
public Homes(String playerID)
|
||||||
|
|
|
@ -46,11 +46,11 @@ public class RTP
|
||||||
SearchDirection=1;
|
SearchDirection=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private int SearchDirection;
|
private final int SearchDirection;
|
||||||
private Thread containingThread;
|
private Thread containingThread;
|
||||||
private Heightmap.Types heightMapType;
|
private final Heightmap.Types heightMapType;
|
||||||
public WorldPosition position;
|
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 tries;
|
||||||
protected int lastThreadDelay = 15;
|
protected int lastThreadDelay = 15;
|
||||||
|
|
||||||
|
@ -64,10 +64,7 @@ public class RTP
|
||||||
public boolean isDimension(ServerLevel level)
|
public boolean isDimension(ServerLevel level)
|
||||||
{
|
{
|
||||||
String dim = WorldPosition.getDim(level);
|
String dim = WorldPosition.getDim(level);
|
||||||
if(dim.equals(position.Dimension))
|
return dim.equals(position.Dimension);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}else return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -201,10 +198,7 @@ public class RTP
|
||||||
|
|
||||||
if (b.isAir() && b2.isAir()) {
|
if (b.isAir() && b2.isAir()) {
|
||||||
if (!b3.isAir()) {
|
if (!b3.isAir()) {
|
||||||
if (BLACKLIST.contains(b3.getBlock())) {
|
return !BLACKLIST.contains(b3.getBlock());
|
||||||
return false;
|
|
||||||
} else
|
|
||||||
return true;
|
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class RandomPositionFactory {
|
||||||
RTP tmp = new RTP(level);
|
RTP tmp = new RTP(level);
|
||||||
tmp.position = new WorldPosition(new Vector3(0,0,0), WorldPosition.getDim(level));
|
tmp.position = new WorldPosition(new Vector3(0,0,0), WorldPosition.getDim(level));
|
||||||
Thread tx = new Thread(new RandomPositionLocator(tmp));
|
Thread tx = new Thread(new RandomPositionLocator(tmp));
|
||||||
tx.setName("RTPTask-"+String.valueOf(DelayedExecutorService.getNext()));
|
tx.setName("RTPTask-"+ DelayedExecutorService.getNext());
|
||||||
tx.start();
|
tx.start();
|
||||||
|
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
|
@ -19,7 +19,6 @@ public class FileHandler
|
||||||
try {
|
try {
|
||||||
Files.write(Paths.get(filePath), newContent.getBytes());
|
Files.write(Paths.get(filePath), newContent.getBytes());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,8 @@ public class Warp {
|
||||||
{
|
{
|
||||||
ACLEntry entry = ACL.addEntry(name, ID);
|
ACLEntry entry = ACL.addEntry(name, ID);
|
||||||
MinecraftForge.EVENT_BUS.post(new WarpAccessControlListUpdatedEvent(this, entry, true));
|
MinecraftForge.EVENT_BUS.post(new WarpAccessControlListUpdatedEvent(this, entry, true));
|
||||||
}else return;
|
}else {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,7 +17,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
|
||||||
public class Warps
|
public class Warps
|
||||||
{
|
{
|
||||||
private Map<String,Warp> warps = new HashMap<>();
|
private final Map<String,Warp> warps = new HashMap<>();
|
||||||
|
|
||||||
private Warps(){
|
private Warps(){
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue