From b10d620ef74d31c8c6a12e316dfbb54b86a3e39d Mon Sep 17 00:00:00 2001 From: RedstoneTechnik Date: Wed, 6 Mar 2019 19:11:38 +0100 Subject: [PATCH] Update 1.12 GUI --- .../de/pro_crafting/sawe/RegionListener.java | 10 + .../warshipfactory/commands/CommandBau.java | 93 ++++++++ .../warshipfactory/commands/CommandGui.java | 204 +++++++++++++----- .../commands/CommandTestBlock.java | 50 ----- .../commands/Commandtestblock1.java | 201 ----------------- .../warshipfactory/config/Config.java | 76 ++++++- .../warshipfactory/content/FactoryWorld.java | 5 + .../content/LagDetectorRunnable.java | 3 + .../warshipfactory/main/WarShipFactory.java | 1 + 9 files changed, 333 insertions(+), 310 deletions(-) delete mode 100644 src/main/java/de/quantumnanox/warshipfactory/commands/CommandTestBlock.java delete mode 100644 src/main/java/de/quantumnanox/warshipfactory/commands/Commandtestblock1.java diff --git a/src/main/java/de/pro_crafting/sawe/RegionListener.java b/src/main/java/de/pro_crafting/sawe/RegionListener.java index 308a347..94893dd 100644 --- a/src/main/java/de/pro_crafting/sawe/RegionListener.java +++ b/src/main/java/de/pro_crafting/sawe/RegionListener.java @@ -8,7 +8,9 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockBurnEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -137,4 +139,12 @@ public class RegionListener implements Listener { } } + @EventHandler + public void onFireDamage(BlockBurnEvent e) { + FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(e.getIgnitingBlock().getWorld().getName()); + if (fw != null) { + if (fw.isFireDamage() == false) e.setCancelled(true); + } + } + } diff --git a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandBau.java b/src/main/java/de/quantumnanox/warshipfactory/commands/CommandBau.java index cac58da..63bd68b 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandBau.java +++ b/src/main/java/de/quantumnanox/warshipfactory/commands/CommandBau.java @@ -52,10 +52,12 @@ public class CommandBau { p.sendMessage("§8/bau addmember - §6Fügt einen Spieler zu deiner Welt hinzu"); p.sendMessage("§8/bau delmember - §6Entfernt einen Spieler von deiner Welt"); p.sendMessage("§8/bau tntdmg - §6Erlaubt / verbietet TNT Explosionen"); + p.sendMessage("§8/bau firedmg - §6Erlaubt / verbietet Feuer Schaden"); p.sendMessage("§8/bau testblock - §6Erneuert einen Testblock in der umgebung"); p.sendMessage("§8/bau reset - §6Setzt eine region zurück wo man sich befindet"); p.sendMessage("§8/bau resetall - §6Resetet deine komplette Welt"); p.sendMessage("§8/bau replace - §6Ersetzt in einer Region Obsidian zu TNT und Bedrock zu Schleim"); + p.sendMessage("§8/bau flyspeed - §6Um dein FlySpeed zu ändern"); p.sendMessage("§8/bau tp - §6Teleportiert dich auf eine Welt"); p.sendMessage("§8/bau info - §6Zeigt dir Infos über die aktuelle Welt"); p.sendMessage("§8/bau gui - §6Öffnet eine GUI"); @@ -202,6 +204,69 @@ public class CommandBau { e.printStackTrace(); } } + @Command(name = "bau.flyspeed", inGameOnly = true) + public void onflyspeed(CommandArgs args){ + final Player player = args.getPlayer(); + if (args.length() == 0){ + player.sendMessage("§8Bitte benutzte §b/bau flyspeed 1|2|3|4|5|6|7|8|9 oder 10"); + return; + } + else if (args.getArgs(0).equals("1")) + { + player.setFlySpeed(0.1F); + player.sendMessage("§6Fly speed wurde auf 1 gesetzt."); + } + else if (args.getArgs(0).equals("2")) + { + player.setFlySpeed(0.2F); + player.sendMessage("§6Fly speed wurde auf 2 gesetzt."); + } + else if (args.getArgs(0).equals("3")) + { + player.setFlySpeed(0.3F); + player.sendMessage("§6Fly speed wurde auf 3 gesetzt."); + } + else if (args.getArgs(0).equals("4")) + { + player.setFlySpeed(0.4F); + player.sendMessage("§6Fly speed wurde 4 gesetzt."); + } + else if (args.getArgs(0).equals("5")) + { + player.setFlySpeed(0.5F); + player.sendMessage("§6Fly speed wurde auf 5 gesetzt."); + } + else if (args.getArgs(0).equals("6")) + { + player.setFlySpeed(0.6F); + player.sendMessage("§6Fly speed wurde auf 6 gesetzt."); + } + else if (args.getArgs(0).equals("7")) + { + player.setFlySpeed(0.7F); + player.sendMessage("§6Fly speed wurde auf 7 gesetzt."); + } + else if (args.getArgs(0).equals("8")) + { + player.setFlySpeed(0.8F); + player.sendMessage("§6Fly speed wurde auf 8 gesetzt."); + } + else if (args.getArgs(0).equals("9")) + { + player.setFlySpeed(0.9F); + player.sendMessage("§6Fly speed wurde auf 9 gesetzt."); + } + else if (args.getArgs(0).equals("10")) + { + player.setFlySpeed(1.0F); + player.sendMessage("§6Fly speed wurde auf 10 gesetzt."); + } + else + { + player.sendMessage("§8Unbekannter Speed bitte benutzte eine Zahl zwischen 1 und 10."); + } + return; + } @Command(name = "bau.gui", inGameOnly = true) public boolean ongui(CommandArgs args) { final Player p = args.getPlayer(); @@ -722,6 +787,7 @@ public class CommandBau { Bukkit.getScheduler().runTaskAsynchronously(WarShipFactory.getInstance(), new Runnable() { public void run() { p.sendMessage(WarShipFactory.S_PREFIX + "§3--- §6Informationen §3---"); + p.sendMessage(""); StringBuilder members = new StringBuilder(); String ownaz = UUIDFetcher.getName(fw.getOwner()); for (WorldPlayer wp : fw.getMembers().getAll().values()) { @@ -736,6 +802,17 @@ public class CommandBau { p.sendMessage("§8Adresse: §6" + fw.getWorldAddress()); p.sendMessage("§8Besitzer: §6" + ownaz); p.sendMessage("§8Mitglieder: §6" + membas); + p.sendMessage(""); + if (fw.isTntDamage()) { + p.sendMessage("§8TNT Schaden: §6" + "§aTNT Schaden erlaubt."); + } else { + p.sendMessage("§8TNT Schaden: §6" + "§cTNT Schaden verboten."); + } + if (fw.isFireDamage()) { + p.sendMessage("§8Feuer Schaden: §6" + "§aFeuer Schaden erlaubt."); + } else { + p.sendMessage("§8Feuer Schaden: §6" + "§cFeuer Schaden verboten."); + } } }); } @@ -756,6 +833,22 @@ public class CommandBau { } } + @Command(name = "bau.firedmg", inGameOnly = true) + public void onFiredmg(CommandArgs args) { + Player p = args.getPlayer(); + FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId()); + if (fw == null) { + p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt"); + return; + } + fw.setFireDamage(!fw.isFireDamage()); + if (fw.isFireDamage()) { + p.sendMessage(WarShipFactory.S_PREFIX + "§aFeuer Schaden erlaubt."); + } else { + p.sendMessage(WarShipFactory.S_PREFIX + "§cFeuer Schaden verboten."); + } + } + private void pasteSchematic(Player player, File schematic, Vector position) { int count = 0; diff --git a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandGui.java b/src/main/java/de/quantumnanox/warshipfactory/commands/CommandGui.java index c6afbba..1af65f5 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandGui.java +++ b/src/main/java/de/quantumnanox/warshipfactory/commands/CommandGui.java @@ -3,9 +3,12 @@ package de.quantumnanox.warshipfactory.commands; import com.sk89q.worldedit.Vector; import com.sk89q.worldguard.protection.regions.ProtectedRegion; import de.quantumnanox.warshipfactory.content.FactoryWorld; +import de.quantumnanox.warshipfactory.content.UUIDFetcher; import de.quantumnanox.warshipfactory.content.WorldPlayer; import de.quantumnanox.warshipfactory.main.WarShipFactory; +import net.md_5.bungee.api.chat.ClickEvent; import org.bukkit.*; +import org.bukkit.block.Skull; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -21,6 +24,24 @@ import java.io.File; public class CommandGui implements Listener { + public Location warship1; + public Location warship2; + public Location wargear5; + public Location wargear6; + public Location wargear7; + public Location wargear8; + public Location miniwargear1; + public Location miniwargear2; + public Location miniwargear7; + public Location miniwargear8; + public Location airship1; + public Location airship2; + public Location airship3; + public Location airship4; + public Location airship5; + public Location airship6; + public Location airship7; + public Location airship8; @EventHandler public void onPlayerClickInventory(InventoryClickEvent e) { if (e.getInventory().getTitle().equals("§bBau Abteilungen")) { @@ -29,144 +50,162 @@ public class CommandGui implements Listener { if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarShip §aTestGelände 1")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -943 122 149"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarShip TestGelände 1 Teleportiert"); + warship1 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarShip1.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarShip1.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarShip1.loc.z")); + p.teleport(warship1); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarShip1.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarShip §aTestGelände 2")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -1200 122 149"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarShip TestGelände 2 Teleportiert"); + warship2 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarShip2.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarShip2.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarShip2.loc.z")); + p.teleport(warship2); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarShip2.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarGear §aTestGelände 5")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -1332 122 -53"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarGear TestGelände 5 Teleportiert"); + wargear5 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarGear5.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear5.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear5.loc.z")); + p.teleport(wargear5); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarGear5.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarGear §aTestGelände 6")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -1220 122 -53"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarGear TestGelände 6 Teleportiert"); + wargear6 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarGear6.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear6.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear6.loc.z")); + p.teleport(wargear6); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarGear6.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarGear §aTestGelände 7")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -1108 122 -53"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarGear TestGelände 7 Teleportiert"); + wargear7 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarGear7.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear7.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear7.loc.z")); + p.teleport(wargear7); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarGear7.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bWarGear §aTestGelände 8")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -996 122 -53"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu WarGear TestGelände 8 Teleportiert"); + wargear8 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("WarGear8.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear8.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("WarGear8.loc.z")); + p.teleport(wargear8); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("WarGear8.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bMiniWarGear §aTestGelände 1")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -907 122 -29"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu MiniWarGear TestGelände 1 Teleportiert"); + miniwargear1 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear1.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear1.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear1.loc.z")); + p.teleport(miniwargear1); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("MiniWargear1.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bMiniWarGear §aTestGelände 2")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -841 122 -29"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu MiniWarGear TestGelände 2 Teleportiert"); + miniwargear2 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear2.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear2.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear2.loc.z")); + p.teleport(miniwargear2); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("MiniWargear2.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bMiniWarGear §aTestGelände 7")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -907 122 -120"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu MiniWarGear TestGelände 7 Teleportiert"); + miniwargear7 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear7.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear7.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear7.loc.z")); + p.teleport(miniwargear7); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("MiniWargear7.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bMiniWarGear §aTestGelände 8")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -841 122 -120"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu MiniWarGear TestGelände 8 Teleportiert"); + miniwargear8 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear8.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear8.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("MiniWargear8.loc.z")); + p.teleport(miniwargear8); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("MiniWargear8.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 1")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -674 122 -45"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 1 Teleportiert"); + airship1 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip1.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip1.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip1.loc.z")); + p.teleport(airship1); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip1.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 2")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -487 122 -45"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 2 Teleportiert"); + airship2 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip2.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip2.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip2.loc.z")); + p.teleport(airship2); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip2.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 3")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -302 122 -45"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 3 Teleportiert"); + airship3 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip3.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip3.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip3.loc.z")); + p.teleport(airship3); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip3.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 4")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -115 122 -45"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 4 Teleportiert"); + airship4 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip4.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip4.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip4.loc.z")); + p.teleport(airship4); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip4.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 5")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -115 122 201"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 5 Teleportiert"); + airship5 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip5.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip5.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip5.loc.z")); + p.teleport(airship5); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip5.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 6")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -302 122 201"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 6 Teleportiert"); + airship6 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip6.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip6.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip6.loc.z")); + p.teleport(airship6); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip6.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 7")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -487 122 201"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 7 Teleportiert"); + airship7 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip7.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip7.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip7.loc.z")); + p.teleport(airship7); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip7.Message")); e.getView().close(); e.setCancelled(true); } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bAirShip §aTestGelände 8")) { //code Player p = (Player) e.getWhoClicked(); - p.performCommand("minecraft:tp -674 122 201"); - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du wurdest zu AirShip TestGelände 8 Teleportiert"); + airship8 = new Location(p.getWorld(), WarShipFactory.getInstance().config.cfg.getDouble("AirShip8.loc.x"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip8.loc.y"), WarShipFactory.getInstance().config.cfg.getDouble("AirShip8.loc.z")); + p.teleport(airship8); + p.sendMessage(WarShipFactory.S_PREFIX + WarShipFactory.getInstance().config.cfg.getString("AirShip8.Message")); e.getView().close(); e.setCancelled(true); } @@ -211,10 +250,15 @@ public class CommandGui implements Listener { e.setCancelled(true); return; } - p.sendMessage(WarShipFactory.S_PREFIX + "§7Kommt Bald"); + fw.setFireDamage(!fw.isFireDamage()); + if (fw.isFireDamage()) { + p.sendMessage(WarShipFactory.S_PREFIX + "§aAuf deiner Welt ist jetzt Feuer Schaden erlaubt."); + } else { + p.sendMessage(WarShipFactory.S_PREFIX + "§cAuf deiner Welt ist jetzt Feuer Schaden verboten."); + } e.getView().close(); + p.openInventory(weltoption(p)); e.setCancelled(true); - return; } if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§eStatus §2An")) { //code @@ -295,9 +339,10 @@ public class CommandGui implements Listener { } } - for (Player target : e.getWhoClicked().getWorld().getPlayers()) { + for (Player target : Bukkit.getOnlinePlayers()) { if (e.getInventory().getTitle().equals(target.getDisplayName())) { if (e.getCurrentItem().getItemMeta() != null) { + if (e.getCurrentItem().getItemMeta().getDisplayName() != null) { Player player = (Player) e.getWhoClicked(); ItemStack skull = new ItemStack(Material.SKULL_ITEM); @@ -305,10 +350,37 @@ public class CommandGui implements Listener { FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(player.getUniqueId()); if (fw == null) { player.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt"); + } + if (fw.getMember(target.getUniqueId()) != null) { + if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aSpieler hinzufügen")) { + //code + Player p = (Player) e.getWhoClicked(); + p.sendMessage(WarShipFactory.S_PREFIX + "§cDieser Spieler ist bereits Mitglied auf deiner Welt"); + p.openInventory(skullOwnerInventory(target, player)); + e.setCancelled(true); + } + }else{ + if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aSpieler hinzufügen")) { + //code + Player p = (Player) e.getWhoClicked(); + WorldPlayer wp1 = new WorldPlayer(target.getUniqueId(), fw); + fw.getMembers().register(wp1); + p.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "§aDu hast " + target.getName() + " §azu der Welt §6" + ChatColor.RED + " §ahinzugefügt"); + target.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "§aDu wurdest zu der Welt von §6" + p.getName() + ChatColor.RED + " §ahinzugefügt"); + p.openInventory(skullOwnerInventory(target, player)); + e.setCancelled(true); + } + } + if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bZurück")) { + //code + Player p = (Player) e.getWhoClicked(); + e.getView().close(); + e.setCancelled(true); + player.closeInventory(); + player.openInventory(spieleroption(p)); } WorldPlayer wp = fw.getMember(target.getUniqueId()); if (wp == null) { - player.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt"); e.setCancelled(true); return; } @@ -325,7 +397,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt auf deiner Welt kein Worldedit mehr benutzten."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt auf deiner Welt kein Worldedit mehr benutzten."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c WorldEdit verwenden."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -346,7 +418,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf sich jetzt nicht mehr auf deiner Welt Teleportieren."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf sich jetzt nicht mehr auf deiner Welt Teleportieren."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c /tp verwenden."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -367,7 +439,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt nicht mehr Bauen auf deiner Welt."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt nicht mehr Bauen auf deiner Welt."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c bauen."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -388,7 +460,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt nicht mehr sein Gamemode auf deiner Welt wechseln."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt nicht mehr sein Gamemode auf deiner Welt wechseln."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c deinen Spielmodus ändern."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -396,12 +468,13 @@ public class CommandGui implements Listener { } } } - if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aSpieler entfernen")) { + if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§cSpieler entfernen")) { //code Player p = (Player) e.getWhoClicked(); fw.getMembers().unregister(fw.getMembers().getID(fw.getMember(target.getUniqueId()))); target.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "§aDu wurdest von der Welt §6" + p.getName() + ChatColor.RED + " §aentfernt"); Player z = Bukkit.getPlayer(target.getUniqueId()); + p.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "Der Spieler " + target.getName() + ChatColor.RED + " wurde von deiner welt entfernt"); if (z != null) { if (z.getWorld().getUID().equals(fw.getWrapped().getUID())) { z.teleport(WarShipFactory.getInstance().config.spawn); @@ -424,7 +497,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt nicht mehr auf deiner Welt Replacen."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt nicht mehr auf deiner Welt Replacen."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c /bau replace verwenden."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -445,7 +518,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt nicht mehr auf deiner Welt einzelne Regionen erneuern."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt nicht mehr auf deiner Welt einzelne Regionen erneuern."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c /bau reset verwenden."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -466,7 +539,7 @@ public class CommandGui implements Listener { player.openInventory(skullOwnerInventory(target, player)); e.setCancelled(true); } else { - p.sendMessage(WarShipFactory.S_PREFIX + "§4Der Spieler darf jetzt nicht mehr auf deiner Welt TestBlöcke erneuern."); + p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt nicht mehr auf deiner Welt TestBlöcke erneuern."); z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c /bau testblock verwenden."); p.closeInventory(); player.openInventory(skullOwnerInventory(target, player)); @@ -490,14 +563,6 @@ public class CommandGui implements Listener { e.setCancelled(true); player.closeInventory(); } - if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§bZurück")) { - //code - Player p = (Player) e.getWhoClicked(); - e.getView().close(); - e.setCancelled(true); - player.closeInventory(); - player.openInventory(spieleroption(p)); - } } } } @@ -529,10 +594,16 @@ public class CommandGui implements Listener { ItemStack skull = new ItemStack(Material.SKULL_ITEM); ItemMeta meta = skull.getItemMeta(); meta = skull.getItemMeta(); - meta.setDisplayName(ChatColor.RED + "§aSpieler entfernen"); + meta.setDisplayName(ChatColor.RED + "§aSpieler hinzufügen"); skull.setItemMeta(meta); inv2.addItem(skull); + ItemStack skull1 = new ItemStack(Material.SKULL_ITEM); + meta = skull1.getItemMeta(); + meta.setDisplayName(ChatColor.RED + "§cSpieler entfernen"); + skull1.setItemMeta(meta); + inv2.setItem(9, skull1); + ItemStack togglewe = new ItemStack(Material.WOOD_AXE); meta = togglewe.getItemMeta(); meta.setDisplayName(ChatColor.RED + "§aToggle Worldedit"); @@ -717,7 +788,7 @@ public class CommandGui implements Listener { { inv.clear(); int slot = 0; - for (Player p : Bukkit.getWorld(player.getWorld().getName()).getPlayers()) { + for (Player p : Bukkit.getOnlinePlayers()) { inv.setItem(slot, getSkull(p.getName())); slot++; } @@ -870,6 +941,23 @@ public class CommandGui implements Listener { p.closeInventory(); p.openInventory(inv2); } + if (fw.isFireDamage()) { + ItemStack tntst = new ItemStack(351, 1, (short) 10); + meta = tntst.getItemMeta(); + meta.setDisplayName(ChatColor.RED + "§eStatus §2An"); + tntst.setItemMeta(meta); + inv2.setItem(17, tntst); + p.closeInventory(); + p.openInventory(inv2); + } else { + ItemStack tntst1 = new ItemStack(351, 1, (short) 8); + meta = tntst1.getItemMeta(); + meta.setDisplayName(ChatColor.RED + "§eStatus §4Aus"); + tntst1.setItemMeta(meta); + inv2.setItem(17, tntst1); + p.closeInventory(); + p.openInventory(inv2); + } }return inv2; } } \ No newline at end of file diff --git a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandTestBlock.java b/src/main/java/de/quantumnanox/warshipfactory/commands/CommandTestBlock.java deleted file mode 100644 index da453cf..0000000 --- a/src/main/java/de/quantumnanox/warshipfactory/commands/CommandTestBlock.java +++ /dev/null @@ -1,50 +0,0 @@ -package de.quantumnanox.warshipfactory.commands; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang.Validate; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.command.Command; -import org.bukkit.command.CommandSender; -import org.bukkit.command.defaults.BukkitCommand; -import org.bukkit.entity.Player; -import org.bukkit.util.StringUtil; - -import com.google.common.collect.ImmutableList; - -import de.quantumnanox.warshipfactory.content.FactoryWorld; -import de.quantumnanox.warshipfactory.content.WorldPlayer; -import de.quantumnanox.warshipfactory.main.WarShipFactory; - -public class CommandTestBlock extends Commandtestblock1 { - - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - - // SEAGIANTS - if (sender instanceof Player) { - Player p = (Player) sender; - if (p.hasPermission("nnx.user") == false) { - FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName()); - if (fw == null) { - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du befindest dich auf keiner Bauwelt!"); - return false; - } - WorldPlayer wp = fw.getMember(p.getUniqueId()); - if (wp == null && !fw.getOwner().equals(p.getUniqueId())) { - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du bist kein Mitglied dieser Welt!"); - return false; - } - if (!fw.getOwner().equals(p.getUniqueId())) { - if (wp.canTestBlock == false) { - p.sendMessage(WarShipFactory.S_PREFIX + "§7Du darfst keinen TestBlock erneuern!"); - return false; - } - } - } - } - return false; - } -} \ No newline at end of file diff --git a/src/main/java/de/quantumnanox/warshipfactory/commands/Commandtestblock1.java b/src/main/java/de/quantumnanox/warshipfactory/commands/Commandtestblock1.java deleted file mode 100644 index b930c0a..0000000 --- a/src/main/java/de/quantumnanox/warshipfactory/commands/Commandtestblock1.java +++ /dev/null @@ -1,201 +0,0 @@ -package de.quantumnanox.warshipfactory.commands; - -import java.io.File; -import java.io.IOException; -import java.sql.SQLException; - -import org.bukkit.Location; -import org.bukkit.World; -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -import com.boydti.fawe.jnbt.anvil.MCAFilterCounter; -import com.boydti.fawe.jnbt.anvil.MCAQueue; -import com.boydti.fawe.object.number.MutableLong; -import com.sk89q.worldedit.EditSession; - -import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; -import com.sk89q.worldedit.schematic.MCEditSchematicFormat; -import com.sk89q.worldedit.CuboidClipboard; -import com.sk89q.worldedit.math.transform.Transform; -import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import de.quantumnanox.warshipfactory.main.WarShipFactory; - -public class Commandtestblock1 implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - - if(sender instanceof Player) { - - Player p = (Player) sender; - try { - if(p.hasPermission("nnx.user")) { - - //args länge 0 - if(args.length == 0) { - p.sendMessage("§4Verwende /bau help"); - return false; - } - - //args länge 1 - if(args.length == 1) { - - //Testblock - if(args[0].equalsIgnoreCase("testblock")) { - - Location playerLocation = p.getLocation(); - World playerWorld = p.getWorld(); - - @SuppressWarnings("unused") - int count = 0; - for(ProtectedRegion rg : WarShipFactory.getPlugin().getWorldGuard().getRegionManager(playerWorld).getApplicableRegions(playerLocation)) { - count++; - - String rgID = rg.getId().toString(); - p.sendMessage(rgID); - Vector position = new Vector(Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.X")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.Y")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.Z"))); - File file = new File(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".schematic.testblock")); - - pasteSchematic(p, file, position); - p.sendMessage(WarShipFactory.S_PREFIX + "Testblock erneuert!"); - - } - - return false; - } - - if(args[0].equalsIgnoreCase("reset")) { - - Location playerLocation = p.getLocation(); - World playerWorld = p.getWorld(); - - @SuppressWarnings("unused") - int count = 0; - for(ProtectedRegion rg : WarShipFactory.getPlugin().getWorldGuard().getRegionManager(playerWorld).getApplicableRegions(playerLocation)) { - count++; - - String rgID = rg.getId().toString(); - - Vector position = new Vector(Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.X")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.Y")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".position.Z"))); - File file = new File(WarShipFactory.getPlugin().getRegionData.getString("regions." + rgID + ".schematic.reset")); - - pasteSchematic(p, file, position); - p.sendMessage(WarShipFactory.S_PREFIX + "Region " + rgID + " wurde resettet!"); - - } - - return false; - - } - - if(args[0].equalsIgnoreCase("resetall")) { - - Location playerLocation = p.getLocation(); - World playerWorld = p.getWorld(); - - @SuppressWarnings("unused") - int count = 0; - for(@SuppressWarnings("unused") ProtectedRegion rg : WarShipFactory.getPlugin().getWorldGuard().getRegionManager(playerWorld).getApplicableRegions(playerLocation)) { - count++; - - Vector position = new Vector(Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("schematic.resetall.position.X")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("schematic.resetall.position.Y")), Integer.parseInt(WarShipFactory.getPlugin().getRegionData.getString("schematic.resetall.position.Z"))); - File file = new File(WarShipFactory.getPlugin().getRegionData.getString("schematic.resetall.schematic")); - - pasteSchematic(p, file, position); - p.sendMessage(WarShipFactory.S_PREFIX + "Alle Regionen wurden resettet!"); - - } - - return false; - - } - - if(args[0].equalsIgnoreCase("replace")) { - - World world = p.getWorld(); - int count = 0; - for(ProtectedRegion rg : WarShipFactory.getPlugin().getWorldGuard().getRegionManager(world).getApplicableRegions(p.getLocation())) { - - count++; - if(count != 0) { - - String gsID = rg.getId(); - - String worldName = p.getWorld().getName(); - File root = new File(worldName + File.separator + "region"); - MCAQueue queue = new MCAQueue(worldName, root, true); - @SuppressWarnings("unused") - MCAFilterCounter counter = queue.filterWorld(new MCAFilterCounter() { - @Override - public void applyBlock(int x, int y, int z, BaseBlock block, MutableLong ignore) { - if(block.getId() == 49) { // Change the id if it's 5 - block.setId(46); - } - - if(block.getId() == 7) { - block.setId(165); - } - } - }); - - p.sendMessage(WarShipFactory.S_PREFIX + "In Region " + gsID + " wurde Obsidian und Bedrock replacet!"); - - } - } - - return false; - } - } - - } else - p.sendMessage(""); - } catch (Exception e) { - e.printStackTrace(); - } - } - return false; - } - - private void pasteSchematic(Player player, File schematic, Vector position) { - - int count = 0; - - World world = player.getWorld(); - - for(ProtectedRegion rg:WarShipFactory.getWorldGuard().getRegionManager(world).getApplicableRegions(player.getLocation())) { - count++; - if(count != 0) { - - EditSession session = WarShipFactory.getWorldEdit().getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(world), Integer.MAX_VALUE); - try { - - CuboidClipboard format = MCEditSchematicFormat.getFormat(schematic).load(schematic); - format.paste(session, position, false); - - } catch (Exception ex) { - player.sendMessage(ex.getMessage()); - ex.printStackTrace(); - } - } - } - } -/* - private void pasteSchem(File schematic, Player player, Vector position, boolean allowUndo, boolean noAir) { - - com.sk89q.worldedit.world.World weWorld = new BukkitWorld(player.getWorld()); - - try { - EditSession editSession = ClipboardFormat.findByFile(schematic).load(schematic).paste(weWorld, position, allowUndo, !noAir, (Transform) null); - editSession.flushQueue(); - } catch (IOException e) { - e.printStackTrace(); - } - }*/ - -} \ No newline at end of file diff --git a/src/main/java/de/quantumnanox/warshipfactory/config/Config.java b/src/main/java/de/quantumnanox/warshipfactory/config/Config.java index f7f0adf..1b0713f 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/config/Config.java +++ b/src/main/java/de/quantumnanox/warshipfactory/config/Config.java @@ -3,11 +3,13 @@ package de.quantumnanox.warshipfactory.config; import java.io.File; import java.io.IOException; +import de.quantumnanox.warshipfactory.main.WarShipFactory; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.WorldCreator; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; public class Config { @@ -18,7 +20,7 @@ public class Config { public String regionDir; public Location spawn; public Location pasteloc; - + public Config() { this.file = new File("plugins/WarShipFactory/config.yml"); this.cfg = YamlConfiguration.loadConfiguration(this.file); @@ -34,6 +36,78 @@ public class Config { cfg.addDefault("Coords.loc.x", 0); cfg.addDefault("Coords.loc.y", 0); cfg.addDefault("Coords.loc.z", 0); + cfg.addDefault("MiniWargear1.loc.x", -907); + cfg.addDefault("MiniWargear1.loc.y", 122); + cfg.addDefault("MiniWargear1.loc.z", -29); + cfg.addDefault("MiniWargear1.Message", "§7Du wurdest zu MiniWarGear TestGelände 1 Teleportiert"); + cfg.addDefault("MiniWargear2.loc.x", -841); + cfg.addDefault("MiniWargear2.loc.y", 122); + cfg.addDefault("MiniWargear2.loc.z", -29); + cfg.addDefault("MiniWargear2.Message", "§7Du wurdest zu MiniWarGear TestGelände 2 Teleportiert"); + cfg.addDefault("MiniWargear7.loc.x", -907); + cfg.addDefault("MiniWargear7.loc.y", 122); + cfg.addDefault("MiniWargear7.loc.z", -29); + cfg.addDefault("MiniWargear7.Message", "§7Du wurdest zu MiniWarGear TestGelände 7 Teleportiert"); + cfg.addDefault("MiniWargear8.loc.x", -841); + cfg.addDefault("MiniWargear8.loc.y", 122); + cfg.addDefault("MiniWargear8.loc.z", -120); + cfg.addDefault("MiniWargear8.Message", "§7Du wurdest zu MiniWarGear TestGelände 8 Teleportiert"); + cfg.addDefault("WarGear5.loc.x", -1332); + cfg.addDefault("WarGear5.loc.y", 122); + cfg.addDefault("WarGear5.loc.z", -53); + cfg.addDefault("WarGear5.Message", "§7Du wurdest zu WarGear TestGelände 5 Teleportiert"); + cfg.addDefault("WarGear6.loc.x", -1220); + cfg.addDefault("WarGear6.loc.y", 122); + cfg.addDefault("WarGear6.loc.z", -53); + cfg.addDefault("WarGear6.Message", "§7Du wurdest zu WarGear TestGelände 6 Teleportiert"); + cfg.addDefault("WarGear7.loc.x", -1108); + cfg.addDefault("WarGear7.loc.y", 122); + cfg.addDefault("WarGear7.loc.z", -53); + cfg.addDefault("WarGear7.Message", "§7Du wurdest zu WarGear TestGelände 7 Teleportiert"); + cfg.addDefault("WarGear8.loc.x", -996); + cfg.addDefault("WarGear8.loc.y", 122); + cfg.addDefault("WarGear8.loc.z", -53); + cfg.addDefault("WarGear8.Message", "§7Du wurdest zu WarGear TestGelände 8 Teleportiert"); + cfg.addDefault("WarShip1.loc.x", -943); + cfg.addDefault("WarShip1.loc.y", 122); + cfg.addDefault("WarShip1.loc.z", 149); + cfg.addDefault("WarShip1.Message", "§7Du wurdest zu WarShip TestGelände 1 Teleportiert"); + cfg.addDefault("WarShip2.loc.x", -1200); + cfg.addDefault("WarShip2.loc.y", 122); + cfg.addDefault("WarShip2.loc.z", 149); + cfg.addDefault("WarShip2.Message", "§7Du wurdest zu WarShip TestGelände 2 Teleportiert"); + cfg.addDefault("AirShip1.loc.x", -674); + cfg.addDefault("AirShip1.loc.y", 122); + cfg.addDefault("AirShip1.loc.z", -45); + cfg.addDefault("AirShip1.Message", "§7Du wurdest zu AirShip TestGelände 1 Teleportiert"); + cfg.addDefault("AirShip2.loc.x", -487); + cfg.addDefault("AirShip2.loc.y", 122); + cfg.addDefault("AirShip2.loc.z", -45); + cfg.addDefault("AirShip2.Message", "§7Du wurdest zu AirShip TestGelände 2 Teleportiert"); + cfg.addDefault("AirShip3.loc.x", -302); + cfg.addDefault("AirShip3.loc.y", 122); + cfg.addDefault("AirShip3.loc.z", -45); + cfg.addDefault("AirShip3.Message", "§7Du wurdest zu AirShip TestGelände 3 Teleportiert"); + cfg.addDefault("AirShip4.loc.x", -115); + cfg.addDefault("AirShip4.loc.y", 122); + cfg.addDefault("AirShip4.loc.z", -45); + cfg.addDefault("AirShip4.Message", "§7Du wurdest zu AirShip TestGelände 4 Teleportiert"); + cfg.addDefault("AirShip5.loc.x", -115); + cfg.addDefault("AirShip5.loc.y", 122); + cfg.addDefault("AirShip5.loc.z", 201); + cfg.addDefault("AirShip5.Message", "§7Du wurdest zu AirShip TestGelände 5 Teleportiert"); + cfg.addDefault("AirShip6.loc.x", -302); + cfg.addDefault("AirShip6.loc.y", 122); + cfg.addDefault("AirShip6.loc.z", 201); + cfg.addDefault("AirShip6.Message", "§7Du wurdest zu AirShip TestGelände 6 Teleportiert"); + cfg.addDefault("AirShip7.loc.x", -487); + cfg.addDefault("AirShip7.loc.y", 122); + cfg.addDefault("AirShip7.loc.z", 201); + cfg.addDefault("AirShip7.Message", "§7Du wurdest zu AirShip TestGelände 7 Teleportiert"); + cfg.addDefault("AirShip8.loc.x", -674); + cfg.addDefault("AirShip8.loc.y", 122); + cfg.addDefault("AirShip8.loc.z", 201); + cfg.addDefault("AirShip8.Message", "§7Du wurdest zu AirShip TestGelände 8 Teleportiert"); cfg.addDefault("Lobby.name", "Lobby_1"); try { this.cfg.save(this.file); diff --git a/src/main/java/de/quantumnanox/warshipfactory/content/FactoryWorld.java b/src/main/java/de/quantumnanox/warshipfactory/content/FactoryWorld.java index b09d22b..cee3a02 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/content/FactoryWorld.java +++ b/src/main/java/de/quantumnanox/warshipfactory/content/FactoryWorld.java @@ -42,6 +42,9 @@ public class FactoryWorld extends CobixTagFormatSupported { @Getter @Setter private boolean tntDamage; + @Getter + @Setter + private boolean fireDamage; private BukkitTask task; @@ -62,6 +65,7 @@ public class FactoryWorld extends CobixTagFormatSupported { out.putString("worldAddress", worldAddress); out.putString("owner", owner.toString()); out.putShort("tntdmg", (short) (tntDamage ? 1 : 0)); + out.putShort("firedmg", (short) (fireDamage ? 1 : 0)); return out; } @@ -71,6 +75,7 @@ public class FactoryWorld extends CobixTagFormatSupported { worldAddress = tc.getTagString("worldAddress").getValue(); owner = UUID.fromString(tc.getTagString("owner").getValue()); tntDamage = tc.getTagShort("tntdmg").getValue() == 1 ? true : false; + fireDamage = tc.getTagShort("firedmg").getValue() == 1 ? true : false; } public void loadWorld() throws IOException { diff --git a/src/main/java/de/quantumnanox/warshipfactory/content/LagDetectorRunnable.java b/src/main/java/de/quantumnanox/warshipfactory/content/LagDetectorRunnable.java index b53e1a4..a6c0484 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/content/LagDetectorRunnable.java +++ b/src/main/java/de/quantumnanox/warshipfactory/content/LagDetectorRunnable.java @@ -1,5 +1,6 @@ package de.quantumnanox.warshipfactory.content; +import net.minecraft.server.v1_12_R1.Material; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -22,6 +23,8 @@ public class LagDetectorRunnable implements Runnable { } world.getWrapped().setStorm(false); world.getWrapped().setThundering(false); + world.getWrapped().setMonsterSpawnLimit(0); + world.getWrapped().setAnimalSpawnLimit(0); int players = 0; int other = 0; for (Entity e : world.getWrapped().getEntities()) { diff --git a/src/main/java/de/quantumnanox/warshipfactory/main/WarShipFactory.java b/src/main/java/de/quantumnanox/warshipfactory/main/WarShipFactory.java index 7677679..793c540 100644 --- a/src/main/java/de/quantumnanox/warshipfactory/main/WarShipFactory.java +++ b/src/main/java/de/quantumnanox/warshipfactory/main/WarShipFactory.java @@ -13,6 +13,7 @@ import net.thecobix.tag.TagInputStream; import net.thecobix.tag.TagOutputStream; import org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; +import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.java.JavaPlugin;