add way to disable pve and disable laser damage
All checks were successful
/ Auto-Build-App (push) Successful in 1m25s
All checks were successful
/ Auto-Build-App (push) Successful in 1m25s
This commit is contained in:
parent
a8891729d4
commit
9cc00d245d
3 changed files with 16 additions and 1 deletions
|
@ -192,6 +192,8 @@ public class Region {
|
|||
perms.set_bool_perm("spawn_mob", region.getBoolean("spawn_mob", true));
|
||||
|
||||
perms.set_bool_perm("pvp", region.getBoolean("pvp", false));
|
||||
perms.set_bool_perm("pve", region.getBoolean("pve", true));
|
||||
perms.set_bool_perm("laser_damage", region.getBoolean("laser_damage", true));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.pietru.cookie_utils.mixins;
|
|||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import finalforeach.cosmicreach.accounts.Account;
|
||||
import finalforeach.cosmicreach.entities.Entity;
|
||||
import finalforeach.cosmicreach.entities.EntityLaserProjectile;
|
||||
import finalforeach.cosmicreach.entities.player.PlayerEntity;
|
||||
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
||||
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
||||
|
@ -15,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
import static net.pietru.cookie_utils.api.Region.*;
|
||||
|
||||
@Mixin(PlayerEntity.class)
|
||||
public class PlayerEntityMixin {
|
||||
public class PlayerEntityMixin extends EntityMixin{
|
||||
|
||||
@Inject(method = "onAttackInteraction", at = @At("HEAD"), cancellable = true)
|
||||
private void event_player_attack(CallbackInfo ci, @Local Entity sourceEntity){
|
||||
|
@ -28,6 +29,14 @@ public class PlayerEntityMixin {
|
|||
MessagePacket packet = new MessagePacket("[Server] " + (is_not_reloading ? "Sorry, but you can't attack people here." : "Sorry but you can't do this action right now. [Config Reload In Progress]"));
|
||||
packet.setupAndSend(ServerSingletons.getConnection(((PlayerEntity) sourceEntity).player));
|
||||
}
|
||||
} else if (sourceEntity instanceof EntityLaserProjectile) {
|
||||
if (!can_enter_position(sourceEntity.getPosition(),"laser_damage",this.zone)){
|
||||
ci.cancel();
|
||||
}
|
||||
} else {
|
||||
if (!can_enter_position(sourceEntity.getPosition(),"pve",this.zone)){
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,8 @@ public class ObjectPermList {
|
|||
val.addChild("spawn_mob", new JsonValue(false));
|
||||
|
||||
val.addChild("pvp", new JsonValue(false));
|
||||
val.addChild("pve", new JsonValue(true));
|
||||
val.addChild("laser_damage", new JsonValue(true));
|
||||
}
|
||||
|
||||
public static void get_default_perms(ObjectPermList val){
|
||||
|
@ -56,5 +58,7 @@ public class ObjectPermList {
|
|||
val.set_bool_perm("spawn_mob", false);
|
||||
|
||||
val.set_bool_perm("pvp", false);
|
||||
val.set_bool_perm("pve", true);
|
||||
val.set_bool_perm("laser_damage", true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue