add server

This commit is contained in:
Sen 2025-05-01 15:13:38 +02:00
parent d5269922b9
commit 76ecfb39ab
25 changed files with 603 additions and 520 deletions

View file

@ -274,6 +274,8 @@ public class Player extends NetHandler implements ICrafting, Executor
this.pingKey = (int)this.lastPingTime;
this.sendPacket(new SPacketKeepAlive(this.pingKey));
}
if(this.local)
if(this.respawnTimer > 0) {
if(--this.respawnTimer == 0) {
this.respawnPlayer();
@ -2511,7 +2513,7 @@ public class Player extends NetHandler implements ICrafting, Executor
NetHandler.checkThread(packetIn, this, this.server);
CPacketAction.Action action = packetIn.getAction();
if(this.charEditor != (action == Action.SET_ALIGN || action == Action.SET_SPECIES || action == Action.SET_CLASS || action == Action.SET_HEIGHT || action == Action.CLOSE_EDITOR)) // {
if(action != Action.SET_VIEWDIST && action != Action.SHUTDOWN && (this.charEditor != (action == Action.SET_ALIGN || action == Action.SET_SPECIES || action == Action.SET_CLASS || action == Action.SET_HEIGHT || action == Action.CLOSE_EDITOR))) // {
// if(this.local && action == Action.CLOSE_EDITOR)
// this.server.setDone();
return;
@ -2873,7 +2875,27 @@ public class Player extends NetHandler implements ICrafting, Executor
this.entity.setNpcClass(classes[packetIn.getAuxData()]);
}
break;
case WARP_MODE:
if(this.isLocal()) {
this.server.schedule(new Runnable() {
public void run() {
Player.this.server.setTpsTarget(Player.this.server.getTpsTarget() < 10000.0f ? 10000.0f : 20.0f);
}
});
}
break;
case SET_VIEWDIST:
if(this.isLocal())
this.server.setVar("viewDistance", "" + packetIn.getAuxData());
break;
case SHUTDOWN:
if(this.isLocal())
this.server.shutdown();
break;
default:
throw new IllegalArgumentException("Ungültige Aktion!");
}