Stop using delayed executor
This commit is contained in:
parent
751262258b
commit
4dac9d568d
7 changed files with 28 additions and 18 deletions
|
@ -6,7 +6,6 @@ import java.util.Map;
|
|||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.client.Keybindings;
|
||||
import dev.zontreck.essentials.client.renderer.TimeBoostEntityRenderer;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||
|
@ -67,7 +66,6 @@ public class AriasEssentials {
|
|||
{
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
bus.addListener(this::setup);
|
||||
DelayedExecutorService.setup();
|
||||
|
||||
AEServerConfig.loadFromFile();
|
||||
AEClientConfig.loadFromFile();
|
||||
|
@ -111,7 +109,6 @@ public class AriasEssentials {
|
|||
public void onServerStart(final ServerStartedEvent ev)
|
||||
{
|
||||
ALIVE=true;
|
||||
DelayedExecutorService.start();
|
||||
|
||||
}
|
||||
|
||||
|
@ -121,7 +118,6 @@ public class AriasEssentials {
|
|||
{
|
||||
ALIVE=false;
|
||||
LOGGER.info("Tearing down Aria's Essentials functions and tasks");
|
||||
DelayedExecutorService.stop();
|
||||
RTPCaches.Locations.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.essentials.events.CommandExecutionEvent;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
|
@ -102,17 +101,23 @@ public class TPACommand {
|
|||
append(ChatHelpers.macro(Messages.TELEPORT_DENY).setStyle(s2)), serverPlayer.server);
|
||||
|
||||
TeleportRegistry.get().add(cont);
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tpa_expire",true){
|
||||
Thread tx = new Thread(new Task("tpa_expire",true){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!(TeleportRegistry.get().contains(cont)))return;
|
||||
TeleportRegistry.get().remove(cont);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
}
|
||||
}, 30);
|
||||
});
|
||||
tx.start();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.Messages;
|
||||
import dev.zontreck.essentials.events.CommandExecutionEvent;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
|
@ -99,17 +98,22 @@ public class TPAHereCommand {
|
|||
|
||||
TeleportRegistry.get().add(cont);
|
||||
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tpahere_expire",true){
|
||||
Thread tx = new Thread(new Task("tpahere_expire",true){
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!(TeleportRegistry.get().contains(cont)))return;
|
||||
TeleportRegistry.get().remove(cont);
|
||||
|
||||
ChatHelpers.broadcastTo(cont.ToPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
ChatHelpers.broadcastTo(cont.FromPlayer, ChatHelpers.macro("!Dark_Red!Teleport request has expired"), cont.Dimension.getServer());
|
||||
}
|
||||
}, 30);
|
||||
});
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.AriasEssentials;
|
||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
|
@ -20,7 +19,8 @@ public class TeleportActioner
|
|||
{
|
||||
public static void PerformTeleport(TeleportContainer contain, boolean eventless){
|
||||
//sub_runnable run = new sub_runnable(contain);
|
||||
DelayedExecutorService.getInstance().schedule(new TeleportRunnable(contain, eventless), 2);
|
||||
Thread tx = new Thread(new TeleportRunnable(contain, eventless));
|
||||
tx.start();
|
||||
}
|
||||
|
||||
public static boolean isBlacklistedDimension(ServerLevel level)
|
||||
|
|
|
@ -2,7 +2,6 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.events.TeleportEvent;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -35,15 +34,23 @@ public class TeleportRunnable extends Task
|
|||
|
||||
Action.PlayerInst.onUpdateAbilities();
|
||||
|
||||
DelayedExecutorService.getInstance().schedule(new Task("tp_action",true){
|
||||
|
||||
Thread tx = new Thread(new Task("tp_action",true){
|
||||
public final TeleportContainer container=Action;
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
container.PlayerInst.onUpdateAbilities();
|
||||
container.PlayerInst.setPos(container.Position);
|
||||
container.PlayerInst.giveExperiencePoints(1);
|
||||
}
|
||||
}, 1);
|
||||
});
|
||||
|
||||
tx.start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package dev.zontreck.essentials.rtp;
|
||||
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportContainer;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
|
@ -22,7 +21,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-"+ DelayedExecutorService.getNext());
|
||||
tx.setName("RTPTask");
|
||||
tx.start();
|
||||
|
||||
return tmp;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package dev.zontreck.essentials.rtp;
|
||||
|
||||
import dev.zontreck.ariaslib.terminal.Task;
|
||||
import dev.zontreck.ariaslib.util.DelayedExecutorService;
|
||||
import dev.zontreck.essentials.AriasEssentials;
|
||||
import dev.zontreck.essentials.events.RTPFoundEvent;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue