make claim signs save into specialized directory
Some checks failed
/ Auto-Build-App (push) Has been cancelled

This commit is contained in:
pietru 2025-03-09 14:11:43 +01:00
parent 7cf2ed014e
commit 21e038fdd5
3 changed files with 3 additions and 37 deletions

View file

@ -106,6 +106,8 @@ public class Area {
public void save(boolean reload){
File area_file = new File(get_path_string(SaveLocation.getSaveFolder().getPath(),"regions",name));
if (!area_file.getParentFile().exists())
area_file.getParentFile().mkdirs();
try {
Json json = new Json();
json.setOutputType(JsonWriter.OutputType.json);
@ -118,5 +120,4 @@ public class Area {
if (reload)
Region.reload_regions();
}
}

View file

@ -58,7 +58,7 @@ public class BlockEntitySignMixin {
area.enabled = true;
ObjectPermList.get_default_perms(area.perms);
area.setCorners(ca, cb);
area.name = "self_claim_sign_"+c+"_" + ownerId.replace(":", "_") + ".json";
area.name = "claim_sign/self_claim_sign_"+c+"_" + ownerId.replace(":", "_") + ".json";
area.zoneId = zone.zoneId;
PlayerAreaPerm plr_perm = PlayerAreaPerm.get_owner_perm(ownerId);

View file

@ -1,35 +0,0 @@
package net.pietru.cookie_utils.mixins;
import com.llamalad7.mixinextras.sugar.Local;
import finalforeach.cosmicreach.accounts.Account;
import finalforeach.cosmicreach.blocks.BlockPosition;
import finalforeach.cosmicreach.entities.player.Player;
import finalforeach.cosmicreach.items.Item;
import finalforeach.cosmicreach.items.ItemSlot;
import finalforeach.cosmicreach.networking.packets.MessagePacket;
import finalforeach.cosmicreach.networking.server.ServerSingletons;
import net.pietru.cookie_utils.permissions.Permissions;
import org.spongepowered.asm.mixin.Mixin;
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_edit_block;
import static net.pietru.cookie_utils.api.Region.is_not_reloading;
@Mixin(Item.class)
public class ItemMixin {
@Inject(method = "useItem", at = @At("HEAD"), cancellable = true)
private void event_item_useItem(CallbackInfo ci, @Local ItemSlot itemSlot, @Local Player player, @Local BlockPosition targetBlockPos){
Account account = player.getAccount();
if (targetBlockPos!=null) {
if (!Permissions.has_user_special_perm(account.getUniqueId()) && !can_edit_block(targetBlockPos, "interact", account.getUniqueId())) {
ci.cancel();
MessagePacket packet = new MessagePacket("[Server] " + (is_not_reloading ? "Sorry, you can't use this item here." : "Sorry but you can't do this action right now. [Config Reload In Progress]"));
packet.setupAndSend(ServerSingletons.getConnection(player));
}
}
}
}