This commit is contained in:
parent
45c4e939a8
commit
a8891729d4
1 changed files with 20 additions and 18 deletions
|
@ -27,27 +27,29 @@ public class EntityLaserProjectileMixin extends EntityMixin {
|
||||||
|
|
||||||
@Inject(method = "onCollideWithBlock", at = @At("HEAD"), cancellable = true)
|
@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){
|
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);
|
if (GameSingletons.isHost && ServerSingletons.SERVER != null){
|
||||||
Player plr = null;
|
BlockPosition blockPos = BlockPosition.ofGlobal(this.zone, bx, by, bz);
|
||||||
for (Player p : GameSingletons.world.players) {
|
Player plr = null;
|
||||||
if (p.getEntity().uniqueId.equals(sourceEntityId)) {
|
for (Player p : GameSingletons.world.players) {
|
||||||
plr = p;
|
if (p.getEntity().uniqueId.equals(sourceEntityId)) {
|
||||||
break;
|
plr = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (plr!=null) {
|
||||||
if (plr!=null) {
|
Account account = GameSingletons.getAccountFromPlayer(plr);
|
||||||
Account account = GameSingletons.getAccountFromPlayer(plr);
|
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos, "laser", account.getUniqueId())) {
|
||||||
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(blockPos, "laser", account.getUniqueId())) {
|
ci.cancel();
|
||||||
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]"));
|
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));
|
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue