Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 65f9621c84 | |||
| 68a4a670ee | |||
| bae5e29db3 | |||
| 137ba95a24 | |||
| a1e415d6f0 | |||
| b6b44d25c5 |
85
dependency-reduced-pom.xml
Normal file
85
dependency-reduced-pom.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>viper</groupId>
|
||||
<artifactId>ButtonControl</artifactId>
|
||||
<version>1.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.21-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- bStats Monitoring -->
|
||||
<dependency>
|
||||
<groupId>org.bstats</groupId>
|
||||
<artifactId>bstats-bukkit</artifactId>
|
||||
<version>3.0.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.10.1</version>
|
||||
<configuration>
|
||||
<source>${java.version}</source>
|
||||
<target>${java.version}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.4.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>org.bstats</pattern>
|
||||
<shadedPattern>de.viper.bstats</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
2
pom.xml
2
pom.xml
@@ -8,7 +8,7 @@
|
||||
|
||||
<groupId>viper</groupId>
|
||||
<artifactId>ButtonControl</artifactId>
|
||||
<version>1.3</version>
|
||||
<version>1.5</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>ButtonControl</name>
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import org.bukkit.Note.Tone;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -33,56 +35,98 @@ public class ButtonControl extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
// Initialisierung der Manager
|
||||
configManager = new ConfigManager(this);
|
||||
dataManager = new DataManager(this);
|
||||
|
||||
// Spigot Update Checker starten
|
||||
// Spigot Update Checker beim Serverstart ausführen
|
||||
new UpdateChecker(this, 127702).getVersion(version -> {
|
||||
String currentVersion = this.getDescription().getVersion();
|
||||
String normalizedLatest = version.replaceFirst("(?i)^(version\\s*|v\\.?\\s*)", "").trim();
|
||||
String normalizedCurrent = currentVersion.replaceFirst("(?i)^(version\\s*|v\\.?\\s*)", "").trim();
|
||||
|
||||
if (isNewerVersion(normalizedLatest, normalizedCurrent)) {
|
||||
getLogger().info("Neue Version verfügbar: " + version);
|
||||
getLogger().info("Download: https://www.spigotmc.org/resources/buttoncontrol.127702/");
|
||||
// Konsole bleibt sachlich
|
||||
getLogger().info("Update verfügbar: v" + version);
|
||||
|
||||
// Schicke die stylische Nachricht an Admins
|
||||
Bukkit.getScheduler().runTask(this, () -> {
|
||||
Bukkit.getOnlinePlayers().stream()
|
||||
.filter(p -> p.hasPermission("buttoncontrol.update"))
|
||||
.forEach(p -> {
|
||||
p.sendMessage("§6[ButtonControl] §eEine neue Version ist verfügbar: §f" + version);
|
||||
p.sendMessage("§6[ButtonControl] §eDownload: §fhttps://www.spigotmc.org/resources/buttoncontrol.127702/");
|
||||
p.sendMessage(""); // Leerzeile für Abstand
|
||||
p.sendMessage("§8§m-----------------------------------------");
|
||||
p.sendMessage(" §6§lButtonControl §7- §e§lUpdate verfügbar!");
|
||||
p.sendMessage("");
|
||||
p.sendMessage(" §7Aktuelle Version: §c" + currentVersion);
|
||||
p.sendMessage(" §7Neue Version: §a" + version);
|
||||
p.sendMessage("");
|
||||
p.sendMessage(" §eDownload hier:");
|
||||
p.sendMessage(" §bhttps://www.spigotmc.org/resources/127702/");
|
||||
p.sendMessage("§8§m-----------------------------------------");
|
||||
p.sendMessage("");
|
||||
});
|
||||
});
|
||||
} else {
|
||||
getLogger().info("Keine neue Version verfügbar.");
|
||||
getLogger().info("ButtonControl ist auf dem neuesten Stand (v" + currentVersion + ").");
|
||||
}
|
||||
});
|
||||
|
||||
// Listener für Spieler-Joins
|
||||
getServer().getPluginManager().registerEvents(new Listener() {
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
// Listener für Spieler-Joins (Update-Benachrichtigung beim Betreten des Servers)
|
||||
getServer().getPluginManager().registerEvents(new org.bukkit.event.Listener() {
|
||||
@org.bukkit.event.EventHandler
|
||||
public void onPlayerJoin(org.bukkit.event.player.PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (!player.hasPermission("buttoncontrol.update")) return;
|
||||
|
||||
new UpdateChecker(ButtonControl.this, 127702).getVersion(version -> {
|
||||
String currentVersion = getDescription().getVersion();
|
||||
String normalizedLatest = version.replaceFirst("(?i)^(version\\s*|v\\.?\\s*)", "").trim();
|
||||
String normalizedCurrent = currentVersion.replaceFirst("(?i)^(version\\s*|v\\.?\\s*)", "").trim();
|
||||
|
||||
if (isNewerVersion(normalizedLatest, normalizedCurrent)) {
|
||||
player.sendMessage("§6[ButtonControl] §eEine neue Version ist verfügbar: §f" + version);
|
||||
player.sendMessage("§6[ButtonControl] §eDownload: §fhttps://www.spigotmc.org/resources/buttoncontrol.127702/");
|
||||
// Stylische Box für den Spieler beim Joinen
|
||||
player.sendMessage("");
|
||||
player.sendMessage("§8§m-----------------------------------------");
|
||||
player.sendMessage(" §6§lButtonControl §7- §e§lUpdate verfügbar!");
|
||||
player.sendMessage("");
|
||||
player.sendMessage(" §7Aktuelle Version: §c" + currentVersion);
|
||||
player.sendMessage(" §7Neue Version: §a" + version);
|
||||
player.sendMessage("");
|
||||
player.sendMessage(" §eDownload hier:");
|
||||
player.sendMessage(" §bhttps://www.spigotmc.org/resources/127702/");
|
||||
player.sendMessage("§8§m-----------------------------------------");
|
||||
player.sendMessage("");
|
||||
}
|
||||
});
|
||||
}
|
||||
}, this);
|
||||
|
||||
// Konfiguration und Spielmechaniken laden
|
||||
updateConfigWithDefaults();
|
||||
|
||||
// --- COMMANDS & TAB-COMPLETER ---
|
||||
// Registriert den Executor (Befehlsverarbeitung) und den TabCompleter (Vorschläge)
|
||||
if (getCommand("bc") != null) {
|
||||
getCommand("bc").setExecutor(this); // 'this' setzt voraus, dass ButtonControl 'onCommand' enthält
|
||||
getCommand("bc").setTabCompleter(new ButtonTabCompleter());
|
||||
}
|
||||
|
||||
// Event-Listener registrieren
|
||||
getServer().getPluginManager().registerEvents(new ButtonListener(this, configManager, dataManager), this);
|
||||
|
||||
// Rezepte und bStats/Metrics
|
||||
registerRecipes();
|
||||
getServer().getScheduler().runTaskTimer(this, this::checkDaylightSensors, 0L, 20L * 10);
|
||||
getServer().getScheduler().runTaskTimer(this, this::checkMotionSensors, 0L, 10L);
|
||||
MetricsHandler.startMetrics(this);
|
||||
|
||||
// --- AUTOMATISIERUNG-TIMER ---
|
||||
// Daylight Sensoren: Prüfung alle 200 Ticks (10 Sekunden)
|
||||
getServer().getScheduler().runTaskTimer(this, this::checkDaylightSensors, 0L, 20L * 10);
|
||||
|
||||
// Bewegungsmelder (Motion Sensors): Prüfung alle 10 Ticks (0.5 Sekunden) für flüssige Erkennung
|
||||
getServer().getScheduler().runTaskTimer(this, this::checkMotionSensors, 0L, 10L);
|
||||
|
||||
getLogger().info("ButtonControl v" + getDescription().getVersion() + " wurde erfolgreich aktiviert!");
|
||||
}
|
||||
|
||||
private boolean isNewerVersion(String latest, String current) {
|
||||
@@ -123,25 +167,44 @@ public class ButtonControl extends JavaPlugin {
|
||||
}
|
||||
|
||||
private void registerRecipes() {
|
||||
ItemStack controlButton = new ItemStack(Material.STONE_BUTTON);
|
||||
// --- 1. Dynamische Steuer-Buttons für JEDE Holz/Stein-Art ---
|
||||
for (Material mat : Material.values()) {
|
||||
if (mat.name().endsWith("_BUTTON")) {
|
||||
// Wir erstellen für jeden Button-Typ ein eigenes Ergebnis
|
||||
ItemStack controlButton = new ItemStack(mat);
|
||||
ItemMeta buttonMeta = controlButton.getItemMeta();
|
||||
if (buttonMeta != null) {
|
||||
buttonMeta.setDisplayName("§6Steuer-Button");
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§7Ein universeller Controller für");
|
||||
lore.add("§7Türen, Lampen und mehr.");
|
||||
buttonMeta.setLore(lore);
|
||||
controlButton.setItemMeta(buttonMeta);
|
||||
}
|
||||
|
||||
NamespacedKey buttonKey = new NamespacedKey(this, "control_button");
|
||||
ShapedRecipe buttonRecipe = new ShapedRecipe(buttonKey, controlButton);
|
||||
buttonRecipe.shape("123", "456", "789");
|
||||
buttonRecipe.setIngredient('2', Material.STONE_BUTTON);
|
||||
buttonRecipe.setIngredient('5', Material.STONE_BUTTON);
|
||||
buttonRecipe.setIngredient('8', Material.STONE_BUTTON);
|
||||
Bukkit.addRecipe(buttonRecipe);
|
||||
// Wir brauchen für jedes Material einen eindeutigen Key (z.B. control_button_oak_button)
|
||||
NamespacedKey key = new NamespacedKey(this, "control_" + mat.name().toLowerCase());
|
||||
if (Bukkit.getRecipe(key) != null) Bukkit.removeRecipe(key);
|
||||
|
||||
ShapedRecipe recipe = new ShapedRecipe(key, controlButton);
|
||||
recipe.shape("123", "456", "789");
|
||||
// Das Material muss an allen drei Stellen gleich sein (z.B. 3x Eiche)
|
||||
recipe.setIngredient('2', mat);
|
||||
recipe.setIngredient('5', mat);
|
||||
recipe.setIngredient('8', mat);
|
||||
Bukkit.addRecipe(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
// --- 2. Steuer-Tageslichtsensor Rezept ---
|
||||
ItemStack controlDaylight = new ItemStack(Material.DAYLIGHT_DETECTOR);
|
||||
ItemMeta daylightMeta = controlDaylight.getItemMeta();
|
||||
if (daylightMeta != null) {
|
||||
daylightMeta.setDisplayName("§6Steuer-Tageslichtsensor");
|
||||
controlDaylight.setItemMeta(daylightMeta);
|
||||
|
||||
}
|
||||
NamespacedKey daylightKey = new NamespacedKey(this, "control_daylight");
|
||||
if (Bukkit.getRecipe(daylightKey) != null) Bukkit.removeRecipe(daylightKey);
|
||||
ShapedRecipe daylightRecipe = new ShapedRecipe(daylightKey, controlDaylight);
|
||||
daylightRecipe.shape("123", "456", "789");
|
||||
daylightRecipe.setIngredient('2', Material.DAYLIGHT_DETECTOR);
|
||||
@@ -149,12 +212,15 @@ public class ButtonControl extends JavaPlugin {
|
||||
daylightRecipe.setIngredient('8', Material.DAYLIGHT_DETECTOR);
|
||||
Bukkit.addRecipe(daylightRecipe);
|
||||
|
||||
// --- 3. Steuer-Notenblock Rezept ---
|
||||
ItemStack controlNoteBlock = new ItemStack(Material.NOTE_BLOCK);
|
||||
ItemMeta noteBlockMeta = controlNoteBlock.getItemMeta();
|
||||
if (noteBlockMeta != null) {
|
||||
noteBlockMeta.setDisplayName("§6Steuer-Notenblock");
|
||||
controlNoteBlock.setItemMeta(noteBlockMeta);
|
||||
|
||||
}
|
||||
NamespacedKey noteBlockKey = new NamespacedKey(this, "control_noteblock");
|
||||
if (Bukkit.getRecipe(noteBlockKey) != null) Bukkit.removeRecipe(noteBlockKey);
|
||||
ShapedRecipe noteBlockRecipe = new ShapedRecipe(noteBlockKey, controlNoteBlock);
|
||||
noteBlockRecipe.shape("123", "456", "789");
|
||||
noteBlockRecipe.setIngredient('2', Material.NOTE_BLOCK);
|
||||
@@ -162,19 +228,22 @@ public class ButtonControl extends JavaPlugin {
|
||||
noteBlockRecipe.setIngredient('8', Material.NOTE_BLOCK);
|
||||
Bukkit.addRecipe(noteBlockRecipe);
|
||||
|
||||
// --- 4. Steuer-Bewegungsmelder Rezept ---
|
||||
ItemStack controlMotion = new ItemStack(Material.TRIPWIRE_HOOK);
|
||||
ItemMeta motionMeta = controlMotion.getItemMeta();
|
||||
if (motionMeta != null) {
|
||||
motionMeta.setDisplayName("§6Steuer-Bewegungsmelder");
|
||||
controlMotion.setItemMeta(motionMeta);
|
||||
|
||||
}
|
||||
NamespacedKey motionKey = new NamespacedKey(this, "control_motion");
|
||||
if (Bukkit.getRecipe(motionKey) != null) Bukkit.removeRecipe(motionKey);
|
||||
ShapedRecipe motionRecipe = new ShapedRecipe(motionKey, controlMotion);
|
||||
motionRecipe.shape("123", "456", "789");
|
||||
motionRecipe.setIngredient('2', Material.TRIPWIRE_HOOK);
|
||||
motionRecipe.setIngredient('5', Material.TRIPWIRE_HOOK);
|
||||
motionRecipe.setIngredient('8', Material.TRIPWIRE_HOOK);
|
||||
Bukkit.addRecipe(motionRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
public void checkDaylightSensors() {
|
||||
List<String> allControllers = dataManager.getAllPlacedControllers();
|
||||
@@ -182,16 +251,8 @@ public class ButtonControl extends JavaPlugin {
|
||||
String buttonId = dataManager.getButtonIdForPlacedController(controllerLoc);
|
||||
if (buttonId == null) continue;
|
||||
|
||||
String[] parts = controllerLoc.split(",");
|
||||
if (parts.length != 4) continue;
|
||||
|
||||
World world = getServer().getWorld(parts[0]);
|
||||
if (world == null) continue;
|
||||
|
||||
Location loc = new Location(world,
|
||||
Integer.parseInt(parts[1]),
|
||||
Integer.parseInt(parts[2]),
|
||||
Integer.parseInt(parts[3]));
|
||||
Location loc = parseLocation(controllerLoc);
|
||||
if (loc == null) continue;
|
||||
|
||||
Block block = loc.getBlock();
|
||||
if (block.getType() != Material.DAYLIGHT_DETECTOR) continue;
|
||||
@@ -203,19 +264,10 @@ public class ButtonControl extends JavaPlugin {
|
||||
if (connectedBlocks == null) continue;
|
||||
|
||||
for (String targetLocStr : connectedBlocks) {
|
||||
String[] targetParts = targetLocStr.split(",");
|
||||
if (targetParts.length != 4) continue;
|
||||
|
||||
World targetWorld = getServer().getWorld(targetParts[0]);
|
||||
if (targetWorld == null) continue;
|
||||
|
||||
Location targetLoc = new Location(targetWorld,
|
||||
Integer.parseInt(targetParts[1]),
|
||||
Integer.parseInt(targetParts[2]),
|
||||
Integer.parseInt(targetParts[3]));
|
||||
Location targetLoc = parseLocation(targetLocStr);
|
||||
if (targetLoc == null) continue;
|
||||
|
||||
Block targetBlock = targetLoc.getBlock();
|
||||
|
||||
if (targetBlock.getType() == Material.REDSTONE_LAMP) {
|
||||
Lightable lamp = (Lightable) targetBlock.getBlockData();
|
||||
lamp.setLit(!isDay);
|
||||
@@ -229,16 +281,8 @@ public class ButtonControl extends JavaPlugin {
|
||||
long now = System.currentTimeMillis();
|
||||
List<String> allControllers = dataManager.getAllPlacedControllers();
|
||||
for (String controllerLoc : allControllers) {
|
||||
String[] parts = controllerLoc.split(",");
|
||||
if (parts.length != 4) continue;
|
||||
|
||||
World world = getServer().getWorld(parts[0]);
|
||||
if (world == null) continue;
|
||||
|
||||
Location loc = new Location(world,
|
||||
Integer.parseInt(parts[1]),
|
||||
Integer.parseInt(parts[2]),
|
||||
Integer.parseInt(parts[3]));
|
||||
Location loc = parseLocation(controllerLoc);
|
||||
if (loc == null) continue;
|
||||
|
||||
Block block = loc.getBlock();
|
||||
if (block.getType() != Material.TRIPWIRE_HOOK) continue;
|
||||
@@ -246,15 +290,15 @@ public class ButtonControl extends JavaPlugin {
|
||||
String buttonId = dataManager.getButtonIdForPlacedController(controllerLoc);
|
||||
if (buttonId == null) continue;
|
||||
|
||||
// Individuelle Einstellungen für diesen Bewegungsmelder
|
||||
double radius = dataManager.getMotionSensorRadius(controllerLoc);
|
||||
if (radius == -1) radius = configManager.getConfig().getDouble("motion-detection-radius", 5.0);
|
||||
|
||||
long delay = dataManager.getMotionSensorDelay(controllerLoc);
|
||||
if (delay == -1) delay = configManager.getConfig().getLong("motion-close-delay-ms", 5000L);
|
||||
|
||||
boolean detected = !world.getNearbyEntities(loc, radius, radius, radius, e -> e instanceof Player).isEmpty();
|
||||
|
||||
boolean detected = !loc.getWorld().getNearbyEntities(loc, radius, radius, radius, e -> e instanceof Player).isEmpty();
|
||||
List<String> connectedBlocks = dataManager.getConnectedBlocks(buttonId);
|
||||
|
||||
if (connectedBlocks == null || connectedBlocks.isEmpty()) continue;
|
||||
|
||||
if (detected) {
|
||||
@@ -272,19 +316,10 @@ public class ButtonControl extends JavaPlugin {
|
||||
|
||||
private void setOpenables(List<String> connectedBlocks, boolean open) {
|
||||
for (String targetLocStr : connectedBlocks) {
|
||||
String[] targetParts = targetLocStr.split(",");
|
||||
if (targetParts.length != 4) continue;
|
||||
|
||||
World targetWorld = getServer().getWorld(targetParts[0]);
|
||||
if (targetWorld == null) continue;
|
||||
|
||||
Location targetLoc = new Location(targetWorld,
|
||||
Integer.parseInt(targetParts[1]),
|
||||
Integer.parseInt(targetParts[2]),
|
||||
Integer.parseInt(targetParts[3]));
|
||||
Location targetLoc = parseLocation(targetLocStr);
|
||||
if (targetLoc == null) continue;
|
||||
|
||||
Block targetBlock = targetLoc.getBlock();
|
||||
|
||||
if (targetBlock.getBlockData() instanceof org.bukkit.block.data.Openable) {
|
||||
org.bukkit.block.data.Openable openable = (org.bukkit.block.data.Openable) targetBlock.getBlockData();
|
||||
openable.setOpen(open);
|
||||
@@ -293,6 +328,18 @@ public class ButtonControl extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
private Location parseLocation(String locStr) {
|
||||
String[] parts = locStr.split(",");
|
||||
if (parts.length != 4) return null;
|
||||
World world = getServer().getWorld(parts[0]);
|
||||
if (world == null) return null;
|
||||
try {
|
||||
return new Location(world, Integer.parseInt(parts[1]), Integer.parseInt(parts[2]), Integer.parseInt(parts[3]));
|
||||
} catch (NumberFormatException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void playDoorbellSound(Location loc, String instrument) {
|
||||
Block block = loc.getBlock();
|
||||
if (block.getType() != Material.NOTE_BLOCK) return;
|
||||
@@ -321,22 +368,22 @@ public class ButtonControl extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (command.getName().equalsIgnoreCase("bc")) {
|
||||
if (!command.getName().equalsIgnoreCase("bc")) return false;
|
||||
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("§6[ButtonControl] §7Verwende: /bc <info|reload|note>");
|
||||
sender.sendMessage("§6[ButtonControl] §7Verwende: /bc <info|reload|note|trust|untrust|public|private>");
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- INFO BEFEHL ---
|
||||
if (args[0].equalsIgnoreCase("info")) {
|
||||
sender.sendMessage("§6[ButtonControl] §7Informationen zum Plugin:");
|
||||
sender.sendMessage("§eVersion: §f" + getDescription().getVersion());
|
||||
sender.sendMessage("§eErsteller: §fM_Viper");
|
||||
sender.sendMessage("§ePlugin: §fButtonControl");
|
||||
sender.sendMessage("§eGetestet für Minecraft: §f1.21.5 - 1.21.8");
|
||||
sender.sendMessage("§eWeitere Infos: §fTüren, Lampen & Notenblöcke mit Buttons oder Tageslichtsensoren steuern");
|
||||
sender.sendMessage("§6§lButtonControl §7- v" + getDescription().getVersion());
|
||||
sender.sendMessage("§eAuthor: §fM_Viper");
|
||||
sender.sendMessage("§eFeatures: §fTüren, Lampen, Notenblöcke, Sensoren");
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- RELOAD BEFEHL ---
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
if (!sender.hasPermission("buttoncontrol.reload")) {
|
||||
sender.sendMessage(configManager.getMessage("keine-berechtigung"));
|
||||
@@ -345,34 +392,92 @@ public class ButtonControl extends JavaPlugin {
|
||||
configManager.reloadConfig();
|
||||
updateConfigWithDefaults();
|
||||
dataManager.reloadData();
|
||||
sender.sendMessage(configManager.getMessage("konfiguration-reloaded"));
|
||||
sender.sendMessage(configManager.getMessage("konfiguration-neugeladen"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// --- NOTE BEFEHL ---
|
||||
if (args[0].equalsIgnoreCase("note") && sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (!player.hasPermission("buttoncontrol.note")) {
|
||||
player.sendMessage(configManager.getMessage("keine-berechtigung"));
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§6[ButtonControl] §7Verwende: /bc note <Instrument>");
|
||||
return true;
|
||||
}
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage("§6[ButtonControl] §7Verwende: /bc note <Instrument>");
|
||||
sender.sendMessage("§7Verfügbare Instrumente: PIANO, BASS_DRUM, SNARE, STICKS, BASS_GUITAR, FLUTE, BELL, GUITAR, CHIME, XYLOPHONE, etc.");
|
||||
try {
|
||||
org.bukkit.Instrument.valueOf(args[1].toUpperCase());
|
||||
dataManager.setPlayerInstrument(player.getUniqueId(), args[1].toUpperCase());
|
||||
player.sendMessage(String.format(configManager.getMessage("instrument-gesetzt"), args[1].toUpperCase()));
|
||||
} catch (Exception e) {
|
||||
player.sendMessage(configManager.getMessage("ungueltiges-instrument"));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
String instrument = args[1].toUpperCase();
|
||||
try {
|
||||
org.bukkit.Instrument.valueOf(instrument);
|
||||
dataManager.setPlayerInstrument(player.getUniqueId(), instrument);
|
||||
sender.sendMessage(String.format(configManager.getMessage("instrument-gesetzt"), instrument));
|
||||
} catch (IllegalArgumentException e) {
|
||||
sender.sendMessage(configManager.getMessage("ungueltiges-instrument"));
|
||||
// --- TRUST / PUBLIC / PRIVATE SYSTEM ---
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
if (args[0].equalsIgnoreCase("trust") || args[0].equalsIgnoreCase("untrust") ||
|
||||
args[0].equalsIgnoreCase("public") || args[0].equalsIgnoreCase("private")) {
|
||||
|
||||
Block target = player.getTargetBlockExact(5);
|
||||
|
||||
// Erkennt nun Stein- und alle Holzbuttons sowie Sensoren
|
||||
if (target == null || (!target.getType().name().endsWith("_BUTTON") &&
|
||||
target.getType() != Material.DAYLIGHT_DETECTOR &&
|
||||
target.getType() != Material.TRIPWIRE_HOOK)) {
|
||||
|
||||
player.sendMessage(configManager.getMessage("kein-controller-im-blick"));
|
||||
return true;
|
||||
}
|
||||
|
||||
String targetLoc = target.getWorld().getName() + "," + target.getX() + "," + target.getY() + "," + target.getZ();
|
||||
String buttonId = dataManager.getButtonIdForLocation(targetLoc);
|
||||
|
||||
if (buttonId == null) {
|
||||
player.sendMessage(configManager.getMessage("keine-bloecke-verbunden"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!dataManager.isOwner(buttonId, player.getUniqueId())) {
|
||||
player.sendMessage(configManager.getMessage("nur-besitzer-abbauen"));
|
||||
return true;
|
||||
}
|
||||
|
||||
// Spieler hinzufügen
|
||||
if (args[0].equalsIgnoreCase("trust")) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§6[ButtonControl] §7Verwende: /bc trust <Spieler>");
|
||||
return true;
|
||||
}
|
||||
Player targetPlayer = Bukkit.getPlayer(args[1]);
|
||||
if (targetPlayer == null) {
|
||||
player.sendMessage(configManager.getMessage("spieler-nicht-gefunden"));
|
||||
return true;
|
||||
}
|
||||
dataManager.addTrustedPlayer(buttonId, targetPlayer.getUniqueId());
|
||||
player.sendMessage(String.format(configManager.getMessage("trust-hinzugefuegt"), targetPlayer.getName()));
|
||||
}
|
||||
// Spieler entfernen
|
||||
else if (args[0].equalsIgnoreCase("untrust")) {
|
||||
if (args.length < 2) {
|
||||
player.sendMessage("§6[ButtonControl] §7Verwende: /bc untrust <Spieler>");
|
||||
return true;
|
||||
}
|
||||
UUID targetUUID = Bukkit.getOfflinePlayer(args[1]).getUniqueId();
|
||||
dataManager.removeTrustedPlayer(buttonId, targetUUID);
|
||||
player.sendMessage(String.format(configManager.getMessage("trust-entfernt"), args[1]));
|
||||
}
|
||||
// Status umschalten (Public) oder erzwingen (Private)
|
||||
else if (args[0].equalsIgnoreCase("public") || args[0].equalsIgnoreCase("private")) {
|
||||
boolean newState = args[0].equalsIgnoreCase("public") ? !dataManager.isPublic(buttonId) : false;
|
||||
dataManager.setPublic(buttonId, newState);
|
||||
String statusColor = newState ? "§aÖffentlich" : "§cPrivat";
|
||||
player.sendMessage(String.format(configManager.getMessage("status-geandert"), statusColor));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public ConfigManager getConfigManager() {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package viper;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.Openable;
|
||||
import org.bukkit.block.data.Lightable;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
@@ -31,43 +33,101 @@ public class ButtonListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||
String playerUUID = event.getPlayer().getUniqueId().toString();
|
||||
Player player = event.getPlayer();
|
||||
UUID playerUUID = player.getUniqueId();
|
||||
ItemStack item = event.getItem();
|
||||
Block block = event.getClickedBlock();
|
||||
|
||||
// Block wird gesteuert (Button, Tageslichtsensor oder Bewegungsmelder)
|
||||
// 1. Logik für bereits platzierte Controller (Benutzung)
|
||||
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && block != null) {
|
||||
String blockLocation = block.getWorld().getName() + "," + block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
String buttonId = dataManager.getButtonIdForPlacedController(playerUUID, blockLocation);
|
||||
String buttonId = dataManager.getButtonIdForLocation(blockLocation);
|
||||
|
||||
if (buttonId != null) {
|
||||
if (!dataManager.canAccess(buttonId, playerUUID)) {
|
||||
player.sendMessage(configManager.getMessage("keine-berechtigung-controller"));
|
||||
event.setCancelled(true);
|
||||
// Bewegungsmelder: GUI öffnen
|
||||
if (block.getType() == Material.TRIPWIRE_HOOK) {
|
||||
new MotionSensorGUI(plugin, event.getPlayer(), blockLocation, buttonId).open();
|
||||
return;
|
||||
}
|
||||
// Button oder Tageslichtsensor: Normale Steuerung
|
||||
if (block.getType() == Material.STONE_BUTTON || block.getType() == Material.DAYLIGHT_DETECTOR) {
|
||||
List<String> connectedBlocks = dataManager.getConnectedBlocks(playerUUID, buttonId);
|
||||
|
||||
if (block.getType() == Material.TRIPWIRE_HOOK) {
|
||||
event.setCancelled(true);
|
||||
new MotionSensorGUI(plugin, player, blockLocation, buttonId).open();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isButton(block.getType()) || block.getType() == Material.DAYLIGHT_DETECTOR) {
|
||||
List<String> connectedBlocks = dataManager.getConnectedBlocks(buttonId);
|
||||
|
||||
if (connectedBlocks != null && !connectedBlocks.isEmpty()) {
|
||||
boolean anyDoorOpened = false;
|
||||
boolean anyDoorClosed = false;
|
||||
boolean anyGateOpened = false;
|
||||
boolean anyGateClosed = false;
|
||||
boolean anyTrapOpened = false;
|
||||
boolean anyTrapClosed = false;
|
||||
boolean anyLampOn = false;
|
||||
boolean anyLampOff = false;
|
||||
toggleConnectedBlocks(player, playerUUID, connectedBlocks);
|
||||
} else {
|
||||
player.sendMessage(configManager.getMessage("keine-bloecke-verbunden"));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Logik für das Verbinden von neuen Blöcken (Item in der Hand)
|
||||
if (item == null || !item.hasItemMeta() || !item.getItemMeta().getDisplayName().contains("§6Steuer-")) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || block == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isInteractableTarget(block.getType())) {
|
||||
event.setCancelled(true);
|
||||
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
String buttonId = null;
|
||||
|
||||
// ID aus der Lore extrahieren (wir suchen nach dem Präfix §8ID: )
|
||||
if (meta != null && meta.hasLore() && !meta.getLore().isEmpty()) {
|
||||
String firstLine = meta.getLore().get(0);
|
||||
if (firstLine.startsWith("§8ID: ")) {
|
||||
buttonId = firstLine.replace("§8ID: ", "");
|
||||
}
|
||||
}
|
||||
|
||||
// Falls keine ID existiert (neues Item), generieren und SOFORT speichern
|
||||
if (buttonId == null) {
|
||||
buttonId = UUID.randomUUID().toString();
|
||||
updateButtonLore(item, buttonId);
|
||||
}
|
||||
|
||||
List<String> connectedBlocks = dataManager.getConnectedBlocks(buttonId);
|
||||
if (connectedBlocks == null) {
|
||||
connectedBlocks = new ArrayList<>();
|
||||
}
|
||||
|
||||
String blockLocation = block.getWorld().getName() + "," + block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
if (connectedBlocks.contains(blockLocation)) {
|
||||
player.sendMessage(configManager.getMessage("block-bereits-verbunden"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (checkLimits(player, block.getType(), connectedBlocks)) {
|
||||
connectedBlocks.add(blockLocation);
|
||||
dataManager.setConnectedBlocks(playerUUID.toString(), buttonId, connectedBlocks);
|
||||
player.sendMessage(configManager.getMessage("block-verbunden"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleConnectedBlocks(Player player, UUID playerUUID, List<String> connectedBlocks) {
|
||||
boolean anyDoorOpened = false, anyDoorClosed = false;
|
||||
boolean anyGateOpened = false, anyGateClosed = false;
|
||||
boolean anyTrapOpened = false, anyTrapClosed = false;
|
||||
boolean anyLampOn = false, anyLampOff = false;
|
||||
boolean anyNoteBlockPlayed = false;
|
||||
boolean anyBellPlayed = false;
|
||||
|
||||
for (String loc : connectedBlocks) {
|
||||
String[] parts = loc.split(",");
|
||||
Location location = new Location(plugin.getServer().getWorld(parts[0]),
|
||||
Integer.parseInt(parts[1]),
|
||||
Integer.parseInt(parts[2]),
|
||||
Integer.parseInt(parts[3]));
|
||||
for (String locStr : connectedBlocks) {
|
||||
Location location = parseLocation(locStr);
|
||||
if (location == null) continue;
|
||||
Block targetBlock = location.getBlock();
|
||||
|
||||
if (isDoor(targetBlock.getType()) || isGate(targetBlock.getType()) || isTrapdoor(targetBlock.getType())) {
|
||||
@@ -85,192 +145,151 @@ public class ButtonListener implements Listener {
|
||||
if (!wasOpen) anyTrapOpened = true; else anyTrapClosed = true;
|
||||
}
|
||||
}
|
||||
} else if (targetBlock.getType() == Material.REDSTONE_LAMP) {
|
||||
}
|
||||
else if (targetBlock.getType() == Material.REDSTONE_LAMP) {
|
||||
Lightable lamp = (Lightable) targetBlock.getBlockData();
|
||||
boolean wasLit = lamp.isLit();
|
||||
lamp.setLit(!wasLit);
|
||||
targetBlock.setBlockData(lamp);
|
||||
if (!wasLit) anyLampOn = true; else anyLampOff = true;
|
||||
} else if (targetBlock.getType() == Material.NOTE_BLOCK) {
|
||||
String instrument = dataManager.getPlayerInstrument(event.getPlayer().getUniqueId());
|
||||
}
|
||||
else if (targetBlock.getType() == Material.NOTE_BLOCK) {
|
||||
String instrument = dataManager.getPlayerInstrument(playerUUID);
|
||||
if (instrument == null) {
|
||||
instrument = configManager.getConfig().getString("default-note", "PIANO");
|
||||
}
|
||||
plugin.playDoorbellSound(location, instrument);
|
||||
anyNoteBlockPlayed = true;
|
||||
} else if (targetBlock.getType() == Material.BELL) {
|
||||
}
|
||||
else if (targetBlock.getType() == Material.BELL) {
|
||||
targetBlock.getWorld().playSound(location, org.bukkit.Sound.BLOCK_BELL_USE, 3.0f, 1.0f);
|
||||
anyBellPlayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (anyDoorOpened) event.getPlayer().sendMessage(configManager.getMessage("tueren-geoeffnet"));
|
||||
if (anyDoorClosed) event.getPlayer().sendMessage(configManager.getMessage("tueren-geschlossen"));
|
||||
if (anyGateOpened) event.getPlayer().sendMessage(configManager.getMessage("gates-geoeffnet"));
|
||||
if (anyGateClosed) event.getPlayer().sendMessage(configManager.getMessage("gates-geschlossen"));
|
||||
if (anyTrapOpened) event.getPlayer().sendMessage(configManager.getMessage("fallturen-geoeffnet"));
|
||||
if (anyTrapClosed) event.getPlayer().sendMessage(configManager.getMessage("fallturen-geschlossen"));
|
||||
if (anyLampOn) event.getPlayer().sendMessage(configManager.getMessage("lampen-eingeschaltet"));
|
||||
if (anyLampOff) event.getPlayer().sendMessage(configManager.getMessage("lampen-ausgeschaltet"));
|
||||
if (anyNoteBlockPlayed) event.getPlayer().sendMessage(configManager.getMessage("notenblock-ausgeloest"));
|
||||
if (anyBellPlayed) event.getPlayer().sendMessage(configManager.getMessage("glocke-gelaeutet"));
|
||||
} else {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("keine-bloecke-verbunden"));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (anyDoorOpened) player.sendMessage(configManager.getMessage("tueren-geoeffnet"));
|
||||
if (anyDoorClosed) player.sendMessage(configManager.getMessage("tueren-geschlossen"));
|
||||
if (anyGateOpened) player.sendMessage(configManager.getMessage("gates-geoeffnet"));
|
||||
if (anyGateClosed) player.sendMessage(configManager.getMessage("gates-geschlossen"));
|
||||
if (anyTrapOpened) player.sendMessage(configManager.getMessage("fallturen-geoeffnet"));
|
||||
if (anyTrapClosed) player.sendMessage(configManager.getMessage("fallturen-geschlossen"));
|
||||
if (anyLampOn) player.sendMessage(configManager.getMessage("lampen-eingeschaltet"));
|
||||
if (anyLampOff) player.sendMessage(configManager.getMessage("lampen-ausgeschaltet"));
|
||||
if (anyNoteBlockPlayed) player.sendMessage(configManager.getMessage("notenblock-ausgeloest"));
|
||||
if (anyBellPlayed) player.sendMessage(configManager.getMessage("glocke-gelaeutet"));
|
||||
}
|
||||
|
||||
// Verbindung herstellen
|
||||
if (item == null || (!item.getType().equals(Material.STONE_BUTTON) &&
|
||||
!item.getType().equals(Material.DAYLIGHT_DETECTOR) &&
|
||||
!item.getType().equals(Material.NOTE_BLOCK) &&
|
||||
!item.getType().equals(Material.TRIPWIRE_HOOK))) {
|
||||
return;
|
||||
private boolean checkLimits(Player player, Material type, List<String> connected) {
|
||||
if (isDoor(type)) {
|
||||
if (connected.stream().filter(l -> isDoor(getMaterialFromLocation(l))).count() >= configManager.getMaxDoors()) {
|
||||
player.sendMessage(configManager.getMessage("max-tueren-erreicht"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!item.hasItemMeta() || !item.getItemMeta().getDisplayName().contains("§6Steuer-")) {
|
||||
return;
|
||||
} else if (isGate(type)) {
|
||||
if (connected.stream().filter(l -> isGate(getMaterialFromLocation(l))).count() >= configManager.getMaxGates()) {
|
||||
player.sendMessage(configManager.getMessage("max-gates-erreicht"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK || block == null) {
|
||||
return;
|
||||
} else if (isTrapdoor(type)) {
|
||||
if (connected.stream().filter(l -> isTrapdoor(getMaterialFromLocation(l))).count() >= configManager.getMaxTrapdoors()) {
|
||||
player.sendMessage(configManager.getMessage("max-fallturen-erreicht"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isDoor(block.getType()) || isGate(block.getType()) || isTrapdoor(block.getType()) ||
|
||||
block.getType() == Material.REDSTONE_LAMP ||
|
||||
block.getType() == Material.NOTE_BLOCK ||
|
||||
block.getType() == Material.BELL) {
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
String buttonId = item.getItemMeta().hasLore() ? item.getItemMeta().getLore().get(0) : UUID.randomUUID().toString();
|
||||
List<String> connectedBlocks = dataManager.getConnectedBlocks(playerUUID, buttonId);
|
||||
if (connectedBlocks == null) {
|
||||
connectedBlocks = new ArrayList<>();
|
||||
} else if (type == Material.REDSTONE_LAMP) {
|
||||
if (connected.stream().filter(l -> getMaterialFromLocation(l) == Material.REDSTONE_LAMP).count() >= configManager.getMaxLamps()) {
|
||||
player.sendMessage(configManager.getMessage("max-lampen-erreicht"));
|
||||
return false;
|
||||
}
|
||||
|
||||
int maxDoors = configManager.getMaxDoors();
|
||||
int maxGates = configManager.getMaxDoors();
|
||||
int maxTraps = configManager.getMaxDoors();
|
||||
int maxLamps = configManager.getMaxLamps();
|
||||
int maxNoteBlocks = configManager.getMaxNoteBlocks();
|
||||
int maxBells = configManager.getMaxBells();
|
||||
|
||||
int doorCount = (int) connectedBlocks.stream().filter(loc -> isDoor(getMaterialFromLocation(loc))).count();
|
||||
int gateCount = (int) connectedBlocks.stream().filter(loc -> isGate(getMaterialFromLocation(loc))).count();
|
||||
int trapCount = (int) connectedBlocks.stream().filter(loc -> isTrapdoor(getMaterialFromLocation(loc))).count();
|
||||
int lampCount = (int) connectedBlocks.stream().filter(loc -> getMaterialFromLocation(loc) == Material.REDSTONE_LAMP).count();
|
||||
int noteBlockCount = (int) connectedBlocks.stream().filter(loc -> getMaterialFromLocation(loc) == Material.NOTE_BLOCK).count();
|
||||
int bellCount = (int) connectedBlocks.stream().filter(loc -> getMaterialFromLocation(loc) == Material.BELL).count();
|
||||
|
||||
if (isDoor(block.getType()) && doorCount >= maxDoors) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-tueren-erreicht"));
|
||||
return;
|
||||
} else if (type == Material.NOTE_BLOCK) {
|
||||
if (connected.stream().filter(l -> getMaterialFromLocation(l) == Material.NOTE_BLOCK).count() >= configManager.getMaxNoteBlocks()) {
|
||||
player.sendMessage(configManager.getMessage("max-notenbloecke-erreicht"));
|
||||
return false;
|
||||
}
|
||||
if (isGate(block.getType()) && gateCount >= maxGates) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-gates-erreicht"));
|
||||
return;
|
||||
}
|
||||
if (isTrapdoor(block.getType()) && trapCount >= maxTraps) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-fallturen-erreicht"));
|
||||
return;
|
||||
}
|
||||
if (block.getType() == Material.REDSTONE_LAMP && lampCount >= maxLamps) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-lampen-erreicht"));
|
||||
return;
|
||||
}
|
||||
if (block.getType() == Material.NOTE_BLOCK && noteBlockCount >= maxNoteBlocks) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-notenbloecke-erreicht"));
|
||||
return;
|
||||
}
|
||||
if (block.getType() == Material.BELL && bellCount >= maxBells) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("max-glocken-erreicht"));
|
||||
return;
|
||||
}
|
||||
|
||||
String blockLocation = block.getWorld().getName() + "," + block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
if (!connectedBlocks.contains(blockLocation)) {
|
||||
connectedBlocks.add(blockLocation);
|
||||
dataManager.setConnectedBlocks(playerUUID, buttonId, connectedBlocks);
|
||||
updateButtonLore(item, buttonId);
|
||||
event.getPlayer().sendMessage(configManager.getMessage("block-verbunden"));
|
||||
} else {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("block-bereits-verbunden"));
|
||||
} else if (type == Material.BELL) {
|
||||
if (connected.stream().filter(l -> getMaterialFromLocation(l) == Material.BELL).count() >= configManager.getMaxBells()) {
|
||||
player.sendMessage(configManager.getMessage("max-glocken-erreicht"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockPlace(BlockPlaceEvent event) {
|
||||
String playerUUID = event.getPlayer().getUniqueId().toString();
|
||||
ItemStack item = event.getItemInHand();
|
||||
if (item == null || !item.hasItemMeta() || !item.getItemMeta().getDisplayName().contains("§6Steuer-")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block block = event.getBlockPlaced();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
String buttonId = null;
|
||||
|
||||
if (item == null || (!item.getType().equals(Material.STONE_BUTTON) &&
|
||||
!item.getType().equals(Material.DAYLIGHT_DETECTOR) &&
|
||||
!item.getType().equals(Material.NOTE_BLOCK) &&
|
||||
!item.getType().equals(Material.TRIPWIRE_HOOK))) {
|
||||
return;
|
||||
if (meta != null && meta.hasLore() && !meta.getLore().isEmpty()) {
|
||||
String firstLine = meta.getLore().get(0);
|
||||
if (firstLine.startsWith("§8ID: ")) {
|
||||
buttonId = firstLine.replace("§8ID: ", "");
|
||||
}
|
||||
}
|
||||
|
||||
if (!item.hasItemMeta() || !item.getItemMeta().getDisplayName().contains("§6Steuer-")) {
|
||||
return;
|
||||
if (buttonId == null) {
|
||||
buttonId = UUID.randomUUID().toString();
|
||||
updateButtonLore(item, buttonId);
|
||||
}
|
||||
|
||||
String buttonId = item.getItemMeta().hasLore() ? item.getItemMeta().getLore().get(0) : UUID.randomUUID().toString();
|
||||
String blockLocation = block.getWorld().getName() + "," + block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
dataManager.addPlacedController(playerUUID, blockLocation, buttonId);
|
||||
dataManager.registerController(blockLocation, event.getPlayer().getUniqueId(), buttonId);
|
||||
event.getPlayer().sendMessage(configManager.getMessage("controller-platziert"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBlockBreak(BlockBreakEvent event) {
|
||||
String playerUUID = event.getPlayer().getUniqueId().toString();
|
||||
Block block = event.getBlock();
|
||||
String blockLocation = block.getWorld().getName() + "," + block.getX() + "," + block.getY() + "," + block.getZ();
|
||||
String buttonId = dataManager.getButtonIdForPlacedController(playerUUID, blockLocation);
|
||||
String buttonId = dataManager.getButtonIdForLocation(blockLocation);
|
||||
|
||||
if (buttonId != null) {
|
||||
dataManager.removePlacedController(playerUUID, blockLocation);
|
||||
dataManager.setConnectedBlocks(playerUUID, buttonId, null);
|
||||
dataManager.removeMotionSensorSettings(blockLocation); // Entferne Bewegungsmelder-Einstellungen
|
||||
if (!dataManager.isOwner(buttonId, event.getPlayer().getUniqueId())) {
|
||||
event.getPlayer().sendMessage(configManager.getMessage("nur-besitzer-abbauen"));
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
dataManager.removeController(blockLocation);
|
||||
event.getPlayer().sendMessage(configManager.getMessage("controller-entfernt"));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isDoor(Material material) {
|
||||
return material.toString().endsWith("_DOOR");
|
||||
}
|
||||
private boolean isButton(Material m) { return m.name().endsWith("_BUTTON"); }
|
||||
private boolean isDoor(Material m) { return m.name().endsWith("_DOOR"); }
|
||||
private boolean isGate(Material m) { return m.name().endsWith("_FENCE_GATE"); }
|
||||
private boolean isTrapdoor(Material m) { return m.name().endsWith("_TRAPDOOR"); }
|
||||
|
||||
private boolean isGate(Material material) {
|
||||
return material.toString().endsWith("_FENCE_GATE");
|
||||
}
|
||||
|
||||
private boolean isTrapdoor(Material material) {
|
||||
return material.toString().endsWith("_TRAPDOOR");
|
||||
private boolean isInteractableTarget(Material m) {
|
||||
return isDoor(m) || isGate(m) || isTrapdoor(m) || m == Material.REDSTONE_LAMP || m == Material.NOTE_BLOCK || m == Material.BELL;
|
||||
}
|
||||
|
||||
private Material getMaterialFromLocation(String locString) {
|
||||
String[] parts = locString.split(",");
|
||||
if (parts.length != 4) return null;
|
||||
Location loc = new Location(plugin.getServer().getWorld(parts[0]),
|
||||
Integer.parseInt(parts[1]),
|
||||
Integer.parseInt(parts[2]),
|
||||
Integer.parseInt(parts[3]));
|
||||
return loc.getBlock().getType();
|
||||
Location l = parseLocation(locString);
|
||||
return l != null ? l.getBlock().getType() : Material.AIR;
|
||||
}
|
||||
|
||||
private Location parseLocation(String s) {
|
||||
String[] p = s.split(",");
|
||||
if (p.length != 4) return null;
|
||||
try {
|
||||
return new Location(Bukkit.getWorld(p[0]), Integer.parseInt(p[1]), Integer.parseInt(p[2]), Integer.parseInt(p[3]));
|
||||
} catch (Exception e) { return null; }
|
||||
}
|
||||
|
||||
private void updateButtonLore(ItemStack item, String buttonId) {
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
if (meta != null) {
|
||||
List<String> lore = meta.hasLore() ? meta.getLore() : new ArrayList<>();
|
||||
if (!lore.contains(buttonId)) {
|
||||
lore.add(buttonId);
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("§8ID: " + buttonId);
|
||||
lore.add("§7Ein universeller Controller für");
|
||||
meta.setLore(lore);
|
||||
item.setItemMeta(meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
47
src/main/java/viper/ButtonTabCompleter.java
Normal file
47
src/main/java/viper/ButtonTabCompleter.java
Normal file
@@ -0,0 +1,47 @@
|
||||
package viper;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabCompleter;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class ButtonTabCompleter implements TabCompleter {
|
||||
|
||||
private final List<String> commands = Arrays.asList("info", "reload", "note", "trust", "untrust", "public", "private");
|
||||
private final List<String> instruments = Arrays.asList(
|
||||
"PIANO", "BASS_DRUM", "SNARE_DRUM", "STICKS", "BASS_GUITAR",
|
||||
"FLUTE", "BELL", "CHIME", "GUITAR", "XYLOPHONE",
|
||||
"IRON_XYLOPHONE", "COW_BELL", "DIDGERIDOO", "BIT", "BANJO", "PLING"
|
||||
);
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) {
|
||||
if (!(sender instanceof Player)) return Collections.emptyList();
|
||||
|
||||
List<String> completions = new ArrayList<>();
|
||||
|
||||
// Erste Ebene: /bc <Tab>
|
||||
if (args.length == 1) {
|
||||
StringUtil.copyPartialMatches(args[0], commands, completions);
|
||||
}
|
||||
|
||||
// Zweite Ebene: /bc note <Tab>
|
||||
else if (args.length == 2 && args[0].equalsIgnoreCase("note")) {
|
||||
StringUtil.copyPartialMatches(args[1], instruments, completions);
|
||||
}
|
||||
|
||||
// Zweite Ebene: /bc trust/untrust <Tab> (Spielernamen vorschlagen)
|
||||
else if (args.length == 2 && (args[0].equalsIgnoreCase("trust") || args[0].equalsIgnoreCase("untrust"))) {
|
||||
return null; // 'null' lässt Bukkit automatisch alle Online-Spieler vorschlagen
|
||||
}
|
||||
|
||||
Collections.sort(completions);
|
||||
return completions;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class DataManager {
|
||||
@@ -32,69 +31,106 @@ public class DataManager {
|
||||
data = YamlConfiguration.loadConfiguration(dataFile);
|
||||
}
|
||||
|
||||
public List<String> getConnectedBlocks(String playerUUID, String buttonId) {
|
||||
return data.getStringList("players." + playerUUID + ".buttons." + buttonId);
|
||||
public String getButtonIdForLocation(String location) {
|
||||
return getButtonIdForPlacedController(location);
|
||||
}
|
||||
|
||||
public boolean canAccess(String buttonId, UUID playerUUID) {
|
||||
if (isPublic(buttonId)) return true;
|
||||
if (isOwner(buttonId, playerUUID)) return true;
|
||||
List<String> trusted = data.getStringList("trust." + buttonId);
|
||||
return trusted.contains(playerUUID.toString());
|
||||
}
|
||||
|
||||
public boolean isOwner(String buttonId, UUID playerUUID) {
|
||||
// Wir prüfen direkt im globalen Pfad der Buttons
|
||||
return data.contains("players." + playerUUID.toString() + ".buttons." + buttonId);
|
||||
}
|
||||
|
||||
public void registerController(String location, UUID ownerUUID, String buttonId) {
|
||||
addPlacedController(ownerUUID.toString(), location, buttonId);
|
||||
}
|
||||
|
||||
public void removeController(String location) {
|
||||
if (data.getConfigurationSection("players") == null) return;
|
||||
for (String playerUUID : data.getConfigurationSection("players").getKeys(false)) {
|
||||
String path = "players." + playerUUID + ".placed-controllers." + location;
|
||||
if (data.contains(path)) {
|
||||
data.set(path, null);
|
||||
}
|
||||
}
|
||||
removeMotionSensorSettings(location);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void addTrustedPlayer(String buttonId, UUID targetUUID) {
|
||||
List<String> trusted = data.getStringList("trust." + buttonId);
|
||||
if (!trusted.contains(targetUUID.toString())) {
|
||||
trusted.add(targetUUID.toString());
|
||||
data.set("trust." + buttonId, trusted);
|
||||
saveData();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeTrustedPlayer(String buttonId, UUID targetUUID) {
|
||||
List<String> trusted = data.getStringList("trust." + buttonId);
|
||||
trusted.remove(targetUUID.toString());
|
||||
data.set("trust." + buttonId, trusted);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void setPublic(String buttonId, boolean isPublic) {
|
||||
data.set("public-status." + buttonId, isPublic);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public boolean isPublic(String buttonId) {
|
||||
return data.getBoolean("public-status." + buttonId, false);
|
||||
}
|
||||
|
||||
// Speichert die Blöcke für eine ID unter einem spezifischen Spieler
|
||||
public void setConnectedBlocks(String playerUUID, String buttonId, List<String> blocks) {
|
||||
data.set("players." + playerUUID + ".buttons." + buttonId, blocks);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public void addPlacedController(String playerUUID, String location, String buttonId) {
|
||||
// Verhindert doppelte Punkte im Pfad, falls die Location Punkte enthält
|
||||
data.set("players." + playerUUID + ".placed-controllers." + location, buttonId);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public String getButtonIdForPlacedController(String playerUUID, String location) {
|
||||
return data.getString("players." + playerUUID + ".placed-controllers." + location);
|
||||
}
|
||||
|
||||
public void removePlacedController(String playerUUID, String location) {
|
||||
data.set("players." + playerUUID + ".placed-controllers." + location, null);
|
||||
saveData();
|
||||
}
|
||||
|
||||
public List<String> getAllPlacedControllers(String playerUUID) {
|
||||
if (data.getConfigurationSection("players." + playerUUID + ".placed-controllers") == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
Set<String> keys = data.getConfigurationSection("players." + playerUUID + ".placed-controllers").getKeys(false);
|
||||
return new ArrayList<>(keys);
|
||||
}
|
||||
|
||||
public List<String> getAllPlacedControllers() {
|
||||
List<String> allControllers = new ArrayList<>();
|
||||
if (data.getConfigurationSection("players") == null) {
|
||||
return allControllers;
|
||||
}
|
||||
Set<String> players = data.getConfigurationSection("players").getKeys(false);
|
||||
for (String playerUUID : players) {
|
||||
allControllers.addAll(getAllPlacedControllers(playerUUID));
|
||||
}
|
||||
return allControllers;
|
||||
}
|
||||
|
||||
public String getButtonIdForPlacedController(String location) {
|
||||
if (data.getConfigurationSection("players") == null) return null;
|
||||
Set<String> players = data.getConfigurationSection("players").getKeys(false);
|
||||
for (String playerUUID : players) {
|
||||
String buttonId = getButtonIdForPlacedController(playerUUID, location);
|
||||
for (String playerUUID : data.getConfigurationSection("players").getKeys(false)) {
|
||||
String buttonId = data.getString("players." + playerUUID + ".placed-controllers." + location);
|
||||
if (buttonId != null) return buttonId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// VERBESSERT: Sucht gezielt nach den Blöcken für diese ID
|
||||
public List<String> getConnectedBlocks(String buttonId) {
|
||||
if (data.getConfigurationSection("players") == null) return null;
|
||||
Set<String> players = data.getConfigurationSection("players").getKeys(false);
|
||||
for (String playerUUID : players) {
|
||||
List<String> connected = getConnectedBlocks(playerUUID, buttonId);
|
||||
if (connected != null && !connected.isEmpty()) {
|
||||
return connected;
|
||||
if (data.getConfigurationSection("players") == null) return new ArrayList<>();
|
||||
|
||||
for (String playerUUID : data.getConfigurationSection("players").getKeys(false)) {
|
||||
String path = "players." + playerUUID + ".buttons." + buttonId;
|
||||
if (data.contains(path)) {
|
||||
return data.getStringList(path);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new ArrayList<>(); // Niemals null zurückgeben, um Fehler im Listener zu vermeiden
|
||||
}
|
||||
|
||||
public List<String> getAllPlacedControllers() {
|
||||
List<String> allControllers = new ArrayList<>();
|
||||
if (data.getConfigurationSection("players") == null) return allControllers;
|
||||
for (String playerUUID : data.getConfigurationSection("players").getKeys(false)) {
|
||||
if (data.getConfigurationSection("players." + playerUUID + ".placed-controllers") != null) {
|
||||
allControllers.addAll(data.getConfigurationSection("players." + playerUUID + ".placed-controllers").getKeys(false));
|
||||
}
|
||||
}
|
||||
return allControllers;
|
||||
}
|
||||
|
||||
public void setPlayerInstrument(UUID playerUUID, String instrument) {
|
||||
@@ -106,7 +142,6 @@ public class DataManager {
|
||||
return data.getString("players." + playerUUID.toString() + ".instrument");
|
||||
}
|
||||
|
||||
// Bewegungsmelder-Einstellungen
|
||||
public void setMotionSensorRadius(String location, double radius) {
|
||||
data.set("motion-sensors." + location + ".radius", radius);
|
||||
saveData();
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@@ -21,6 +22,7 @@ public class MotionSensorGUI implements Listener {
|
||||
private final String blockLocation;
|
||||
private final String buttonId;
|
||||
private final Player player;
|
||||
private final Inventory inv;
|
||||
|
||||
public MotionSensorGUI(ButtonControl plugin, Player player, String blockLocation, String buttonId) {
|
||||
this.plugin = plugin;
|
||||
@@ -29,18 +31,26 @@ public class MotionSensorGUI implements Listener {
|
||||
this.blockLocation = blockLocation;
|
||||
this.buttonId = buttonId;
|
||||
this.player = player;
|
||||
this.inv = Bukkit.createInventory(player, 27, "Bewegungsmelder Einstellungen");
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
public void open() {
|
||||
Inventory inv = Bukkit.createInventory(player, 27, "Bewegungsmelder Einstellungen");
|
||||
|
||||
// Aktuelle Werte aus DataManager holen oder Standardwerte aus Config
|
||||
double radius = dataManager.getMotionSensorRadius(blockLocation);
|
||||
if (radius == -1) radius = configManager.getConfig().getDouble("motion-detection-radius", 5.0);
|
||||
long delay = dataManager.getMotionSensorDelay(blockLocation);
|
||||
if (delay == -1) delay = configManager.getConfig().getLong("motion-close-delay-ms", 5000L);
|
||||
|
||||
// Füllitems für leere Slots (graue Glasscheiben)
|
||||
ItemStack filler = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
|
||||
ItemMeta fillerMeta = filler.getItemMeta();
|
||||
fillerMeta.setDisplayName(ChatColor.RESET + "");
|
||||
filler.setItemMeta(fillerMeta);
|
||||
for (int i = 0; i < 27; i++) {
|
||||
inv.setItem(i, filler);
|
||||
}
|
||||
|
||||
// Items für die GUI
|
||||
ItemStack radiusItem = new ItemStack(Material.COMPASS);
|
||||
ItemMeta radiusMeta = radiusItem.getItemMeta();
|
||||
@@ -75,17 +85,23 @@ public class MotionSensorGUI implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!event.getInventory().getHolder().equals(player)) return;
|
||||
if (!event.getInventory().equals(inv) || !event.getWhoClicked().equals(player)) return;
|
||||
if (event.getCurrentItem() == null) return;
|
||||
event.setCancelled(true);
|
||||
|
||||
event.setCancelled(true); // Alle Klicks standardmäßig abbrechen
|
||||
|
||||
int slot = event.getRawSlot();
|
||||
ItemStack clicked = event.getCurrentItem();
|
||||
|
||||
// Nur Klicks auf Slots 11, 15 und 22 verarbeiten
|
||||
if (slot != 11 && slot != 15 && slot != 22) return;
|
||||
|
||||
double radius = dataManager.getMotionSensorRadius(blockLocation);
|
||||
if (radius == -1) radius = configManager.getConfig().getDouble("motion-detection-radius", 5.0);
|
||||
long delay = dataManager.getMotionSensorDelay(blockLocation);
|
||||
if (delay == -1) delay = configManager.getConfig().getLong("motion-close-delay-ms", 5000L);
|
||||
|
||||
if (clicked.getType() == Material.COMPASS) {
|
||||
if (clicked.getType() == Material.COMPASS && slot == 11) {
|
||||
if (event.isLeftClick()) {
|
||||
radius = Math.min(radius + 0.5, 20.0); // Max. Radius: 20 Blöcke
|
||||
} else if (event.isRightClick()) {
|
||||
@@ -99,7 +115,8 @@ public class MotionSensorGUI implements Listener {
|
||||
ChatColor.GRAY + "Rechtsklick: -0.5 Blöcke"
|
||||
));
|
||||
clicked.setItemMeta(meta);
|
||||
} else if (clicked.getType() == Material.CLOCK) {
|
||||
inv.setItem(11, clicked);
|
||||
} else if (clicked.getType() == Material.CLOCK && slot == 15) {
|
||||
if (event.isLeftClick()) {
|
||||
delay = Math.min(delay + 1000, 30000); // Max. Verzögerung: 30 Sekunden
|
||||
} else if (event.isRightClick()) {
|
||||
@@ -113,15 +130,23 @@ public class MotionSensorGUI implements Listener {
|
||||
ChatColor.GRAY + "Rechtsklick: -1 Sekunde"
|
||||
));
|
||||
clicked.setItemMeta(meta);
|
||||
} else if (clicked.getType() == Material.EMERALD) {
|
||||
inv.setItem(15, clicked);
|
||||
} else if (clicked.getType() == Material.EMERALD && slot == 22) {
|
||||
player.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryDrag(InventoryDragEvent event) {
|
||||
if (!event.getInventory().equals(inv) || !event.getWhoClicked().equals(player)) return;
|
||||
event.setCancelled(true); // Verhindert Drag-and-Drop
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInventoryClose(InventoryCloseEvent event) {
|
||||
if (event.getPlayer().equals(player)) {
|
||||
if (event.getPlayer().equals(player) && event.getInventory().equals(inv)) {
|
||||
InventoryClickEvent.getHandlerList().unregister(this);
|
||||
InventoryDragEvent.getHandlerList().unregister(this);
|
||||
InventoryCloseEvent.getHandlerList().unregister(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# lang.yml - ButtonControl Nachrichten
|
||||
|
||||
# --- Bestehende Nachrichten (Türen/Tore/Falltüren) ---
|
||||
tueren-geoeffnet: "§aTüren wurden geöffnet."
|
||||
tueren-geschlossen: "§cTüren wurden geschlossen."
|
||||
max-tueren-erreicht: "§cMaximale Anzahl an Türen erreicht."
|
||||
|
||||
gates-geoeffnet: "§aZauntore wurden geöffnet."
|
||||
gates-geschlossen: "§cZauntore wurden geschlossen."
|
||||
@@ -9,31 +13,45 @@ fallturen-geoeffnet: "§aFalltüren wurden geöffnet."
|
||||
fallturen-geschlossen: "§cFalltüren wurden geschlossen."
|
||||
max-fallturen-erreicht: "§cMaximale Anzahl an Falltüren erreicht."
|
||||
|
||||
# --- Lampen & Glocken ---
|
||||
lampen-eingeschaltet: "§aLampen wurden eingeschaltet."
|
||||
lampen-ausgeschaltet: "§cLampen wurden ausgeschaltet."
|
||||
|
||||
bloecke-umgeschaltet: "§eBlöcke wurden umgeschaltet."
|
||||
keine-bloecke-verbunden: "§cKeine Blöcke sind verbunden."
|
||||
|
||||
max-tueren-erreicht: "§cMaximale Anzahl an Türen erreicht."
|
||||
max-lampen-erreicht: "§cMaximale Anzahl an Lampen erreicht."
|
||||
max-notenbloecke-erreicht: "§cMaximale Anzahl an Notenblöcken erreicht."
|
||||
|
||||
max-glocken-erreicht: "§cMaximale Anzahl an Glocken erreicht."
|
||||
glocke-gelaeutet: "§aGlocke wurde geläutet."
|
||||
max-glocken-erreicht: "§cMaximale Anzahl an Glocken erreicht."
|
||||
|
||||
block-verbunden: "§aBlock verbunden."
|
||||
block-bereits-verbunden: "§cBlock ist bereits verbunden."
|
||||
controller-platziert: "§aController platziert."
|
||||
controller-entfernt: "§cController entfernt."
|
||||
|
||||
# --- Notenblöcke & Instrumente ---
|
||||
notenblock-ausgeloest: "§aNotenblock-Klingel wurde ausgelöst."
|
||||
instrument-gesetzt: "§aDein Notenblock-Instrument wurde auf %s gesetzt."
|
||||
ungueltiges-instrument: "§cUngültiges Instrument! Verwende: /bc note <Instrument>"
|
||||
max-notenbloecke-erreicht: "§cMaximale Anzahl an Notenblöcken erreicht."
|
||||
|
||||
konfiguration-neugeladen: "§aKonfiguration und Daten erfolgreich neu geladen!"
|
||||
keine-berechtigung: "§cDu hast keine Berechtigung für diesen Befehl!"
|
||||
|
||||
# --- Kolben (Erweiterung) ---
|
||||
kolben-ausgefahren: "§6[ButtonControl] §7Kolben wurden ausgefahren."
|
||||
kolben-eingefahren: "§6[ButtonControl] §7Kolben wurden eingefahren."
|
||||
max-kolben-erreicht: "§6[ButtonControl] §7Maximale Anzahl an Kolben erreicht."
|
||||
|
||||
# --- Controller & Verbindung ---
|
||||
block-verbunden: "§aBlock verbunden."
|
||||
block-bereits-verbunden: "§cBlock ist bereits verbunden."
|
||||
keine-bloecke-verbunden: "§cKeine Blöcke sind verbunden."
|
||||
bloecke-umgeschaltet: "§eBlöcke wurden umgeschaltet."
|
||||
controller-platziert: "§aController platziert."
|
||||
controller-entfernt: "§cController entfernt."
|
||||
|
||||
# --- Trust- & Sicherheitssystem ---
|
||||
keine-berechtigung: "§cDu hast keine Berechtigung für diesen Befehl!"
|
||||
keine-berechtigung-controller: "§cDu hast keine Berechtigung, diesen Controller zu benutzen!"
|
||||
nur-besitzer-abbauen: "§cNur der Besitzer darf diesen Controller verwalten oder abbauen!"
|
||||
spieler-nicht-gefunden: "§cDieser Spieler wurde nicht gefunden."
|
||||
|
||||
# %s wird durch "§aÖffentlich" oder "§cPrivat" ersetzt
|
||||
status-geandert: "§6[ButtonControl] §7Der Controller ist nun %s§7."
|
||||
|
||||
# Trust Nachrichten
|
||||
trust-hinzugefuegt: "§aDu hast %s Vertrauen für diesen Controller gegeben."
|
||||
trust-entfernt: "§cDu hast %s das Vertrauen für diesen Controller entzogen."
|
||||
kein-controller-im-blick: "§cDu musst einen Controller (Button, Haken oder Sensor) direkt ansehen!"
|
||||
|
||||
# --- System ---
|
||||
konfiguration-neugeladen: "§aKonfiguration und Daten erfolgreich neu geladen!"
|
||||
@@ -1,14 +1,14 @@
|
||||
name: ButtonControl
|
||||
version: 1.3
|
||||
version: 1.5
|
||||
main: viper.ButtonControl
|
||||
api-version: 1.21
|
||||
author: viper
|
||||
description: Ein Plugin, um Türen, Redstone-Lampen und Notenblöcke mit einem Button oder Tageslichtsensor zu steuern.
|
||||
author: M_Viper
|
||||
description: Ein Plugin, um Türen, Redstone-Lampen und Notenblöcke mit einem Button, Tageslichtsensor oder Bewegungsmelder zu steuern.
|
||||
|
||||
commands:
|
||||
bc:
|
||||
description: Steuert das ButtonControl Plugin
|
||||
usage: /<command> [info|reload|note <instrument>]
|
||||
description: Hauptbefehl für ButtonControl
|
||||
usage: /bc <info|reload|note|trust|untrust|public|private>
|
||||
aliases: [buttoncontrol]
|
||||
|
||||
permissions:
|
||||
@@ -18,3 +18,9 @@ permissions:
|
||||
buttoncontrol.note:
|
||||
description: Erlaubt das Ändern des Notenblock-Instruments
|
||||
default: true
|
||||
buttoncontrol.update:
|
||||
description: Erlaubt das Empfangen von Update-Benachrichtigungen
|
||||
default: op
|
||||
buttoncontrol.trust:
|
||||
description: Erlaubt das Verwalten von Vertrauen und Status (Public/Private)
|
||||
default: true
|
||||
Reference in New Issue
Block a user