fix laser stuff
All checks were successful
/ Auto-Build-App (push) Successful in 1m21s

This commit is contained in:
pietru 2025-02-26 10:51:20 +01:00
parent 45c4e939a8
commit a8891729d4

View file

@ -27,27 +27,29 @@ public class EntityLaserProjectileMixin extends EntityMixin {
@Inject(method = "onCollideWithBlock", at = @At("HEAD"), cancellable = true)
private void event_collide_block(Axis axis, BlockState block, int bx, int by, int bz, CallbackInfo ci){
BlockPosition blockPos = BlockPosition.ofGlobal(this.zone, bx, by, bz);
Player plr = null;
for (Player p : GameSingletons.world.players) {
if (p.getEntity().uniqueId.equals(sourceEntityId)) {
plr = p;
break;
if (GameSingletons.isHost && ServerSingletons.SERVER != null){
BlockPosition blockPos = BlockPosition.ofGlobal(this.zone, bx, by, bz);
Player plr = null;
for (Player p : GameSingletons.world.players) {
if (p.getEntity().uniqueId.equals(sourceEntityId)) {
plr = p;
break;
}
}
}
if (plr!=null) {
Account account = GameSingletons.getAccountFromPlayer(plr);
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos, "laser", account.getUniqueId())) {
ci.cancel();
if (plr!=null) {
Account account = GameSingletons.getAccountFromPlayer(plr);
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos, "laser", account.getUniqueId())) {
ci.cancel();
MessagePacket packet = new MessagePacket("[Server] " + (is_not_reloading ? "Sorry, but this area is under protection." : "Sorry but you can't do this action right now. [Config Reload In Progress]"));
packet.setupAndSend(ServerSingletons.getConnection(plr));
MessagePacket packet = new MessagePacket("[Server] " + (is_not_reloading ? "Sorry, but this area is under protection." : "Sorry but you can't do this action right now. [Config Reload In Progress]"));
packet.setupAndSend(ServerSingletons.getConnection(plr));
}
}else {
if (sourceEntityId==null && !can_edit_block(blockPos, "be_laser"))
ci.cancel();
else if (sourceEntityId!=null &&!can_edit_block(blockPos, "laser"))
ci.cancel();
}
}else {
if (sourceEntityId==null && !can_edit_block(blockPos, "be_laser"))
ci.cancel();
else if (!can_edit_block(blockPos, "laser"))
ci.cancel();
}
}
}