Update from Git Manager GUI
This commit is contained in:
@@ -1819,6 +1819,30 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
return attachedBlock.equals(chestBlock);
|
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) {
|
private void addInputChestLocation(UUID playerUUID, Location location) {
|
||||||
String basePath = "players." + playerUUID + ".input-chests";
|
String basePath = "players." + playerUUID + ".input-chests";
|
||||||
String id = UUID.randomUUID().toString();
|
String id = UUID.randomUUID().toString();
|
||||||
@@ -3043,6 +3067,11 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hasAscSignOnContainer(targetBlock, null)) {
|
||||||
|
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// ── 2. Typ normalisieren ─────────────────────────────────────────────
|
// ── 2. Typ normalisieren ─────────────────────────────────────────────
|
||||||
String typRaw = args[1].toLowerCase();
|
String typRaw = args[1].toLowerCase();
|
||||||
switch (typRaw) {
|
switch (typRaw) {
|
||||||
@@ -3379,20 +3408,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
||||||
}
|
}
|
||||||
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
|
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
|
if (hasAscSignOnContainer(chestBlock, signBlock)) {
|
||||||
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
|
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
||||||
for (Block cb : blocksToCheck) {
|
event.setCancelled(true);
|
||||||
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
|
return;
|
||||||
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)) {
|
|
||||||
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Limit-Check: Kein Rang = keine Truhe
|
// Limit-Check: Kein Rang = keine Truhe
|
||||||
if (chestLimitsEnabled && getChestLimitForPlayer(player, "input") == 0
|
if (chestLimitsEnabled && getChestLimitForPlayer(player, "input") == 0
|
||||||
@@ -3428,20 +3447,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
||||||
}
|
}
|
||||||
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
|
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
|
if (hasAscSignOnContainer(chestBlock, signBlock)) {
|
||||||
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
|
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
||||||
for (Block cb : blocksToCheck) {
|
event.setCancelled(true);
|
||||||
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
|
return;
|
||||||
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)) {
|
|
||||||
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// ── Limit-Pruefung: Rest-Truhe ─────────────────────────────────────
|
// ── Limit-Pruefung: Rest-Truhe ─────────────────────────────────────
|
||||||
if (chestLimitsEnabled) {
|
if (chestLimitsEnabled) {
|
||||||
@@ -3506,20 +3515,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
||||||
}
|
}
|
||||||
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
|
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
|
if (hasAscSignOnContainer(chestBlock, signBlock)) {
|
||||||
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
|
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
||||||
for (Block cb : blocksToCheck) {
|
event.setCancelled(true);
|
||||||
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
|
return;
|
||||||
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)) {
|
|
||||||
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chestLimitsEnabled) {
|
if (chestLimitsEnabled) {
|
||||||
int maxInput = getChestLimitForPlayer(player, "input");
|
int maxInput = getChestLimitForPlayer(player, "input");
|
||||||
@@ -3597,20 +3596,10 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor, org.b
|
|||||||
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
if (isContainer(attachedBlock)) chestBlock = attachedBlock;
|
||||||
}
|
}
|
||||||
if (chestBlock == null) { player.sendMessage(getMessage("no-chest-near-sign")); return; }
|
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
|
if (hasAscSignOnContainer(chestBlock, signBlock)) {
|
||||||
java.util.List<Block> blocksToCheck = getContainerBlocks(chestBlock);
|
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
||||||
for (Block cb : blocksToCheck) {
|
event.setCancelled(true);
|
||||||
for (org.bukkit.block.BlockFace face : org.bukkit.block.BlockFace.values()) {
|
return;
|
||||||
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)) {
|
|
||||||
player.sendMessage("§cAn diesem Behälter ist bereits ein ASC-Schild!");
|
|
||||||
event.setCancelled(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
event.setLine(0, getSignColor("target", "line1") + "[asc]");
|
event.setLine(0, getSignColor("target", "line1") + "[asc]");
|
||||||
event.setLine(1, getSignColor("target", "line2") + lines[1]); // "ziel" oder "target" beibehalten
|
event.setLine(1, getSignColor("target", "line2") + lines[1]); // "ziel" oder "target" beibehalten
|
||||||
|
|||||||
Reference in New Issue
Block a user