Update 1.12 MYSQL Anbindung mit Core etc.
Fehler die noch behoben werden müssen TNT und Feuer Schaden toggle (TNT und Feuer an und abschalten)
Dieser Commit ist enthalten in:
Ursprung
b10d620ef7
Commit
02a16bbb22
@ -1,8 +1,13 @@
|
||||
package de.pro_crafting.sawe;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import net.minecraft.server.v1_12_R1.World;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -10,7 +15,6 @@ 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;
|
||||
@ -18,7 +22,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
|
||||
import de.quantumnanox.warshipfactory.content.FactoryWorld;
|
||||
import de.quantumnanox.warshipfactory.content.WorldPlayer;
|
||||
import de.quantumnanox.warshipfactory.main.WarShipFactory;
|
||||
|
||||
public class RegionListener implements Listener {
|
||||
@ -41,20 +44,18 @@ public class RegionListener implements Listener {
|
||||
if (p.hasPermission("bau.team")) {
|
||||
return;
|
||||
}
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (BauweltMember.getMembers(event.getPlayer().getWorld().getUID()) == null) {
|
||||
p.sendMessage("§cDu darfst hier kein Worldedit benutzen.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp != null) {
|
||||
if (wp.canWorldEdit == false || fw == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) != null) {
|
||||
if (BauweltMember.getBauMember(event.getPlayer().getWorld().getUID(), p.getUniqueId()).isWorldEdit() == false || Bukkit.getWorld(p.getUniqueId()) == null) {
|
||||
p.sendMessage("§cDu darfst hier kein Worldedit benutzen.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID().equals(p.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
p.sendMessage("§cDu darfst hier kein Worldedit benutzen.");
|
||||
@ -72,20 +73,18 @@ public class RegionListener implements Listener {
|
||||
if (p.hasPermission("bau.team")) {
|
||||
return;
|
||||
}
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage("§cDu darfst nicht bauen.");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp != null) {
|
||||
if (wp.canBuild == false) {
|
||||
if (BauweltMember.getMembers(e.getPlayer().getWorld().getUID()) != null) {
|
||||
if (BauweltMember.getBauMember(e.getPlayer().getWorld().getUID(), p.getUniqueId()).isBuild() == false) {
|
||||
p.sendMessage("§cDu darfst nicht bauen.");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID().equals(p.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
e.setCancelled(true);
|
||||
@ -102,20 +101,18 @@ public class RegionListener implements Listener {
|
||||
if (p.hasPermission("bau.team")) {
|
||||
return;
|
||||
}
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bukkit.getWorld(e.getPlayer().getWorld().getUID()) == null) {
|
||||
p.sendMessage("§cDu darfst nicht bauen.");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp != null) {
|
||||
if (wp.canBuild == false) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) != null) {
|
||||
if (BauweltMember.getBauMember(e.getPlayer().getWorld().getUID(), p.getUniqueId()).isBuild() == false) {
|
||||
p.sendMessage("§cDu darfst nicht bauen.");
|
||||
e.setCancelled(true);
|
||||
}
|
||||
} else {
|
||||
if (fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID().equals(p.getUniqueId())) {
|
||||
return;
|
||||
}
|
||||
e.setCancelled(true);
|
||||
@ -133,17 +130,15 @@ public class RegionListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onExplode(EntityExplodeEvent e) {
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(e.getEntity().getWorld().getName());
|
||||
if (fw != null) {
|
||||
if (fw.isTntDamage() == false) e.setCancelled(true);
|
||||
if (Bukkit.getWorld(e.getLocation().getWorld().getUID()) != null) {
|
||||
if (Bauwelt.getBauwelt(Bukkit.getWorld(e.getLocation().getWorld().toString()).getUID()).isTNTDmg() == false) e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
if (Bukkit.getWorld(e.getIgnitingBlock().getWorld().getUID()) != null) {
|
||||
if (Bauwelt.getBauwelt(e.getIgnitingBlock().getWorld().getUID()).isFireDmg() == false) e.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,12 @@ import com.sk89q.worldedit.bukkit.BukkitWorld;
|
||||
import com.sk89q.worldedit.schematic.MCEditSchematicFormat;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import de.quantumnanox.warshipfactory.config.Config;
|
||||
import de.quantumnanox.warshipfactory.content.LagDetectorRunnable;
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import de.warking.hunjy.MySQL.WarkingUser;
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -23,25 +29,29 @@ import de.pro_crafting.commandframework.Command;
|
||||
import de.quantumnanox.warshipfactory.content.UUIDFetcher;
|
||||
import de.pro_crafting.commandframework.CommandArgs;
|
||||
import de.quantumnanox.warshipfactory.content.FactoryWorld;
|
||||
import de.quantumnanox.warshipfactory.content.WorldPlayer;
|
||||
import de.quantumnanox.warshipfactory.main.WarShipFactory;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import sun.security.x509.UniqueIdentity;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class CommandBau {
|
||||
@Getter
|
||||
private World wrapped;
|
||||
@Getter
|
||||
private boolean loading;
|
||||
|
||||
private BukkitTask task;
|
||||
public Config config;
|
||||
|
||||
@Command(name = "bau")
|
||||
@Command(name = "bau", aliases = "gs")
|
||||
public void onBau(CommandArgs args) {
|
||||
CommandSender s = args.getSender();
|
||||
s.sendMessage(WarShipFactory.S_PREFIX + "BauFactory by Exceptionflug updated by Diamant-ix.de Team v" + "1.2");
|
||||
s.sendMessage(WarShipFactory.S_PREFIX + "Um eine Liste mit Befehlen zu erhalten, gib §t/bau help §7ein.");
|
||||
}
|
||||
|
||||
@Command(name = "bau.help", inGameOnly = true)
|
||||
@Command(name = "bau.help", aliases = "gs.help", inGameOnly = true)
|
||||
public void onHelp(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "Hilfe Seite 1 von 2:");
|
||||
@ -62,7 +72,8 @@ public class CommandBau {
|
||||
p.sendMessage("§8/bau info - §6Zeigt dir Infos über die aktuelle Welt");
|
||||
p.sendMessage("§8/bau gui - §6Öffnet eine GUI");
|
||||
}
|
||||
@Command(name = "bau.help.2", inGameOnly = true)
|
||||
|
||||
@Command(name = "bau.help.2", aliases = "gs.help.2", inGameOnly = true)
|
||||
public void onHelp2(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "Hilfe Seite 2 von 2:");
|
||||
@ -75,29 +86,35 @@ public class CommandBau {
|
||||
p.sendMessage("§8/bau togglereplace - §6Ändert den Zustand für : Darf ein Spieler in einer Region replacen");
|
||||
p.sendMessage("§8/bau togglechgm - §6Ändert den Zustand für: Darf ein Spieler seinen Spielmodus ändern?");
|
||||
}
|
||||
@Command(name = "bau.home", inGameOnly = true)
|
||||
|
||||
@Command(name = "bau.home", aliases = "gs.home", inGameOnly = true)
|
||||
public void onHome(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
fw = new FactoryWorld(p.getUniqueId());
|
||||
WarShipFactory.getInstance().factoryWorlds.register(fw);
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()) == null) {
|
||||
new Bauwelt(p.getUniqueId(), false, false);
|
||||
}
|
||||
if (fw.isLoading()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cEinen Moment Geduld! Die Welt lädt...");
|
||||
return;
|
||||
}
|
||||
if (fw.getWrapped() == null) {
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null)
|
||||
try {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aEinen Moment bitte... Deine Welt wird vorbereitet.");
|
||||
fw.loadWorld();
|
||||
loading = true;
|
||||
File world = new File("" + p.getUniqueId());
|
||||
File region = new File("plugins/WorldGuard/worlds/" + p.getUniqueId());
|
||||
if (region.exists() && region.isDirectory()) {
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.regionDir), new File("plugins/WorldGuard/worlds/" + p.getUniqueId()));
|
||||
}
|
||||
if (world.exists() && world.isDirectory()) {
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + p.getUniqueId()));
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.backupDir), new File("" + p.getUniqueId()));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + p.getUniqueId()));
|
||||
}
|
||||
loading = false;
|
||||
} catch (Exception e) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cBeim Laden der Welt ist ein Fehler aufgetreten.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
p.teleport(fw.getWrapped().getSpawnLocation());
|
||||
p.getInventory().clear();
|
||||
p.teleport(Bukkit.getWorld(p.getUniqueId().toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(WarShipFactory.getInstance(), new Runnable() {
|
||||
public void run () {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
@ -105,11 +122,10 @@ public class CommandBau {
|
||||
},20L);
|
||||
|
||||
}
|
||||
@Command(name = "bau.addmember", inGameOnly = true)
|
||||
@Command(name = "bau.addmember", aliases = "gs.addmember", inGameOnly = true)
|
||||
public void onAdd(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast noch keine Welt.");
|
||||
return;
|
||||
}
|
||||
@ -122,21 +138,19 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
if (fw.getMember(id) != null) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id) != null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDieser Spieler ist bereits Mitglied auf deiner Welt");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = new WorldPlayer(id, fw);
|
||||
wp.canBuild = true;
|
||||
fw.getMembers().register(wp);
|
||||
new BauweltMember(p.getUniqueId(), id, true, false, false, false, false);
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler wurde zu deiner Welt hinzugefügt.");
|
||||
wp.getPlayer().sendMessage(WarShipFactory.S_PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt");
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu wurdest zu der Welt von §6" + p.getName() + " §ahinzugefügt");
|
||||
}
|
||||
@Command(name = "bau.delmember", inGameOnly = true)
|
||||
@Command(name = "bau.delmember", aliases = "gs.delmember", inGameOnly = true)
|
||||
public void onDel(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast noch keine Welt.");
|
||||
return;
|
||||
}
|
||||
@ -149,22 +163,22 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
if (fw.getMember(id) == null) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDieser Spieler ist kein Mitglied auf deiner Welt");
|
||||
return;
|
||||
}
|
||||
fw.getMembers().unregister(fw.getMembers().getID(fw.getMember(id)));
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).remove();
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler wurde entfernt.");
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "§4Du wurdest von der Welt §6" + p.getName() + ChatColor.RED + " §4entfernt");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + ChatColor.RED + "§4Du wurdest von der Welt von §6" + p.getName() + ChatColor.RED + " §4entfernt");
|
||||
if (z != null) {
|
||||
if (z.getWorld().getUID().equals(fw.getWrapped().getUID())) {
|
||||
if (z.getWorld().getUID().equals(Bukkit.getWorld(p.getUniqueId().toString()).getUID())) {
|
||||
z.teleport(WarShipFactory.getInstance().config.spawn);
|
||||
z.getInventory().clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.tp", inGameOnly = true)
|
||||
@Command(name = "bau.tp", aliases = "gs.tp", inGameOnly = true)
|
||||
public void onTp(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
if (args.length() == 0) {
|
||||
@ -177,34 +191,55 @@ public class CommandBau {
|
||||
return;
|
||||
}
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(id);
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler hat keine Welt");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!p.hasPermission("bau.team")) {
|
||||
if (fw.getMember(p.getUniqueId()) == null) {
|
||||
if (BauweltMember.getBauMember(id, p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu bist kein Mitglied dieser Welt");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (fw.getWrapped() == null) {
|
||||
fw.loadWorld();
|
||||
if (Bukkit.getWorld(id) == null)
|
||||
try {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aEinen Moment bitte... Deine Welt wird vorbereitet.");
|
||||
loading = true;
|
||||
File world = new File("plugins/WarShipFactory/worlds/" + id);
|
||||
File region = new File("plugins/WorldGuard/worlds/" + id);
|
||||
if (region.exists() && region.isDirectory()) {
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.regionDir), new File("plugins/WorldGuard/worlds/" + id));
|
||||
}
|
||||
p.getInventory().clear();
|
||||
p.teleport(fw.getWrapped().getSpawnLocation());
|
||||
if (world.exists() && world.isDirectory()) {
|
||||
FileUtils.moveDirectory(world, new File("" + id));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + id));
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.backupDir), new File("" + id));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + id));
|
||||
}
|
||||
loading = false;
|
||||
} catch (Exception e) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cBeim Laden der Welt ist ein Fehler aufgetreten.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
p.teleport(Bukkit.getWorld(id.toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(WarShipFactory.getInstance(), new Runnable() {
|
||||
public void run() {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
if (!unloadWorld(p.getUniqueId().toString())) {
|
||||
WarShipFactory.log("FactoryWorld", "Unable to unload " + Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID());
|
||||
}
|
||||
}
|
||||
}, 20);
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDu wurdest teleportiert.");
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cFehla.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.flyspeed", inGameOnly = true)
|
||||
@Command(name = "bau.flyspeed", aliases = "gs.flyspeed", inGameOnly = true)
|
||||
public void onflyspeed(CommandArgs args){
|
||||
final Player player = args.getPlayer();
|
||||
if (args.length() == 0){
|
||||
@ -267,14 +302,9 @@ public class CommandBau {
|
||||
}
|
||||
return;
|
||||
}
|
||||
@Command(name = "bau.gui", inGameOnly = true)
|
||||
@Command(name = "bau.gui", aliases = "gs.gui", inGameOnly = true)
|
||||
public boolean ongui(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return false;
|
||||
} else {
|
||||
Inventory inv = Bukkit.createInventory(null, 9, "§aBau Optionen");
|
||||
ItemStack bau = new ItemStack(Material.COMPASS);
|
||||
ItemMeta meta = bau.getItemMeta();
|
||||
@ -294,12 +324,10 @@ public class CommandBau {
|
||||
p.openInventory(inv);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.togglewe", inGameOnly = true)
|
||||
@Command(name = "bau.togglewe", aliases = "gs.togglewe", inGameOnly = true)
|
||||
public void onToggleWE(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}
|
||||
@ -312,31 +340,31 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canWorldEdit = !wp.canWorldEdit;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id);
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canWorldEdit) {
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit());
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a WorldEdit verwenden.");
|
||||
}else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c WorldEdit verwenden.");
|
||||
}
|
||||
}
|
||||
if (wp.canWorldEdit) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf WorldEdit verwenden.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf kein WorldEdit verwenden.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.toggletp", inGameOnly = true)
|
||||
@Command(name = "bau.toggletp", aliases = "gs.toggletp", inGameOnly = true)
|
||||
public void onToggleTP(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}
|
||||
@ -349,27 +377,26 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canTeleport = !wp.canTeleport;
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setTeleport(!BauweltMember.getBauMember(p.getUniqueId(), id).isTeleport());
|
||||
if (z != null) {
|
||||
if (wp.canTeleport) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isTeleport()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a /tp verwenden.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c /tp verwenden.");
|
||||
}
|
||||
}
|
||||
if (wp.canTeleport) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isTeleport()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf sich teleportieren.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf sich nicht teleportieren.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.togglebuild", inGameOnly = true)
|
||||
@Command(name = "bau.togglebuild", aliases = "gs.togglebuild", inGameOnly = true)
|
||||
public void onToggleBD(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
@ -386,27 +413,26 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canBuild = !wp.canBuild;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setTeleport(!BauweltMember.getBauMember(p.getUniqueId(), id).isTeleport());
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canBuild) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isBuild()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a bauen.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c bauen.");
|
||||
}
|
||||
}
|
||||
if (wp.canBuild) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isBuild()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf bauen.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf nicht bauen.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.togglechgm", inGameOnly = true)
|
||||
@Command(name = "bau.togglechgm", aliases = "gs.togglechgm", inGameOnly = true)
|
||||
public void onToggleCHG(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
@ -423,27 +449,26 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canChangeGamemode = !wp.canChangeGamemode;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setChangeGM(!BauweltMember.getBauMember(p.getUniqueId(), id).isChangeGM());
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canChangeGamemode) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isChangeGM()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a deinen Spielmodus ändern.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c deinen Spielmodus ändern.");
|
||||
}
|
||||
}
|
||||
if (wp.canChangeGamemode) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isChangeGM()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf seinen Spielmodus ändern.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf nicht seinen Spielmodus ändern.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.toggletestblock", inGameOnly = true)
|
||||
@Command(name = "bau.toggletestblock", aliases = "gs.testblock", inGameOnly = true)
|
||||
public void onToggleTestblock(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
@ -460,27 +485,26 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canTestBlock = !wp.canTestBlock;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setTestblock(!BauweltMember.getBauMember(p.getUniqueId(), id).isTestblock());
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canTestBlock) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isTestblock()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a die TestBlöcke erneuern.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c die TestBlöcke erneuern.");
|
||||
}
|
||||
}
|
||||
if (wp.canTestBlock) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isTestblock()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf nun deine TestBlöcke erneuern.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf keine TestBlöcke mehr reseten.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.togglereset", inGameOnly = true)
|
||||
@Command(name = "bau.togglereset", aliases = "gs.togglereset", inGameOnly = true)
|
||||
public void onTogglereset(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
@ -497,64 +521,26 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canReset = !wp.canReset;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canReset) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a die Regionen erneuern.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c die Regionen erneuern.");
|
||||
}
|
||||
}
|
||||
if (wp.canReset) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf nun deine Regionen erneuern.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf deine Regionen nicht mehr erneuern.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.toggleresetall", inGameOnly = true)
|
||||
public void onToggleresetall(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;
|
||||
}
|
||||
if (args.length() == 0) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§bBenutzung: /bau toggleresetall <Spieler>");
|
||||
return;
|
||||
}
|
||||
UUID id = UUIDFetcher.getUUID(args.getArgs(0));
|
||||
if (id == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canResetAll = !wp.canResetAll;
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canResetAll) {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a die Welt erneuern.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c die Welt erneuern.");
|
||||
}
|
||||
}
|
||||
if (wp.canResetAll) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf nun deine Welt erneuern.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf nun deine Welt nicht mehr erneuern.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.togglereplace", inGameOnly = true)
|
||||
@Command(name = "bau.togglereplace", aliases = "gs.togglereplace", inGameOnly = true)
|
||||
public void onTogglereplace(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
@ -571,37 +557,34 @@ public class CommandBau {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cUnbekannter Spieler");
|
||||
return;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(id);
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
return;
|
||||
}
|
||||
wp.canReplace = !wp.canReplace;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), id).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(id);
|
||||
if (z != null) {
|
||||
if (wp.canReplace) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()){
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a TNT und Schleim replacen.");
|
||||
} else {
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun nicht mehr auf der Welt von §6" + p.getName() + "§c TNT und Schleim replacen.");
|
||||
}
|
||||
}
|
||||
if (wp.canReplace) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), id).isWorldEdit()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf nun in diener Welt TNT und Schleim replacen.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler darf nun in deiner Welt kein TNT und Schleim mehr replacen.");
|
||||
}
|
||||
}
|
||||
@Command(name = "bau.testblock", inGameOnly = true)
|
||||
@Command(name = "bau.testblock", aliases = "gs.testblock", inGameOnly = true)
|
||||
public boolean ontestblock(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return false;
|
||||
} else {
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canTestBlock == false) {
|
||||
if (!Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).equals(p.getUniqueId())) {
|
||||
if (BauweltMember.getBauMember(Bukkit.getWorld(p.getUniqueId()).getUID(), p.getUniqueId()).isWorldEdit() == false) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§7Du darfst den TestBlock nicht erneuern");
|
||||
return false;
|
||||
}
|
||||
@ -630,17 +613,15 @@ public class CommandBau {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Command(name = "bau.reset", inGameOnly = true)
|
||||
@Command(name = "bau.reset", aliases = "gs.reset", inGameOnly = true)
|
||||
public boolean onReset(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return false;
|
||||
} else {
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canReset == false) {
|
||||
if (!Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID().equals(p.getUniqueId())) {
|
||||
if (BauweltMember.getBauMember(Bukkit.getWorld(p.getUniqueId()).getUID(), p.getUniqueId()).isWorldEdit() == false) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§7Du darfst keine Regionen erneuern");
|
||||
return false;
|
||||
}
|
||||
@ -669,55 +650,52 @@ public class CommandBau {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Command(name = "bau.resetall", inGameOnly = true)
|
||||
@Command(name = "bau.resetall", aliases = "gs.resetall", inGameOnly = true)
|
||||
public boolean onresetall(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return false;
|
||||
} else {
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canResetAll == false) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§7Du darfst die Welt nicht erneuern");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (Player ap : Bukkit.getOnlinePlayers()) {
|
||||
if(ap.getWorld().getName() == fw.getWorldAddress()) {
|
||||
if (ap.getWorld().getName() == p.getName()) {
|
||||
|
||||
Location location = new Location(Bukkit.getWorld("Bauspawn"), 1442, 113, 228, -151.9F, -4.2F);
|
||||
ap.teleport(location);
|
||||
ap.sendMessage(WarShipFactory.S_PREFIX + "Die Welt wird erneuert!");
|
||||
}
|
||||
}
|
||||
fw.unloadWorld();
|
||||
if (!unloadWorld(p.getUniqueId().toString())) {
|
||||
WarShipFactory.log("FactoryWorld", "Unable to unload " + Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID());
|
||||
}
|
||||
|
||||
File directory = new File("plugins/WarShipFactory/worlds/" + fw.getWorldAddress());
|
||||
File directory = new File("" + p.getUniqueId());
|
||||
del(directory);
|
||||
|
||||
FactoryWorld fw1 = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw1 == null) {
|
||||
fw1 = new FactoryWorld(p.getUniqueId());
|
||||
WarShipFactory.getInstance().factoryWorlds.register(fw1);
|
||||
}
|
||||
if (fw1.isLoading()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cEinen Moment Geduld! Die Welt wird erneuert...");
|
||||
return false;
|
||||
}
|
||||
if (fw.getWrapped() == null) {
|
||||
File directory1 = new File("plugins/WorldGuard/worlds/" + p.getUniqueId());
|
||||
del(directory1);
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null)
|
||||
try {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aEinen Moment bitte... Deine Welt wird vorbereitet.");
|
||||
fw.loadWorld();
|
||||
loading = true;
|
||||
File world = new File("plugins/WarShipFactory/worlds/" + p.getUniqueId());
|
||||
File region = new File("plugins/WorldGuard/worlds/" + p.getUniqueId());
|
||||
if (region.exists() && region.isDirectory()) {
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.regionDir), new File("plugins/WorldGuard/worlds/" + p.getUniqueId()));
|
||||
}
|
||||
if (world.exists() && world.isDirectory()) {
|
||||
FileUtils.moveDirectory(world, new File("" + p.getUniqueId()));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + p.getUniqueId()));
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.backupDir), new File("" + p.getUniqueId()));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + p.getUniqueId()));
|
||||
}
|
||||
loading = false;
|
||||
} catch (Exception e) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cBeim Laden der Welt ist ein Fehler aufgetreten.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
p.teleport(fw1.getWrapped().getSpawnLocation());
|
||||
p.getInventory().clear();
|
||||
p.teleport(Bukkit.getWorld(p.getUniqueId().toString()).getSpawnLocation());
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(WarShipFactory.getInstance(), new Runnable() {
|
||||
public void run () {
|
||||
p.setGameMode(GameMode.CREATIVE);
|
||||
@ -726,17 +704,16 @@ public class CommandBau {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Command(name = "bau.replace", inGameOnly = true)
|
||||
@Command(name = "bau.replace", aliases = "gs.replace", inGameOnly = true)
|
||||
public boolean onreplace(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return false;
|
||||
} else {
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canReplace == false) {
|
||||
if (!p.getUniqueId().equals(p.getUniqueId())) {
|
||||
World world = Bukkit.getWorld(p.getUniqueId());
|
||||
if (BauweltMember.getBauMember(Bukkit.getWorld(p.getUniqueId()).getUID(), p.getUniqueId()).isWorldEdit() == false) {
|
||||
p.sendMessage("Du darfst in der Welt von " + p.getDisplayName() + " kein TNT und Schleim replacen!");
|
||||
return false;
|
||||
}
|
||||
@ -776,11 +753,10 @@ public class CommandBau {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Command(name = "bau.info", inGameOnly = true)
|
||||
@Command(name = "bau.info", aliases = "gs.info", inGameOnly = true)
|
||||
public void onInfo(CommandArgs args) {
|
||||
final Player p = args.getPlayer();
|
||||
final FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu stehst auf keiner Bauwelt");
|
||||
return;
|
||||
}
|
||||
@ -789,26 +765,17 @@ public class CommandBau {
|
||||
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()) {
|
||||
members.append(UUIDFetcher.getName(wp.getUuid()) + ", ");
|
||||
}
|
||||
String membas = "";
|
||||
if (!members.toString().isEmpty()) {
|
||||
membas = members.toString().trim().substring(0, members.toString().trim().length() - 1);
|
||||
}
|
||||
membas = membas.isEmpty() ? "Keine" : membas;
|
||||
p.sendMessage("§8Registrierungsnummer: §6" + WarShipFactory.getInstance().factoryWorlds.getID(fw));
|
||||
p.sendMessage("§8Adresse: §6" + fw.getWorldAddress());
|
||||
String ownaz = UUIDFetcher.getName(p.getUniqueId());
|
||||
p.sendMessage("§8Registrierungsnummer: §6" + Bauwelt.getBauwelt(p.getUniqueId()).getUUID().toString());
|
||||
p.sendMessage("§8Besitzer: §6" + ownaz);
|
||||
p.sendMessage("§8Mitglieder: §6" + membas);
|
||||
p.sendMessage("§8Mitglieder: §6" + BauweltMember.getMembers(p.getUniqueId()).get(1));
|
||||
p.sendMessage("");
|
||||
if (fw.isTntDamage()) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg()) {
|
||||
p.sendMessage("§8TNT Schaden: §6" + "§aTNT Schaden erlaubt.");
|
||||
} else {
|
||||
p.sendMessage("§8TNT Schaden: §6" + "§cTNT Schaden verboten.");
|
||||
}
|
||||
if (fw.isFireDamage()) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg()) {
|
||||
p.sendMessage("§8Feuer Schaden: §6" + "§aFeuer Schaden erlaubt.");
|
||||
} else {
|
||||
p.sendMessage("§8Feuer Schaden: §6" + "§cFeuer Schaden verboten.");
|
||||
@ -817,37 +784,65 @@ public class CommandBau {
|
||||
});
|
||||
}
|
||||
|
||||
@Command(name = "bau.tntdmg", inGameOnly = true)
|
||||
@Command(name = "bau.tntdmg", aliases = "gs.tntdmg", inGameOnly = true)
|
||||
public void onTntdmg(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}
|
||||
fw.setTntDamage(!fw.isTntDamage());
|
||||
if (fw.isTntDamage()) {
|
||||
Bauwelt.getBauwelt(p.getUniqueId()).setTNTDmg(!Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg());
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aTNT Schaden erlaubt.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cTNT Schaden verboten.");
|
||||
}
|
||||
}
|
||||
|
||||
@Command(name = "bau.firedmg", inGameOnly = true)
|
||||
@Command(name = "bau.firedmg", aliases = "gs.firedmg", inGameOnly = true)
|
||||
public void onFiredmg(CommandArgs args) {
|
||||
Player p = args.getPlayer();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
return;
|
||||
}
|
||||
fw.setFireDamage(!fw.isFireDamage());
|
||||
if (fw.isFireDamage()) {
|
||||
Bauwelt.getBauwelt(p.getUniqueId()).setFireDmg(!Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg());
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aFeuer Schaden erlaubt.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cFeuer Schaden verboten.");
|
||||
}
|
||||
}
|
||||
private boolean isLoaded(String world) {
|
||||
for (World w : Bukkit.getServer().getWorlds()) {
|
||||
if (w.getName().equals(world)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean unloadWorld(String world) {
|
||||
if (isLoaded(world)) {
|
||||
World w = Bukkit.getWorld(world);
|
||||
for (Player p : w.getPlayers()) {
|
||||
p.teleport(WarShipFactory.getInstance().config.spawn);
|
||||
}
|
||||
|
||||
for (Chunk c : w.getLoadedChunks()) {
|
||||
c.unload();
|
||||
}
|
||||
|
||||
boolean unload = Bukkit.unloadWorld(w, true);
|
||||
return unload;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void pasteSchematic(Player player, File schematic, Vector position) {
|
||||
|
||||
|
@ -3,6 +3,8 @@ package de.quantumnanox.warshipfactory.commands;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -16,7 +18,6 @@ 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 CommandGamemode extends BukkitCommand {
|
||||
@ -35,22 +36,15 @@ public class CommandGamemode extends BukkitCommand {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("bukkit.command.gamemode") == false) {
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null) {
|
||||
p.sendMessage("Du befindest dich auf keiner Bauwelt!");
|
||||
return false;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp == null && !fw.getOwner().equals(p.getUniqueId())) {
|
||||
BauweltMember.getMembers(p.getUniqueId());
|
||||
if (BauweltMember.getMembers(p.getUniqueId()) == null && !Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID().equals(p.getUniqueId())) {
|
||||
p.sendMessage("Du bist kein Mitglied dieser Welt!");
|
||||
return false;
|
||||
}
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canChangeGamemode == false) {
|
||||
p.sendMessage("Du darfst deinen Spielmodus nicht ändern!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// END
|
||||
|
@ -1,27 +1,19 @@
|
||||
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 de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import javax.tools.JavaFileManager;
|
||||
import java.io.File;
|
||||
|
||||
public class CommandGui implements Listener {
|
||||
|
||||
public Location warship1;
|
||||
@ -226,13 +218,13 @@ public class CommandGui implements Listener {
|
||||
//code
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
fw.setTntDamage(!fw.isTntDamage());
|
||||
if (fw.isTntDamage()) {
|
||||
Bauwelt.getBauwelt(p.getUniqueId()).setTNTDmg(!Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg());
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aAuf deiner Welt ist jetzt TNT Schaden erlaubt.");
|
||||
} else {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cAuf deiner Welt ist jetzt TNT Schaden verboten.");
|
||||
@ -245,13 +237,13 @@ public class CommandGui implements Listener {
|
||||
//code
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(p.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
fw.setFireDamage(!fw.isFireDamage());
|
||||
if (fw.isFireDamage()) {
|
||||
Bauwelt.getBauwelt(p.getUniqueId()).setFireDmg(!Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg());
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg()) {
|
||||
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.");
|
||||
@ -351,7 +343,7 @@ public class CommandGui implements Listener {
|
||||
if (fw == null) {
|
||||
player.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
}
|
||||
if (fw.getMember(target.getUniqueId()) != null) {
|
||||
if (BauweltMember.getBauMember(player.getUniqueId(), target.getUniqueId()) != null) {
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aSpieler hinzufügen")) {
|
||||
//code
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
@ -363,8 +355,7 @@ public class CommandGui implements Listener {
|
||||
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);
|
||||
new BauweltMember(p.getUniqueId(),target.getUniqueId(), true, false, false, false, false);
|
||||
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));
|
||||
@ -379,18 +370,17 @@ public class CommandGui implements Listener {
|
||||
player.closeInventory();
|
||||
player.openInventory(spieleroption(p));
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(target.getUniqueId());
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getBauMember(player.getUniqueId(), target.getUniqueId()) == null) {
|
||||
e.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle Worldedit")) {
|
||||
//code
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
wp.canWorldEdit = !wp.canWorldEdit;
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canWorldEdit) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt auf deiner Welt Worldedit benutzten.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a WorldEdit verwenden.");
|
||||
p.closeInventory();
|
||||
@ -407,11 +397,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle Teleport")) {
|
||||
//code
|
||||
wp.canTeleport = !wp.canTeleport;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setTeleport(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isTeleport());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canTeleport) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isTeleport())) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler kann sich jetzt auf deiner Welt Teleportieren.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a /tp verwenden.");
|
||||
p.closeInventory();
|
||||
@ -428,11 +418,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle Build")) {
|
||||
//code
|
||||
wp.canBuild = !wp.canBuild;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setBuild(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isBuild());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canBuild) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isBuild())) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt Bauen auf deiner Welt.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a bauen.");
|
||||
p.closeInventory();
|
||||
@ -449,11 +439,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle ChangeGamemode")) {
|
||||
//code
|
||||
wp.canChangeGamemode = !wp.canChangeGamemode;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setChangeGM(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isChangeGM());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canChangeGamemode) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isChangeGM())) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt sein Gamemode auf deiner Welt wechseln.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§aDu kannst nun auf der Welt von §6" + p.getName() + "§a deinen Spielmodus ändern.");
|
||||
p.closeInventory();
|
||||
@ -471,12 +461,14 @@ public class CommandGui implements Listener {
|
||||
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())));
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).remove();
|
||||
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");
|
||||
e.setCancelled(true);
|
||||
player.openInventory(skullOwnerInventory(target, player));
|
||||
if (z != null) {
|
||||
if (z.getWorld().getUID().equals(fw.getWrapped().getUID())) {
|
||||
if (z.getWorld().getUID().equals(Bukkit.getWorld(p.getUniqueId().toString()).getUID())) {
|
||||
z.teleport(WarShipFactory.getInstance().config.spawn);
|
||||
z.getInventory().clear();
|
||||
}
|
||||
@ -486,11 +478,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle Replace")) {
|
||||
//code
|
||||
wp.canReplace = !wp.canReplace;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canReplace) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit())) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt auf deiner Welt Replacen.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun auf der Welt von §6" + p.getName() + "§c /bau replace verwenden.");
|
||||
p.closeInventory();
|
||||
@ -507,11 +499,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle Reset")) {
|
||||
//code
|
||||
wp.canReset = !wp.canReset;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canReset) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit())) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt auf deiner Welt einzelne Regionen erneuern.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun auf der Welt von §6" + p.getName() + "§c /bau reset verwenden.");
|
||||
p.closeInventory();
|
||||
@ -528,11 +520,11 @@ public class CommandGui implements Listener {
|
||||
}
|
||||
if (e.getCurrentItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "§aToggle TestBlock")) {
|
||||
//code
|
||||
wp.canTestBlock = !wp.canTestBlock;
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
Player p = (Player) e.getWhoClicked();
|
||||
BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).setWorldEdit(!BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit());
|
||||
Player z = Bukkit.getPlayer(target.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canTestBlock) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isWorldEdit()) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§aDer Spieler darf jetzt auf deiner Welt TestBlöcke erneuern.");
|
||||
z.sendMessage(WarShipFactory.S_PREFIX + "§cDu kannst nun auf der Welt von §6" + p.getName() + "§c /bau testblock verwenden.");
|
||||
p.closeInventory();
|
||||
@ -654,16 +646,15 @@ public class CommandGui implements Listener {
|
||||
|
||||
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldFromOwner(player.getUniqueId());
|
||||
if (fw == null) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).getUUID() == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDu hast keine Welt");
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp == null) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), player.getUniqueId()) == null) {
|
||||
p.sendMessage(WarShipFactory.S_PREFIX + "§cDer Spieler ist kein Mitglied deiner Welt");
|
||||
} else {
|
||||
Player z = Bukkit.getPlayer(p.getUniqueId());
|
||||
if (z != null) {
|
||||
if (wp.canWorldEdit) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isWorldEdit())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -676,7 +667,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(10, tntst1);
|
||||
}
|
||||
if (wp.canTeleport) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isTeleport())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -689,7 +680,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(11, tntst1);
|
||||
}
|
||||
if (wp.canBuild) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isBuild())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -702,7 +693,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(12, tntst1);
|
||||
}
|
||||
if (wp.canChangeGamemode) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isChangeGM())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -715,7 +706,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(13, tntst1);
|
||||
}
|
||||
if (wp.canReplace) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isWorldEdit())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -728,7 +719,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(14, tntst1);
|
||||
}
|
||||
if (wp.canReset) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isWorldEdit())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -741,7 +732,7 @@ public class CommandGui implements Listener {
|
||||
tntst1.setItemMeta(meta);
|
||||
inv2.setItem(15, tntst1);
|
||||
}
|
||||
if (wp.canTestBlock) {
|
||||
if ((BauweltMember.getBauMember(p.getUniqueId(), p.getUniqueId()).isWorldEdit())) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -924,7 +915,7 @@ public class CommandGui implements Listener {
|
||||
fire.setItemMeta(meta);
|
||||
inv2.setItem(8, fire);
|
||||
p.openInventory(inv2);
|
||||
if (fw.isTntDamage()) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isTNTDmg()) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
@ -941,7 +932,7 @@ public class CommandGui implements Listener {
|
||||
p.closeInventory();
|
||||
p.openInventory(inv2);
|
||||
}
|
||||
if (fw.isFireDamage()) {
|
||||
if (Bauwelt.getBauwelt(p.getUniqueId()).isFireDmg()) {
|
||||
ItemStack tntst = new ItemStack(351, 1, (short) 10);
|
||||
meta = tntst.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.RED + "§eStatus §2An");
|
||||
|
@ -3,6 +3,8 @@ package de.quantumnanox.warshipfactory.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -16,7 +18,6 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
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 CommandTeleport extends BukkitCommand {
|
||||
@ -36,18 +37,16 @@ public class CommandTeleport extends BukkitCommand {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("bukkit.command.teleport") == false) {
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bukkit.getWorld(p.getUniqueId()).getName() == null) {
|
||||
p.sendMessage("Du befindest dich auf keiner Bauwelt!");
|
||||
return false;
|
||||
}
|
||||
WorldPlayer wp = fw.getMember(p.getUniqueId());
|
||||
if (wp == null && !fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (BauweltMember.getBauMember(Bukkit.getWorld(p.getUniqueId()).getUID(), p.getUniqueId()) == null && !Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID().equals(p.getUniqueId())) {
|
||||
p.sendMessage("Du bist kein Mitglied dieser Welt!");
|
||||
return false;
|
||||
}
|
||||
if (!fw.getOwner().equals(p.getUniqueId())) {
|
||||
if (wp.canTeleport == false) {
|
||||
if (!Bauwelt.getBauwelt(Bukkit.getWorld(p.getUniqueId()).getUID()).getUUID().equals(p.getUniqueId())) {
|
||||
if (BauweltMember.getBauMember(Bukkit.getWorld(p.getUniqueId()).getUID(), p.getUniqueId()).isTeleport() == false) {
|
||||
p.sendMessage("Du darfst dich auf dieser Welt nicht teleportieren!");
|
||||
return false;
|
||||
}
|
||||
@ -78,28 +77,25 @@ public class CommandTeleport extends BukkitCommand {
|
||||
|
||||
// SEAGIANTS
|
||||
if (!sender.hasPermission("bukkit.command.teleport")) {
|
||||
FactoryWorld fw = WarShipFactory.getInstance().getWorldByAddress(player.getWorld().getName());
|
||||
if (fw == null) {
|
||||
if (Bukkit.getWorld(player.getUniqueId()) == null) {
|
||||
sender.sendMessage("Der Spieler befindet sich auf keiner Bauwelt.");
|
||||
return false;
|
||||
}
|
||||
FactoryWorld fwt = WarShipFactory.getInstance().getWorldByAddress(target.getWorld().getName());
|
||||
if (fwt == null) {
|
||||
if (Bukkit.getWorld(target.getUniqueId()) == null) {
|
||||
sender.sendMessage("Der Zielspieler befindet sich auf keiner Bauwelt.");
|
||||
return false;
|
||||
}
|
||||
if (fw.getWrapped().getUID().equals(fwt.getWrapped().getUID()) == false) {
|
||||
if (BauweltMember.getBauMember(player.getUniqueId(), target.getUniqueId()).isTeleport() == false){
|
||||
sender.sendMessage("Die Spieler sind nicht auf der selben Bauwelt.");
|
||||
return false;
|
||||
}
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
FactoryWorld fwp = WarShipFactory.getInstance().getWorldByAddress(p.getWorld().getName());
|
||||
if (fwp == null) {
|
||||
if (Bukkit.getWorld(p.getUniqueId()) == null) {
|
||||
p.sendMessage("Du bist auf keiner Bauwelt");
|
||||
return false;
|
||||
}
|
||||
if (fwt.getWrapped().getUID().equals(fwp.getWrapped().getUID()) == false) {
|
||||
if (BauweltMember.getBauMember(p.getUniqueId(), target.getUniqueId()).isTeleport() == false) {
|
||||
p.sendMessage("Das Ziel befindet sich nicht auf deiner Welt");
|
||||
return false;
|
||||
}
|
||||
|
@ -4,6 +4,9 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import net.minecraft.server.v1_12_R1.PlayerList;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
@ -13,38 +16,22 @@ import org.bukkit.WorldCreator;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import de.quantumnanox.warshipfactory.main.CobixTagFormatSupported;
|
||||
import de.quantumnanox.warshipfactory.main.Registry;
|
||||
import de.quantumnanox.warshipfactory.main.WarShipFactory;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.thecobix.tag.TagCompound;
|
||||
|
||||
public class FactoryWorld extends CobixTagFormatSupported {
|
||||
public class FactoryWorld {
|
||||
|
||||
private int regId;
|
||||
|
||||
@Getter
|
||||
private World wrapped;
|
||||
|
||||
@Getter
|
||||
private Registry<WorldPlayer> members = new Registry<>(WorldPlayer.class, "members");
|
||||
|
||||
@Getter
|
||||
private String worldAddress;
|
||||
|
||||
@Getter
|
||||
private UUID owner;
|
||||
|
||||
@Getter
|
||||
private boolean loading;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean tntDamage;
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean fireDamage;
|
||||
|
||||
private BukkitTask task;
|
||||
|
||||
@ -52,83 +39,51 @@ public class FactoryWorld extends CobixTagFormatSupported {
|
||||
task = Bukkit.getScheduler().runTaskTimer(WarShipFactory.getInstance(), new LagDetectorRunnable(this), 20, 20);
|
||||
}
|
||||
|
||||
public FactoryWorld(UUID ownaz) {
|
||||
this.owner = ownaz;
|
||||
this.worldAddress = Bukkit.getPlayer(ownaz).getUniqueId().toString();
|
||||
task = Bukkit.getScheduler().runTaskTimer(WarShipFactory.getInstance(), new LagDetectorRunnable(this), 20, 20);
|
||||
public void load(UUID ownaz) {
|
||||
owner = Bauwelt.getBauwelt(ownaz).getUUID();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TagCompound save() {
|
||||
TagCompound out = new TagCompound(regId + "");
|
||||
out.put(members.save());
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void load(TagCompound tc) {
|
||||
members.load(tc.getTagCompound("members"));
|
||||
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 {
|
||||
public void loadWorld(UUID ownaz) throws IOException {
|
||||
loading = true;
|
||||
File world = new File("plugins/WarShipFactory/worlds/" + worldAddress);
|
||||
File region = new File("plugins/WorldGuard/worlds/" + worldAddress);
|
||||
File world = new File("plugins/WarShipFactory/worlds/" + ownaz);
|
||||
File region = new File("plugins/WorldGuard/worlds/" + ownaz);
|
||||
if (region.exists() && region.isDirectory()) {
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.regionDir), new File("plugins/WorldGuard/worlds/" + worldAddress));
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.regionDir), new File("plugins/WorldGuard/worlds/" + ownaz));
|
||||
}
|
||||
if (world.exists() && world.isDirectory()) {
|
||||
FileUtils.moveDirectory(world, new File(worldAddress));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator(worldAddress));
|
||||
FileUtils.moveDirectory(world, new File("" + ownaz));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + ownaz));
|
||||
} else {
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.backupDir), new File(worldAddress));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator(worldAddress));
|
||||
FileUtils.copyDirectory(new File(WarShipFactory.getInstance().config.backupDir), new File("" + ownaz));
|
||||
wrapped = Bukkit.createWorld(new WorldCreator("" + ownaz));
|
||||
}
|
||||
loading = false;
|
||||
}
|
||||
|
||||
public void unloadWorld() {
|
||||
public void unloadWorld(UUID ownaz) {
|
||||
wrapped.save();
|
||||
for (final WorldPlayer wp : members.getAll().values()) {
|
||||
if (wp.getPlayer() != null) {
|
||||
if (wp.getPlayer().getWorld().getUID().equals(wrapped.getUID())) {
|
||||
wp.getPlayer().sendMessage(WarShipFactory.S_PREFIX + "§cDie Welt wurde aus dem Arbeitsspeicher gelöscht...");
|
||||
wp.getPlayer().teleport(WarShipFactory.getInstance().config.spawn);
|
||||
{
|
||||
if (BauweltMember.getMembers(ownaz) != null) {
|
||||
if (BauweltMember.getMembers(ownaz).equals(wrapped.getUID())) {
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(WarShipFactory.getInstance(), new Runnable() {
|
||||
public void run() {
|
||||
wp.getPlayer().setGameMode(GameMode.SURVIVAL);
|
||||
}
|
||||
}, 20L);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!unloadWorld(worldAddress)) {
|
||||
WarShipFactory.log("FactoryWorld", "Unable to unload " + worldAddress);
|
||||
if (!unloadWorld("" + ownaz)) {
|
||||
WarShipFactory.log("FactoryWorld", "Unable to unload " + ownaz);
|
||||
}
|
||||
wrapped = null;
|
||||
try {
|
||||
FileUtils.moveDirectory(new File(worldAddress), new File("plugins/WarShipFactory/worlds/" + worldAddress));
|
||||
FileUtils.moveDirectory(new File("" + ownaz), new File("plugins/WarShipFactory/worlds/" + ownaz));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public WorldPlayer getMember(UUID uuid) {
|
||||
for (WorldPlayer wp : members.getAll().values()) {
|
||||
if (wp.getUuid().equals(uuid)) return wp;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private boolean isLoaded(String world) {
|
||||
for (World w : Bukkit.getServer().getWorlds()) {
|
||||
|
@ -42,7 +42,7 @@ public class LagDetectorRunnable implements Runnable {
|
||||
}
|
||||
long diff = System.currentTimeMillis() - timerstart;
|
||||
if (players == 0 && timeout && diff > 1000*60) {
|
||||
world.unloadWorld();
|
||||
world.unloadWorld(null);
|
||||
return;
|
||||
}
|
||||
if (other > 1000) {
|
||||
|
@ -7,12 +7,17 @@ import de.pro_crafting.sawe.RegionListener;
|
||||
import de.quantumnanox.warshipfactory.commands.*;
|
||||
import de.quantumnanox.warshipfactory.config.Config;
|
||||
import de.quantumnanox.warshipfactory.content.FactoryWorld;
|
||||
import de.warking.hunjy.MySQL.Bauwelt;
|
||||
import de.warking.hunjy.MySQL.BauweltMember;
|
||||
import de.warking.hunjy.MySQL.WarkingUser;
|
||||
import lombok.Getter;
|
||||
import net.thecobix.tag.Tag;
|
||||
import net.thecobix.tag.TagCompound;
|
||||
import net.thecobix.tag.TagInputStream;
|
||||
import net.thecobix.tag.TagOutputStream;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -48,8 +53,9 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
public static final String S_PREFIX = "§8[§3BauFactory§8] §7";
|
||||
|
||||
public Config config;
|
||||
@Getter
|
||||
private World wrapped;
|
||||
private CommandFramework cmdFramework;
|
||||
public Registry<FactoryWorld> factoryWorlds = new Registry<>(FactoryWorld.class, "worlds");
|
||||
private BungeeUtil bungeeUtil;
|
||||
public File regions = new File("plugins/WarShipFactory", "regions.data");
|
||||
public FileConfiguration getRegionData = YamlConfiguration.loadConfiguration(regions);
|
||||
@ -100,7 +106,6 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
try {
|
||||
CommandRemover.removeCommand("tp");
|
||||
CommandInjector.injectCommand(new CommandTeleport());
|
||||
|
||||
CommandRemover.removeCommand("gamemode");
|
||||
CommandInjector.injectCommand(new CommandGamemode());
|
||||
|
||||
@ -112,63 +117,6 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
config = new Config();
|
||||
config.initConfig();
|
||||
log("Bootstrap", "§aConfig loaded.");
|
||||
try {
|
||||
TagInputStream tis = new TagInputStream(new FileInputStream(new File("plugins/WarShipFactory/backend.ctf")), TagInputStream.GZIP);
|
||||
List<Tag> tags = tis.readTags();
|
||||
tis.close();
|
||||
Tag t = (TagCompound) tags.get(0);
|
||||
factoryWorlds.load((TagCompound) t);
|
||||
log("Bootstrap", "§aBackend loaded.");
|
||||
} catch (IOException e) {
|
||||
log("Bootstrap", "§cLoading backend failed:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
TagOutputStream tos = new TagOutputStream(
|
||||
new FileOutputStream(new File("plugins/WarShipFactory/backend.ctf")), TagOutputStream.GZIP);
|
||||
tos.write(factoryWorlds.save());
|
||||
tos.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}, 60, 60);
|
||||
for (FactoryWorld fw : factoryWorlds.getAll().values()) {
|
||||
File f = new File(fw.getWorldAddress());
|
||||
if (f.exists() && f.isDirectory()) {
|
||||
File bck = new File("plugins/WarShipFactory/worlds/" + fw.getWorldAddress());
|
||||
if (bck.exists() && bck.isDirectory()) {
|
||||
try {
|
||||
log("Bootstrap", "§9Removing dead world " + fw.getWorldAddress());
|
||||
FileUtils.deleteDirectory(f);
|
||||
} catch (IOException e) {
|
||||
log("Bootstrap", "§cAn error occured while removing dead world " + fw.getWorldAddress());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
File lvlDat = new File(fw.getWorldAddress() + "/level.dat");
|
||||
if (lvlDat.exists()) {
|
||||
try {
|
||||
log("Bootstrap", "§9Fixing dead world " + fw.getWorldAddress());
|
||||
FileUtils.moveDirectory(f, bck);
|
||||
} catch (IOException e) {
|
||||
log("Bootstrap", "§cAn error occured while fixing dead world " + fw.getWorldAddress());
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
log("Bootstrap", "§4Corrupt world " + fw.getWorldAddress() + " :( I'm sorry. I can't do anything to recover it...");
|
||||
try {
|
||||
FileUtils.deleteDirectory(f);
|
||||
} catch (IOException e) {
|
||||
log("Bootstrap", "§cAn error occured while removing dead world " + fw.getWorldAddress());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdFramework = new CommandFramework(this);
|
||||
cmdFramework.setInGameOnlyMessage(S_PREFIX + "Dieser Befehl darf nur Ingame verwendet werden!");
|
||||
cmdFramework.setNoPermMessage("Unknown command. Type \"/help\" for help.");
|
||||
@ -242,11 +190,8 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
}
|
||||
@Override
|
||||
public void onDisable() {
|
||||
for (FactoryWorld fw : factoryWorlds.getAll().values()) {
|
||||
if (fw.getWrapped() != null) {
|
||||
log("Shutdown", "Unloading world " + fw.getWorldAddress());
|
||||
fw.unloadWorld();
|
||||
}
|
||||
{
|
||||
log("Shutdown", "Unloading world ");
|
||||
}
|
||||
}
|
||||
|
||||
@ -258,21 +203,17 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
return JavaPlugin.getPlugin(WarShipFactory.class);
|
||||
}
|
||||
|
||||
public FactoryWorld getWorldByAddress(String address) {
|
||||
for (FactoryWorld fw : factoryWorlds.getAll().values()) {
|
||||
if (fw.getWorldAddress().equals(address))
|
||||
return fw;
|
||||
public FactoryWorld getWorldFromOwner(UUID ownaz) {
|
||||
{
|
||||
if (Bauwelt.getBauwelt(ownaz).getUUID().equals(ownaz));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public FactoryWorld getWorldByAddress(String address, UUID ownaz) {
|
||||
if (Bauwelt.getBauwelt(ownaz).getUUID().equals(ownaz));
|
||||
return null;
|
||||
}
|
||||
|
||||
public FactoryWorld getWorldFromOwner(UUID ownaz) {
|
||||
for (FactoryWorld fw : factoryWorlds.getAll().values()) {
|
||||
if (fw.getOwner().equals(ownaz))
|
||||
return fw;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Completer(name = "bau")
|
||||
public List<String> completeCommands(CommandArgs args) {
|
||||
@ -296,6 +237,28 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@Completer(name = "gs")
|
||||
public List<String> completeCommands1(CommandArgs args) {
|
||||
List<String> ret = new ArrayList<String>();
|
||||
String label = args.getCommand().getLabel();
|
||||
for (String arg : args.getArgs()) {
|
||||
label += " " + arg;
|
||||
}
|
||||
for (String currentLabel : this.cmdFramework.getCommandLabels()) {
|
||||
String current = currentLabel.replace('.', ' ');
|
||||
if (currentLabel.contains("BauFactory"))
|
||||
continue;
|
||||
if (current.contains(label)) {
|
||||
current = current.substring(label.lastIndexOf(' ')).trim();
|
||||
current = current.substring(0, current.indexOf(' ') != -1 ? current.indexOf(' ') : current.length())
|
||||
.trim();
|
||||
if (!ret.contains(current)) {
|
||||
ret.add(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static class CommandInjector {
|
||||
private static String packageName = Bukkit.getServer().getClass().getPackage().getName();
|
||||
@ -322,9 +285,8 @@ public class WarShipFactory extends JavaPlugin implements Listener {
|
||||
@EventHandler
|
||||
public void onRespawn(PlayerRespawnEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
FactoryWorld fw = getWorldByAddress(p.getWorld().getName());
|
||||
if (fw != null) {
|
||||
e.setRespawnLocation(fw.getWrapped().getSpawnLocation());
|
||||
if (Bukkit.getWorld(p.getUniqueId()) != null) {
|
||||
e.setRespawnLocation(Bukkit.getWorld(p.getUniqueId()).getSpawnLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
name: WarShipFactory
|
||||
author: Exceptionflug
|
||||
version: 1.1
|
||||
depend: [Brew, WorldEdit, WorldGuard, CoreSystem]
|
||||
depend: [Brew, WorldEdit, WorldGuard]
|
||||
|
||||
main: de.quantumnanox.warshipfactory.main.WarShipFactory
|
||||
|
||||
commands:
|
||||
gs:
|
In neuem Issue referenzieren
Einen Benutzer sperren