Compare commits
No commits in common. "53db2009fc569865f6531999d7d2ac4c69529936" and "dc014a4fe51ddf8ed4de9bbaa4cea5ed2218fd9d" have entirely different histories.
53db2009fc
...
dc014a4fe5
7 changed files with 33 additions and 84 deletions
|
@ -10,9 +10,9 @@ id=cookie_utils
|
||||||
|
|
||||||
# Dependency Versions
|
# Dependency Versions
|
||||||
cosmic_reach_rev=alpha
|
cosmic_reach_rev=alpha
|
||||||
cosmic_reach_version=0.4.9
|
cosmic_reach_version=0.4.8
|
||||||
# If unspecified, will use the version above
|
# If unspecified, will use the version above
|
||||||
cosmic_reach_server_version=0.4.9
|
cosmic_reach_server_version=0.4.8
|
||||||
cosmic_quilt_version=2.3.1
|
cosmic_quilt_version=2.3.1
|
||||||
#2.2.0
|
#2.2.0
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ public class BlockEntitySignMixin {
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private String[] texts = new String[]{"", "", "", "", ""};
|
private String[] texts = new String[]{"", "", "", "", ""};
|
||||||
@Shadow
|
|
||||||
public boolean textureDirty = true;
|
|
||||||
|
|
||||||
@Inject(method = "onInteract", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onInteract", at = @At("HEAD"), cancellable = true)
|
||||||
private void event_onInteract(CallbackInfo ci, @Local Player player, @Local Zone zone){
|
private void event_onInteract(CallbackInfo ci, @Local Player player, @Local Zone zone){
|
||||||
|
@ -69,7 +67,6 @@ public class BlockEntitySignMixin {
|
||||||
Area area = new Area();
|
Area area = new Area();
|
||||||
area.enabled = true;
|
area.enabled = true;
|
||||||
ObjectPermList.get_default_perms(area.perms);
|
ObjectPermList.get_default_perms(area.perms);
|
||||||
ObjectPermList.get_safe_perm_overrides(area.perms);
|
|
||||||
area.setCorners(ca, cb);
|
area.setCorners(ca, cb);
|
||||||
area.name = "claim_sign/self_claim_sign_"+c+"_" + ownerId.replace(":", "_") + ".json";
|
area.name = "claim_sign/self_claim_sign_"+c+"_" + ownerId.replace(":", "_") + ".json";
|
||||||
area.zoneId = zone.zoneId;
|
area.zoneId = zone.zoneId;
|
||||||
|
@ -88,9 +85,6 @@ public class BlockEntitySignMixin {
|
||||||
|
|
||||||
MessagePacket packet = new MessagePacket("[Server] Successfully claimed area of size "+size+" (size*2+1)");
|
MessagePacket packet = new MessagePacket("[Server] Successfully claimed area of size "+size+" (size*2+1)");
|
||||||
packet.setupAndSend(ServerSingletons.getConnection(player));
|
packet.setupAndSend(ServerSingletons.getConnection(player));
|
||||||
|
|
||||||
texts[2] = player.getAccount().getDisplayName();
|
|
||||||
textureDirty = true;
|
|
||||||
} else {
|
} else {
|
||||||
MessagePacket packet = new MessagePacket("[Server] Area of size "+size+" intersects another protected area...");
|
MessagePacket packet = new MessagePacket("[Server] Area of size "+size+" intersects another protected area...");
|
||||||
packet.setupAndSend(ServerSingletons.getConnection(player));
|
packet.setupAndSend(ServerSingletons.getConnection(player));
|
||||||
|
|
|
@ -6,7 +6,9 @@ import finalforeach.cosmicreach.blocks.BlockPosition;
|
||||||
import finalforeach.cosmicreach.blocks.BlockState;
|
import finalforeach.cosmicreach.blocks.BlockState;
|
||||||
import finalforeach.cosmicreach.blocks.BlockStateMissing;
|
import finalforeach.cosmicreach.blocks.BlockStateMissing;
|
||||||
import finalforeach.cosmicreach.entities.player.Player;
|
import finalforeach.cosmicreach.entities.player.Player;
|
||||||
|
import finalforeach.cosmicreach.items.ItemMergeStrategy;
|
||||||
import finalforeach.cosmicreach.items.ItemSlot;
|
import finalforeach.cosmicreach.items.ItemSlot;
|
||||||
|
import finalforeach.cosmicreach.items.ItemStack;
|
||||||
import finalforeach.cosmicreach.networking.NetworkIdentity;
|
import finalforeach.cosmicreach.networking.NetworkIdentity;
|
||||||
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
||||||
import finalforeach.cosmicreach.networking.packets.blocks.PlaceBlockPacket;
|
import finalforeach.cosmicreach.networking.packets.blocks.PlaceBlockPacket;
|
||||||
|
|
|
@ -1,27 +1,10 @@
|
||||||
package net.pietru.cookie_utils.mixins;
|
package net.pietru.cookie_utils.mixins;
|
||||||
|
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
|
||||||
import finalforeach.cosmicreach.accounts.Account;
|
|
||||||
import finalforeach.cosmicreach.entities.Entity;
|
import finalforeach.cosmicreach.entities.Entity;
|
||||||
import finalforeach.cosmicreach.entities.EntityFlameProjectile;
|
|
||||||
import finalforeach.cosmicreach.entities.EntityLaserProjectile;
|
|
||||||
import finalforeach.cosmicreach.entities.IDamageSource;
|
|
||||||
import finalforeach.cosmicreach.entities.components.PlayerFallDamage;
|
|
||||||
import finalforeach.cosmicreach.entities.player.Player;
|
|
||||||
import finalforeach.cosmicreach.entities.player.PlayerEntity;
|
|
||||||
import finalforeach.cosmicreach.networking.packets.MessagePacket;
|
|
||||||
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
|
||||||
import finalforeach.cosmicreach.world.Zone;
|
import finalforeach.cosmicreach.world.Zone;
|
||||||
import net.pietru.cookie_utils.permissions.Permissions;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import static net.pietru.cookie_utils.api.Region.can_enter_position;
|
|
||||||
import static net.pietru.cookie_utils.api.Region.is_not_reloading;
|
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
public class EntityMixin {
|
public class EntityMixin {
|
||||||
|
@ -29,32 +12,4 @@ public class EntityMixin {
|
||||||
public Zone zone;
|
public Zone zone;
|
||||||
@Shadow
|
@Shadow
|
||||||
public Vector3 position;
|
public Vector3 position;
|
||||||
|
|
||||||
@Inject(method = "hit", at = @At("HEAD"), cancellable = true)
|
|
||||||
private void event_player_hit(CallbackInfo ci, @Local(argsOnly = true) IDamageSource damageSource, @Local(argsOnly = true) float amount){
|
|
||||||
if (damageSource instanceof Entity) {
|
|
||||||
if (damageSource instanceof PlayerEntity) {
|
|
||||||
Account account = ((PlayerEntity) damageSource).getPlayer().getAccount();
|
|
||||||
|
|
||||||
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_enter_position(((Entity) damageSource).getPosition(), "pve", account.getUniqueId())) {
|
|
||||||
ci.cancel();
|
|
||||||
|
|
||||||
MessagePacket packet = new MessagePacket("[Server] " + (is_not_reloading ? "Sorry, but you can't things here." : "Sorry but you can't do this action right now. [Config Reload In Progress]"));
|
|
||||||
packet.setupAndSend(ServerSingletons.getConnection(((PlayerEntity) damageSource).getPlayer()));
|
|
||||||
}
|
|
||||||
} else if (damageSource instanceof EntityLaserProjectile) {
|
|
||||||
if (!can_enter_position(((Entity)damageSource).getPosition(), "laser_damage", this.zone)) {
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
} else if (damageSource instanceof EntityFlameProjectile) {
|
|
||||||
if (!can_enter_position(((Entity)damageSource).getPosition(), "fire_damage", this.zone)) {
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!can_enter_position(((Entity)damageSource).getPosition(), "eve", this.zone)) {
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.pietru.cookie_utils.mixins;
|
||||||
import com.llamalad7.mixinextras.sugar.Local;
|
import com.llamalad7.mixinextras.sugar.Local;
|
||||||
import finalforeach.cosmicreach.accounts.Account;
|
import finalforeach.cosmicreach.accounts.Account;
|
||||||
import finalforeach.cosmicreach.entities.Entity;
|
import finalforeach.cosmicreach.entities.Entity;
|
||||||
import finalforeach.cosmicreach.entities.EntityFlameProjectile;
|
|
||||||
import finalforeach.cosmicreach.entities.EntityLaserProjectile;
|
import finalforeach.cosmicreach.entities.EntityLaserProjectile;
|
||||||
import finalforeach.cosmicreach.entities.IDamageSource;
|
import finalforeach.cosmicreach.entities.IDamageSource;
|
||||||
import finalforeach.cosmicreach.entities.components.PlayerFallDamage;
|
import finalforeach.cosmicreach.entities.components.PlayerFallDamage;
|
||||||
|
@ -21,27 +20,42 @@ import static net.pietru.cookie_utils.api.Region.*;
|
||||||
@Mixin(PlayerEntity.class)
|
@Mixin(PlayerEntity.class)
|
||||||
public class PlayerEntityMixin extends EntityMixin{
|
public class PlayerEntityMixin extends EntityMixin{
|
||||||
|
|
||||||
|
@Inject(method = "onAttackInteraction", at = @At("HEAD"), cancellable = true)
|
||||||
|
private void event_player_attack(CallbackInfo ci, @Local(argsOnly = true) Entity sourceEntity){
|
||||||
|
if (sourceEntity instanceof PlayerEntity){
|
||||||
|
Account account = ((PlayerEntity) sourceEntity).getPlayer().getAccount();
|
||||||
|
|
||||||
|
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_enter_position(sourceEntity.getPosition(),"pvp",account.getUniqueId())) {
|
||||||
|
ci.cancel();
|
||||||
|
|
||||||
|
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).getPlayer()));
|
||||||
|
}
|
||||||
|
} 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "hit", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "hit", at = @At("HEAD"), cancellable = true)
|
||||||
private void event_player_hit(CallbackInfo ci, @Local(argsOnly = true) IDamageSource damageSource, @Local(argsOnly = true) float amount){
|
private void event_player_hit(CallbackInfo ci, @Local(argsOnly = true) IDamageSource damageSource, @Local(argsOnly = true) float amount){
|
||||||
if (damageSource instanceof Entity) {
|
if (damageSource instanceof Entity) {
|
||||||
if (damageSource instanceof PlayerEntity) {
|
if (damageSource instanceof PlayerEntity) {
|
||||||
Account account = ((PlayerEntity) damageSource).getPlayer().getAccount();
|
Account account = ((PlayerEntity) damageSource).getPlayer().getAccount();
|
||||||
Entity ob = ((Entity)(Object)this);
|
|
||||||
|
|
||||||
if (ob instanceof PlayerEntity) {
|
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_enter_position(((Entity)damageSource).getPosition(), "pvp", account.getUniqueId())) {
|
||||||
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_enter_position(((Entity) damageSource).getPosition(), "pvp", account.getUniqueId())) {
|
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
|
|
||||||
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]"));
|
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) damageSource).getPlayer()));
|
packet.setupAndSend(ServerSingletons.getConnection(((PlayerEntity) damageSource).getPlayer()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else if (damageSource instanceof EntityLaserProjectile) {
|
} else if (damageSource instanceof EntityLaserProjectile) {
|
||||||
if (!can_enter_position(((Entity)damageSource).getPosition(), "player_laser_damage", this.zone)) {
|
if (!can_enter_position(((Entity)damageSource).getPosition(), "laser_damage", this.zone)) {
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
} else if (damageSource instanceof EntityFlameProjectile) {
|
|
||||||
if (!can_enter_position(((Entity)damageSource).getPosition(), "player_fire_damage", this.zone)) {
|
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -7,7 +7,6 @@ import java.util.Map;
|
||||||
|
|
||||||
public class ObjectPermList {
|
public class ObjectPermList {
|
||||||
public static final Map<String,Boolean> default_bool_perms = new HashMap<>();
|
public static final Map<String,Boolean> default_bool_perms = new HashMap<>();
|
||||||
public static final Map<String,Boolean> safety_overrides_bool_perms = new HashMap<>();
|
|
||||||
static {
|
static {
|
||||||
default_bool_perms.put("place", false);
|
default_bool_perms.put("place", false);
|
||||||
default_bool_perms.put("break", false);
|
default_bool_perms.put("break", false);
|
||||||
|
@ -21,17 +20,8 @@ public class ObjectPermList {
|
||||||
|
|
||||||
default_bool_perms.put("pvp", false);
|
default_bool_perms.put("pvp", false);
|
||||||
default_bool_perms.put("pve", true);
|
default_bool_perms.put("pve", true);
|
||||||
default_bool_perms.put("eve", true);
|
|
||||||
default_bool_perms.put("player_laser_damage", true);
|
|
||||||
default_bool_perms.put("laser_damage", true);
|
default_bool_perms.put("laser_damage", true);
|
||||||
default_bool_perms.put("player_fire_damage", true);
|
|
||||||
default_bool_perms.put("fire_damage", true);
|
|
||||||
default_bool_perms.put("fall_damage",true);
|
default_bool_perms.put("fall_damage",true);
|
||||||
|
|
||||||
safety_overrides_bool_perms.put("pve", false);
|
|
||||||
safety_overrides_bool_perms.put("player_laser_damage", false);
|
|
||||||
safety_overrides_bool_perms.put("player_fire_damage", false);
|
|
||||||
safety_overrides_bool_perms.put("fall_damage",false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,10 +59,4 @@ public class ObjectPermList {
|
||||||
val.set_bool_perm(key,default_bool_perms.get(key));
|
val.set_bool_perm(key,default_bool_perms.get(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void get_safe_perm_overrides(ObjectPermList val){
|
|
||||||
for (String key : safety_overrides_bool_perms.keySet()){
|
|
||||||
val.set_bool_perm(key,default_bool_perms.get(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,8 @@ import finalforeach.cosmicreach.entities.player.Player;
|
||||||
import finalforeach.cosmicreach.networking.packets.ParticleSystemPacket;
|
import finalforeach.cosmicreach.networking.packets.ParticleSystemPacket;
|
||||||
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
import finalforeach.cosmicreach.networking.server.ServerSingletons;
|
||||||
import finalforeach.cosmicreach.particles.GameParticleSystem;
|
import finalforeach.cosmicreach.particles.GameParticleSystem;
|
||||||
import finalforeach.cosmicreach.particles.components.IParticleComponent;
|
import finalforeach.cosmicreach.particles.IParticleComponent;
|
||||||
import finalforeach.cosmicreach.particles.components.spawn.GameParticleSpawnSphere;
|
import finalforeach.cosmicreach.particles.spawn.GameParticleSpawnSphere;
|
||||||
import finalforeach.cosmicreach.world.Zone;
|
import finalforeach.cosmicreach.world.Zone;
|
||||||
import net.pietru.cookie_utils.scripting.BaseScript;
|
import net.pietru.cookie_utils.scripting.BaseScript;
|
||||||
import net.pietru.cookie_utils.scripting.ExecutionContext;
|
import net.pietru.cookie_utils.scripting.ExecutionContext;
|
||||||
|
|
Loading…
Reference in a new issue