Disable ticking player if not authenticated

This commit is contained in:
samo_lego 2020-10-16 22:41:37 +02:00
父節點 c4ea00194a
當前提交 561e3784c9
共有 1 個文件被更改,包括 2 次插入1 次删除

查看文件

@ -194,7 +194,7 @@ public abstract class MixinPlayerEntity implements PlayerAuth {
return playerCacheMap.containsKey(uuid) && playerCacheMap.get(uuid).isAuthenticated;
}
@Inject(method = "tick()V", at = @At("HEAD"))
@Inject(method = "tick()V", at = @At("HEAD"), cancellable = true)
private void tick(CallbackInfo ci) {
if(!this.isAuthenticated()) {
// Checking player timer
@ -207,6 +207,7 @@ public abstract class MixinPlayerEntity implements PlayerAuth {
player.sendMessage(this.getAuthMessage(), false);
kickTimer--;
}
ci.cancel();
}
}