diff --git a/src/main/java/de/marc/folterkammer/folterplugin.java b/src/main/java/de/marc/folterkammer/folterplugin.java index fff226e..62ad95c 100644 --- a/src/main/java/de/marc/folterkammer/folterplugin.java +++ b/src/main/java/de/marc/folterkammer/folterplugin.java @@ -6,6 +6,7 @@ import org.bukkit.Material; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; +import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -24,7 +25,7 @@ public final class folterplugin extends JavaPlugin { saveDefaultConfig(); // Plugin startup logic - getCommand("folterkammer"); + getCommand("folterkammer").setExecutor(this); getLogger().info("Folterkammer Plugin geladen!"); } @@ -62,23 +63,23 @@ public final class folterplugin extends JavaPlugin { switch (mode) { case "enter": - List folterkammer = getConfig().getStringList("positions.folterkammer"); + ConfigurationSection folterkammer = getConfig().getConfigurationSection("positions.folterkammer"); - world = Bukkit.getWorld(folterkammer.get(0).toString()); - x = ((Number) folterkammer.get(1)).intValue(); - y = ((Number) folterkammer.get(2)).intValue(); - z = ((Number) folterkammer.get(3)).intValue(); + world = Bukkit.getWorld(folterkammer.getString("world")); + x = folterkammer.getInt("x"); + y = folterkammer.getInt("y"); + z = folterkammer.getInt("z"); Location folter_loc = new Location(world, x, y, z); player.teleport(folter_loc); case "exit": - List spawn = getConfig().getStringList("positions.spawn"); + ConfigurationSection spawn = getConfig().getConfigurationSection("positions.spawn"); - world = Bukkit.getWorld(spawn.get(0).toString()); - x = ((Number) spawn.get(1)).intValue(); - y = ((Number) spawn.get(2)).intValue(); - z = ((Number) spawn.get(3)).intValue(); + world = Bukkit.getWorld(spawn.getString("world")); + x = spawn.getInt("x"); + y = spawn.getInt("y"); + z = spawn.getInt("z"); Location spawn_loc = new Location(world, x, y, z); player.teleport(spawn_loc); @@ -99,12 +100,12 @@ public final class folterplugin extends JavaPlugin { Player target = Bukkit.getPlayer(args[1]); - List folter_spawn = getConfig().getStringList("positions.spawn"); + ConfigurationSection folter_spawn = getConfig().getConfigurationSection("positions.folterkammer_player"); - world = Bukkit.getWorld(folter_spawn.get(0).toString()); - x = ((Number) folter_spawn.get(1)).intValue(); - y = ((Number) folter_spawn.get(2)).intValue(); - z = ((Number) folter_spawn.get(3)).intValue(); + world = Bukkit.getWorld(folter_spawn.getString("world")); + x = folter_spawn.getInt("x"); + y = folter_spawn.getInt("y"); + z = folter_spawn.getInt("z"); Location folter_spawn_loc = new Location(world, x, y, z); target.teleport(folter_spawn_loc); @@ -144,6 +145,8 @@ public final class folterplugin extends JavaPlugin { player.getInventory().addItem(tag2); + default: + player.sendMessage("§cHast du dich vielleicht vertippt??"); } return true; diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index f5d944e..d96880d 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1,16 +1,16 @@ positions: folterkammer: - - minecraft:folterraum - - 21 - - 42 - - 29 + world: folterraum + x: 21 + y: 42 + z: 29 folterkammer_player: - - minecraft:folterraum - - 21 - - 38 - - 7 + world: folterraum + x: 21 + y: 38 + z: 7 spawn: - - minecraft:overworld - - 500 - - 200 - - 494 \ No newline at end of file + world: world + x: 500 + y: 200 + z: 494 \ No newline at end of file diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8255cc4..a350a78 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -10,4 +10,7 @@ commands: permissions: folter.use: description: Berechtigung für Folterer - default: op \ No newline at end of file + default: op + folter.admin: + description: Berechtigung für Admins + default: op \ No newline at end of file