Update from Git Manager GUI

This commit is contained in:
2026-04-01 21:51:06 +02:00
parent c33ddf3550
commit 929253a3b5

View File

@@ -1819,6 +1819,30 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
return attachedBlock.equals(chestBlock);
}
/**
* Erzwingt: pro Container (Truhe/Fass, inkl. DoubleChest-Hälften) genau ein ASC-Schild.
*
* @param containerBlock Truhe/Fass-Block
* @param ignoreSignBlock optionales Schild, das ignoriert wird (z.B. gerade platziertes Schild)
*/
private boolean hasAscSignOnContainer(Block containerBlock, Block ignoreSignBlock) {
if (containerBlock == null || !isContainer(containerBlock)) return false;
for (Block b : getContainerBlocks(containerBlock)) {
for (Block face : adjacentFaces(b)) {
if (ignoreSignBlock != null && face.equals(ignoreSignBlock)) continue;
if (!(face.getState() instanceof Sign otherSign)) continue;
if (!isSignAttachedToChest(face, b)) continue;
String l0 = ChatColor.stripColor(otherSign.getLine(0) != null ? otherSign.getLine(0) : "");
if (l0.equalsIgnoreCase("[asc]") || isAnyCleanSign(otherSign)) {
return true;
}
}
}
return false;
}
private void addInputChestLocation(UUID playerUUID, Location location) {
String basePath = "players." + playerUUID + ".input-chests";
String id = UUID.randomUUID().toString();
@@ -3043,6 +3067,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
return true;
}
if (hasAscSignOnContainer(targetBlock, null)) {
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
return true;
}
// ── 2. Typ normalisieren ─────────────────────────────────────────────
String typRaw = args[1].toLowerCase();
switch (typRaw) {
@@ -3379,21 +3408,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
}
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
// Prüfe, ob bereits ein ASC-Schild an der Truhe oder am Fass ist
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
for (Block cb : blocksToCheck) {
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
Block relative = cb.getRelative(face);
if (relative.getState() instanceof org.bukkit.block.Sign otherSign) {
String l0 = org.bukkit.ChatColor.stripColor(otherSign.getLine(0) != null ? otherSign.getLine(0) : "");
if (l0.equalsIgnoreCase("[asc]") || isAnyCleanSign(otherSign)) {
if (hasAscSignOnContainer(chestBlock, signBlock)) {
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
event.setCancelled(true);
return;
}
}
}
}
// Limit-Check: Kein Rang = keine Truhe
if (chestLimitsEnabled && getChestLimitForPlayer(player, "input") == 0
&& getChestLimitForPlayer(player, "target") == 0) {
@@ -3428,21 +3447,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
}
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
// Prüfe, ob bereits ein ASC-Schild an der Truhe oder am Fass ist
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
for (Block cb : blocksToCheck) {
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
Block relative = cb.getRelative(face);
if (relative.getState() instanceof org.bukkit.block.Sign otherSign) {
String l0 = org.bukkit.ChatColor.stripColor(otherSign.getLine(0) != null ? otherSign.getLine(0) : "");
if (l0.equalsIgnoreCase("[asc]") || isAnyCleanSign(otherSign)) {
if (hasAscSignOnContainer(chestBlock, signBlock)) {
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
event.setCancelled(true);
return;
}
}
}
}
// ── Limit-Pruefung: Rest-Truhe ─────────────────────────────────────
if (chestLimitsEnabled) {
int maxRest = getChestLimitForPlayer(player, "rest");
@@ -3506,21 +3515,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
}
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
// Prüfe, ob bereits ein ASC-Schild an der Truhe oder am Fass ist
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
for (Block cb : blocksToCheck) {
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
Block relative = cb.getRelative(face);
if (relative.getState() instanceof org.bukkit.block.Sign otherSign) {
String l0 = org.bukkit.ChatColor.stripColor(otherSign.getLine(0) != null ? otherSign.getLine(0) : "");
if (l0.equalsIgnoreCase("[asc]") || isAnyCleanSign(otherSign)) {
if (hasAscSignOnContainer(chestBlock, signBlock)) {
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
event.setCancelled(true);
return;
}
}
}
}
if (chestLimitsEnabled) {
int maxInput = getChestLimitForPlayer(player, "input");
int currentInput = 0;
@@ -3597,21 +3596,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
}
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
// Prüfe, ob bereits ein ASC-Schild an der Truhe oder am Fass ist
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
for (Block cb : blocksToCheck) {
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
Block relative = cb.getRelative(face);
if (relative.getState() instanceof org.bukkit.block.Sign otherSign) {
String l0 = org.bukkit.ChatColor.stripColor(otherSign.getLine(0) != null ? otherSign.getLine(0) : "");
if (l0.equalsIgnoreCase("[asc]") || isAnyCleanSign(otherSign)) {
if (hasAscSignOnContainer(chestBlock, signBlock)) {
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
event.setCancelled(true);
return;
}
}
}
}
event.setLine(0, getSignColor("target", "line1") + "[asc]");
event.setLine(1, getSignColor("target", "line2") + lines[1]); // "ziel" oder "target" beibehalten
event.setLine(2, "");