|
|
|
|
@@ -1,9 +1,14 @@
|
|
|
|
|
package com.viper.autosortchest;
|
|
|
|
|
|
|
|
|
|
import org.bukkit.Bukkit;
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
import org.bukkit.Location;
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
|
import org.bukkit.World;
|
|
|
|
|
import org.bukkit.block.Block;
|
|
|
|
|
import org.bukkit.block.Chest;
|
|
|
|
|
import org.bukkit.block.DoubleChest;
|
|
|
|
|
import org.bukkit.block.Sign;
|
|
|
|
|
import org.bukkit.block.data.type.WallSign;
|
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
|
@@ -20,12 +25,10 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|
|
|
|
import org.bukkit.event.block.SignChangeEvent;
|
|
|
|
|
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
|
import org.bukkit.inventory.InventoryHolder;
|
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
|
|
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
|
import org.bukkit.scheduler.BukkitRunnable;
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.OfflinePlayer;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
@@ -99,6 +102,27 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
getLogger().info("AutoSortChest Plugin deaktiviert!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- NEUE HILFSMETHODE FÜR DOPPELTRUHEN ---
|
|
|
|
|
private List<Block> getChestBlocks(Chest chest) {
|
|
|
|
|
List<Block> blocks = new ArrayList<>();
|
|
|
|
|
InventoryHolder holder = chest.getInventory().getHolder();
|
|
|
|
|
|
|
|
|
|
if (holder instanceof DoubleChest) {
|
|
|
|
|
DoubleChest doubleChest = (DoubleChest) holder;
|
|
|
|
|
// Finde beide Blöcke der Doppeltruhe
|
|
|
|
|
if (doubleChest.getLeftSide() instanceof Chest) {
|
|
|
|
|
blocks.add(((Chest) doubleChest.getLeftSide()).getBlock());
|
|
|
|
|
}
|
|
|
|
|
if (doubleChest.getRightSide() instanceof Chest) {
|
|
|
|
|
blocks.add(((Chest) doubleChest.getRightSide()).getBlock());
|
|
|
|
|
}
|
|
|
|
|
} else if (holder instanceof Chest) {
|
|
|
|
|
blocks.add(chest.getBlock());
|
|
|
|
|
}
|
|
|
|
|
return blocks;
|
|
|
|
|
}
|
|
|
|
|
// -----------------------------------------
|
|
|
|
|
|
|
|
|
|
private void savePlayerData() {
|
|
|
|
|
if (playerData == null || playerDataFile == null) {
|
|
|
|
|
getLogger().warning("Kann players.yml nicht speichern: playerData oder playerDataFile ist null");
|
|
|
|
|
@@ -434,13 +458,15 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Block> blocks = getChestBlocks((Chest) chestBlock.getState());
|
|
|
|
|
for (Block b : blocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
chestBlock.getRelative(1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(-1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(0, 0, 1),
|
|
|
|
|
chestBlock.getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, chestBlock)) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -457,6 +483,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Zieltruhen
|
|
|
|
|
String targetPath = path + ".target-chests";
|
|
|
|
|
@@ -484,13 +511,15 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
Inventory inventory = chest.getInventory();
|
|
|
|
|
boolean isFull = isInventoryFull(inventory);
|
|
|
|
|
|
|
|
|
|
List<Block> blocks = getChestBlocks(chest);
|
|
|
|
|
for (Block b : blocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
chestBlock.getRelative(1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(-1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(0, 0, 1),
|
|
|
|
|
chestBlock.getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, chestBlock)) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -511,6 +540,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- NEU: Rest-Truhe aktualisieren ---
|
|
|
|
|
String restPath = path + ".rest-chest";
|
|
|
|
|
@@ -536,13 +566,15 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
Inventory inventory = chest.getInventory();
|
|
|
|
|
boolean isFull = isInventoryFull(inventory);
|
|
|
|
|
|
|
|
|
|
List<Block> blocks = getChestBlocks(chest);
|
|
|
|
|
for (Block b : blocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
chestBlock.getRelative(1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(-1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(0, 0, 1),
|
|
|
|
|
chestBlock.getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, chestBlock)) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -560,6 +592,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// -------------------------------
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -747,7 +780,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) // <- Geändert: Priorität erhöht und Cancel ignoriert
|
|
|
|
|
public void onSignChange(SignChangeEvent event) {
|
|
|
|
|
Player player = event.getPlayer();
|
|
|
|
|
UUID playerUUID = player.getUniqueId();
|
|
|
|
|
@@ -756,6 +789,8 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
|
|
|
|
|
// --- NEU: Sign Change für Rest-Truhe ---
|
|
|
|
|
if (lines.length >= 2 && lines[0].equalsIgnoreCase("[asc]") && lines[1].equalsIgnoreCase("rest")) {
|
|
|
|
|
event.setCancelled(false); // <- HIER: WorldGuard Cancel rückgängig machen
|
|
|
|
|
|
|
|
|
|
Block chestBlock = null;
|
|
|
|
|
if (signBlock.getBlockData() instanceof WallSign wallSign) {
|
|
|
|
|
Block attachedBlock = signBlock.getRelative(wallSign.getFacing().getOppositeFace());
|
|
|
|
|
@@ -776,11 +811,13 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
setRestChestLocation(playerUUID, chestBlock.getLocation());
|
|
|
|
|
player.sendMessage(getMessage("rest-chest-set"));
|
|
|
|
|
getLogger().info("Rest-Truhe für " + player.getName() + " gesetzt bei " + chestBlock.getLocation());
|
|
|
|
|
return; // Wichtig, damit nicht input/target Logik auch greift
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// -------------------------------
|
|
|
|
|
|
|
|
|
|
if (lines.length >= 2 && lines[0].equalsIgnoreCase("[asc]") && lines[1].equalsIgnoreCase("input")) {
|
|
|
|
|
event.setCancelled(false); // <- HIER: WorldGuard Cancel rückgängig machen
|
|
|
|
|
|
|
|
|
|
Block chestBlock = null;
|
|
|
|
|
if (signBlock.getBlockData() instanceof WallSign wallSign) {
|
|
|
|
|
Block attachedBlock = signBlock.getRelative(wallSign.getFacing().getOppositeFace());
|
|
|
|
|
@@ -977,18 +1014,23 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
Block chestBlock = clickedBlock;
|
|
|
|
|
Block signBlock = null;
|
|
|
|
|
|
|
|
|
|
// Suche Schild
|
|
|
|
|
// Suche Schild an beiden Hälften falls Doppeltruhe
|
|
|
|
|
List<Block> blocks = getChestBlocks((Chest) chestBlock.getState());
|
|
|
|
|
|
|
|
|
|
outerLoop:
|
|
|
|
|
for (Block b : blocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
chestBlock.getRelative(1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(-1, 0, 0),
|
|
|
|
|
chestBlock.getRelative(0, 0, 1),
|
|
|
|
|
chestBlock.getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, chestBlock)) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
if (lines.length >= 2 && ChatColor.stripColor((String) (lines[0] != null ? lines[0] : "")).equalsIgnoreCase("[asc]")) {
|
|
|
|
|
signBlock = face;
|
|
|
|
|
break;
|
|
|
|
|
break outerLoop; // Schild gefunden
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1160,13 +1202,18 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
|
|
|
|
|
// Fall 2: Truhe wird abgebaut
|
|
|
|
|
if (block.getState() instanceof Chest chestBlock) {
|
|
|
|
|
// Prüfe beide Hälften auf Schilder
|
|
|
|
|
List<Block> blocks = getChestBlocks(chestBlock);
|
|
|
|
|
|
|
|
|
|
outerLoop:
|
|
|
|
|
for (Block b : blocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
block.getRelative(1, 0, 0),
|
|
|
|
|
block.getRelative(-1, 0, 0),
|
|
|
|
|
block.getRelative(0, 0, 1),
|
|
|
|
|
block.getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, block)) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
if (lines.length >= 2 && ChatColor.stripColor((String) (lines[0] != null ? lines[0] : "")).equalsIgnoreCase("[asc]") &&
|
|
|
|
|
(ChatColor.stripColor((String) (lines[1] != null ? lines[1] : "")).equalsIgnoreCase("input") ||
|
|
|
|
|
@@ -1178,7 +1225,8 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
if (isDebug()) {
|
|
|
|
|
getLogger().fine("Truhe mit [asc]-Schild erkannt bei " + block.getLocation() + ", Schild bei " + face.getLocation() + ", Besitzer: " + signOwner);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
break outerLoop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1229,9 +1277,23 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
|
|
|
|
|
@EventHandler
|
|
|
|
|
public void onInventoryClose(InventoryCloseEvent event) {
|
|
|
|
|
if (!(event.getInventory().getHolder() instanceof Chest chest)) return;
|
|
|
|
|
InventoryHolder holder = event.getInventory().getHolder();
|
|
|
|
|
List<Chest> chestsToCheck = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
// FIX: Double Chest Handling
|
|
|
|
|
if (holder instanceof Chest) {
|
|
|
|
|
chestsToCheck.add((Chest) holder);
|
|
|
|
|
} else if (holder instanceof DoubleChest) {
|
|
|
|
|
DoubleChest dc = (DoubleChest) holder;
|
|
|
|
|
if (dc.getLeftSide() instanceof Chest) chestsToCheck.add((Chest) dc.getLeftSide());
|
|
|
|
|
if (dc.getRightSide() instanceof Chest) chestsToCheck.add((Chest) dc.getRightSide());
|
|
|
|
|
} else {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Player player = (Player) event.getPlayer();
|
|
|
|
|
|
|
|
|
|
for (Chest chest : chestsToCheck) {
|
|
|
|
|
Block chestBlock = chest.getBlock();
|
|
|
|
|
Block signBlock = null;
|
|
|
|
|
String signType = "target"; // default
|
|
|
|
|
@@ -1255,16 +1317,17 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (signBlock == null) {
|
|
|
|
|
if (isDebug()) getLogger().fine("Keine Zieltruhe/Rest-Truhe Schild an Truhe bei " + chestBlock.getLocation());
|
|
|
|
|
return;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sign sign = (Sign) signBlock.getState();
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String signOwner = ChatColor.stripColor((String) (lines[3] != null ? lines[3] : ""));
|
|
|
|
|
if (!signOwner.equalsIgnoreCase(player.getName())) {
|
|
|
|
|
if (isDebug()) getLogger().fine("Schild bei " + signBlock.getLocation() + " gehört nicht Spieler " + player.getName() + " (Besitzer: " + signOwner + ")");
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// FIX: Auch öffentliche Truhen updaten, nicht nur Owner
|
|
|
|
|
boolean isPublic = isChestPublic(sign);
|
|
|
|
|
if (!signOwner.equalsIgnoreCase(player.getName()) && !isPublic) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean isFull = isInventoryFull(chest.getInventory());
|
|
|
|
|
@@ -1288,6 +1351,7 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// --- HILFSMETHODE zum Entfernen alter Einträge ---
|
|
|
|
|
private void removeOldTargetEntry(UUID uuid, Location loc, String newItemType) {
|
|
|
|
|
@@ -1372,14 +1436,18 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
String signOwner = "Unbekannt";
|
|
|
|
|
Block signBlock = null;
|
|
|
|
|
|
|
|
|
|
// Sign Check erlaubt sowohl "ziel" als auch "rest"
|
|
|
|
|
// Sign Check erlaubt sowohl "ziel" als auch "rest" und prüft beide Hälften bei Doppeltruhen
|
|
|
|
|
List<Block> chestBlocks = getChestBlocks(targetChest);
|
|
|
|
|
|
|
|
|
|
outerLoop:
|
|
|
|
|
for (Block b : chestBlocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
targetChest.getBlock().getRelative(1, 0, 0),
|
|
|
|
|
targetChest.getBlock().getRelative(-1, 0, 0),
|
|
|
|
|
targetChest.getBlock().getRelative(0, 0, 1),
|
|
|
|
|
targetChest.getBlock().getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, targetChest.getBlock())) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -1399,13 +1467,14 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
if (isDebug()) {
|
|
|
|
|
getLogger().fine("Gültiges Zieltruhe-Schild gefunden bei " + face.getLocation() + " für Spieler " + player.getName());
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
break outerLoop;
|
|
|
|
|
}
|
|
|
|
|
} else if (isDebug()) {
|
|
|
|
|
getLogger().fine("Zieltruhe-Schild bei " + face.getLocation() + " hat ungültige Zeilen oder Typ passt nicht: [asc]=" + line0 + ", typ=" + line1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!isValidTarget) {
|
|
|
|
|
if (canSendFullChestMessage(playerUUID, item.getType())) {
|
|
|
|
|
@@ -1511,14 +1580,18 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
boolean isPublic = false;
|
|
|
|
|
String ownerName = "Unknown";
|
|
|
|
|
|
|
|
|
|
// Schild suchen und Status prüfen
|
|
|
|
|
// FIX: Suche Schild an beiden Hälften bei Doppeltruhen
|
|
|
|
|
List<Block> chestBlocks = getChestBlocks(chest);
|
|
|
|
|
|
|
|
|
|
outerLoop:
|
|
|
|
|
for (Block b : chestBlocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
chest.getBlock().getRelative(1, 0, 0),
|
|
|
|
|
chest.getBlock().getRelative(-1, 0, 0),
|
|
|
|
|
chest.getBlock().getRelative(0, 0, 1),
|
|
|
|
|
chest.getBlock().getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, chest.getBlock())) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -1530,7 +1603,8 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
|
|
|
|
|
isPublic = line3Clean.toLowerCase().endsWith("[public]");
|
|
|
|
|
ownerName = line3Clean.replace(" [Public]", "").replace(" [public]", "").trim();
|
|
|
|
|
break;
|
|
|
|
|
break outerLoop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1642,13 +1716,18 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
boolean isValidTarget = false;
|
|
|
|
|
Block signBlock = null;
|
|
|
|
|
|
|
|
|
|
// FIX: Suche Schild an beiden Hälften
|
|
|
|
|
List<Block> chestBlocks = getChestBlocks(targetChest);
|
|
|
|
|
|
|
|
|
|
outerLoop:
|
|
|
|
|
for (Block b : chestBlocks) {
|
|
|
|
|
for (Block face : new Block[] {
|
|
|
|
|
targetChest.getBlock().getRelative(1, 0, 0),
|
|
|
|
|
targetChest.getBlock().getRelative(-1, 0, 0),
|
|
|
|
|
targetChest.getBlock().getRelative(0, 0, 1),
|
|
|
|
|
targetChest.getBlock().getRelative(0, 0, -1)
|
|
|
|
|
b.getRelative(1, 0, 0),
|
|
|
|
|
b.getRelative(-1, 0, 0),
|
|
|
|
|
b.getRelative(0, 0, 1),
|
|
|
|
|
b.getRelative(0, 0, -1)
|
|
|
|
|
}) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, targetChest.getBlock())) {
|
|
|
|
|
if (face.getState() instanceof Sign sign && isSignAttachedToChest(face, b)) {
|
|
|
|
|
String[] lines = sign.getLines();
|
|
|
|
|
String line0 = ChatColor.stripColor((String) (lines[0] != null ? lines[0] : ""));
|
|
|
|
|
String line1 = ChatColor.stripColor((String) (lines[1] != null ? lines[1] : ""));
|
|
|
|
|
@@ -1663,7 +1742,8 @@ public class Main extends JavaPlugin implements Listener, CommandExecutor {
|
|
|
|
|
if (signOwnerName.equalsIgnoreCase(ownerName) || signOwnerName.equalsIgnoreCase("Unknown")) {
|
|
|
|
|
isValidTarget = true;
|
|
|
|
|
signBlock = face;
|
|
|
|
|
break;
|
|
|
|
|
break outerLoop;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|