Fixing #16
This commit is contained in:
parent
aff0241049
commit
f480e93ed2
|
@ -58,9 +58,9 @@ dependencies {
|
|||
// carpetMod
|
||||
// from masa's maven
|
||||
//modImplementation "carpet:fabric-carpet:${project.minecraft_version}-${project.carpet_core_version}"
|
||||
modImplementation "carpet:fabric-carpet:1.16-${project.carpet_core_version}"
|
||||
//modImplementation "carpet:fabric-carpet:1.16-${project.carpet_core_version}"
|
||||
// jitpack for quicker updating
|
||||
//modImplementation "com.github.gnembon:fabric-carpet:${project.carpet_branch}-SNAPSHOT"
|
||||
modImplementation "com.github.gnembon:fabric-carpet:${project.carpet_branch}-SNAPSHOT"
|
||||
}
|
||||
|
||||
processResources {
|
||||
|
|
|
@ -21,4 +21,4 @@ bytes_version = 1.3.0
|
|||
|
||||
# Carpet for debugging
|
||||
carpet_core_version = 1.4.0+v200623
|
||||
carpet_branch = 1.16
|
||||
carpet_branch = master
|
|
@ -36,6 +36,7 @@ import java.util.Timer;
|
|||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.iq80.leveldb.impl.Iq80DBFactory.bytes;
|
||||
import static org.samo_lego.simpleauth.utils.CarpetHelper.isPlayerCarpetFake;
|
||||
|
@ -160,6 +161,20 @@ public class SimpleAuth implements DedicatedServerModInitializer {
|
|||
logError("Error saving player data! " + e.getMessage());
|
||||
}
|
||||
|
||||
// Closing threads
|
||||
try {
|
||||
THREADPOOL.shutdownNow();
|
||||
TIMER.cancel();
|
||||
TIMER.purge();
|
||||
if (!THREADPOOL.awaitTermination(100, TimeUnit.MICROSECONDS)) {
|
||||
System.out.println("Still waiting...");
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
logError(e.getMessage());
|
||||
THREADPOOL.shutdownNow();
|
||||
}
|
||||
|
||||
// Closing DB connection
|
||||
DB.close();
|
||||
}
|
||||
|
|
|
@ -99,15 +99,15 @@ public class AuthEventHandler {
|
|||
if(config.main.tryPortalRescue && player.getBlockState().getBlock().equals(Blocks.NETHER_PORTAL)) {
|
||||
BlockPos pos = player.getBlockPos();
|
||||
|
||||
// Teleporting player to the middle of the block
|
||||
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
|
||||
// Faking portal blocks to be air
|
||||
BlockUpdateS2CPacket feetPacket = new BlockUpdateS2CPacket(pos, Blocks.AIR.getDefaultState());
|
||||
player.networkHandler.sendPacket(feetPacket);
|
||||
|
||||
BlockUpdateS2CPacket headPacket = new BlockUpdateS2CPacket(pos.up(), Blocks.AIR.getDefaultState());
|
||||
player.networkHandler.sendPacket(headPacket);
|
||||
|
||||
// Teleporting player to the middle of the block
|
||||
player.teleport(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,10 +68,10 @@ public abstract class MixinServerPlayNetworkHandler {
|
|||
cancellable = true
|
||||
)
|
||||
private void onPlayerMove(PlayerMoveC2SPacket playerMoveC2SPacket, CallbackInfo ci) {
|
||||
ActionResult result = PlayerMoveCallback.EVENT.invoker().onPlayerMove(this.player);
|
||||
ActionResult result = PlayerMoveCallback.EVENT.invoker().onPlayerMove(player);
|
||||
if (result == ActionResult.FAIL) {
|
||||
// A bit ugly, I know. (we need to update player position)
|
||||
this.player.requestTeleport(this.player.getX(), this.player.getY(), this.player.getZ());
|
||||
player.networkHandler.requestTeleport(player.getX(), player.getY(), player.getZ(), player.yaw, player.pitch);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue