diff --git a/plugin.yml b/plugin.yml index ec8b65be..7de9ce7b 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,6 +1,6 @@ name: DungeonsXL version: 2.9 -main: com.dre.dungeonsxl.DungeonsXL +main: com.dre.dungeonsxl.P authors: [Frank Baumann] softdepend: [Vault] commands: diff --git a/src/com/dre/dungeonsxl/ConfigReader.java b/src/com/dre/dungeonsxl/ConfigReader.java index 1ac6bad0..8ff00d37 100644 --- a/src/com/dre/dungeonsxl/ConfigReader.java +++ b/src/com/dre/dungeonsxl/ConfigReader.java @@ -16,7 +16,7 @@ import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; public class ConfigReader { - public static DungeonsXL p=DungeonsXL.p; + public static P p=P.p; public File file; diff --git a/src/com/dre/dungeonsxl/DGSign.java b/src/com/dre/dungeonsxl/DGSign.java index 1c8b5a23..5703751a 100644 --- a/src/com/dre/dungeonsxl/DGSign.java +++ b/src/com/dre/dungeonsxl/DGSign.java @@ -244,11 +244,11 @@ public class DGSign { } } else{ - File file=new File(DungeonsXL.p.getDataFolder()+"/dungeons/"+dgsign.dungeonName, "config.yml"); + File file=new File(P.p.getDataFolder()+"/dungeons/"+dgsign.dungeonName, "config.yml"); if(file!=null){ ConfigReader confReader=new ConfigReader(file); if(confReader!=null){ - DungeonsXL.p.msg(player, ChatColor.RED+"Du kannst den Dungeon nur alle "+ChatColor.GOLD+confReader.timeToNextPlay+ChatColor.RED+" Stunden betreten!"); + P.p.msg(player, ChatColor.RED+"Du kannst den Dungeon nur alle "+ChatColor.GOLD+confReader.timeToNextPlay+ChatColor.RED+" Stunden betreten!"); } } } @@ -316,7 +316,7 @@ public class DGSign { } public static void load(FileConfiguration configFile) { - for(World world:DungeonsXL.p.getServer().getWorlds()){ + for(World world:P.p.getServer().getWorlds()){ if(configFile.contains("groupsign."+world.getName())){ int id=0; String preString; diff --git a/src/com/dre/dungeonsxl/DMobType.java b/src/com/dre/dungeonsxl/DMobType.java index 4508d6a3..6dfe5afe 100644 --- a/src/com/dre/dungeonsxl/DMobType.java +++ b/src/com/dre/dungeonsxl/DMobType.java @@ -178,7 +178,7 @@ public class DMobType { itemMeta.addEnchant(Enchantment.getByName(splittedEnchantment[0].toUpperCase()), 1, true); } } else { - DungeonsXL.p.log(Level.WARNING,"Error at loading mob.yml: Enchantmet '"+splittedEnchantment[0]+"' doesn't exist!"); + P.p.log(Level.WARNING,"Error at loading mob.yml: Enchantmet '"+splittedEnchantment[0]+"' doesn't exist!"); } } } @@ -205,7 +205,7 @@ public class DMobType { } } } else { - DungeonsXL.p.log(Level.WARNING,"Error at loading mob.yml: Mob '"+configFile.getString(mobName+".Type")+"' doesn't exist!"); + P.p.log(Level.WARNING,"Error at loading mob.yml: Mob '"+configFile.getString(mobName+".Type")+"' doesn't exist!"); } } } diff --git a/src/com/dre/dungeonsxl/DPlayer.java b/src/com/dre/dungeonsxl/DPlayer.java index c32ff380..2bdd8e46 100644 --- a/src/com/dre/dungeonsxl/DPlayer.java +++ b/src/com/dre/dungeonsxl/DPlayer.java @@ -20,7 +20,7 @@ import com.dre.dungeonsxl.game.GameCheckpoint; import com.dre.dungeonsxl.game.GameWorld; public class DPlayer { - public DungeonsXL p=DungeonsXL.p; + public P p=P.p; public static CopyOnWriteArrayList players=new CopyOnWriteArrayList(); @@ -54,7 +54,7 @@ public class DPlayer { public int invItemInHand; public CopyOnWriteArrayList respawnInventory=new CopyOnWriteArrayList(); - public Inventory treasureInv = DungeonsXL.p.getServer().createInventory(player, 45, "Belohnungen"); + public Inventory treasureInv = P.p.getServer().createInventory(player, 45, "Belohnungen"); public DPlayer(Player player, World world, Location teleport, boolean isEditing){ players.add(this); @@ -174,7 +174,7 @@ public class DPlayer { } } } - //DungeonsXL.p.updateInventory(groupplayer); + //P.p.updateInventory(groupplayer); } i++; }while(groupplayer==null); @@ -188,7 +188,7 @@ public class DPlayer { - //DungeonsXL.p.updateInventory(this.player); + //P.p.updateInventory(this.player); } public void ready(){ @@ -230,11 +230,11 @@ public class DPlayer { } } this.respawnInventory.clear(); - //DungeonsXL.p.updateInventory(this.player); + //P.p.updateInventory(this.player); } public void finish(){ - DungeonsXL.p.msg(this.player, ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!"); + P.p.msg(this.player, ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!"); this.isFinished=true; DGroup dgroup=DGroup.get(this.player); @@ -243,7 +243,7 @@ public class DPlayer { for(Player player:dgroup.players){ DPlayer dplayer=get(player); if(!dplayer.isFinished){ - DungeonsXL.p.msg(this.player, ChatColor.YELLOW+"Noch auf Mitspieler warten..."); + P.p.msg(this.player, ChatColor.YELLOW+"Noch auf Mitspieler warten..."); return; } } @@ -304,7 +304,7 @@ public class DPlayer { this.player.getInventory().clear(); this.player.getInventory().setArmorContents(null); player.getInventory().setItemInHand(new ItemStack(0)); - //DungeonsXL.p.updateInventory(this.player); + //P.p.updateInventory(this.player); //Set Inventory for(ItemStack istack:dclass.items){ @@ -352,7 +352,7 @@ public class DPlayer { - //DungeonsXL.p.updateInventory(this.player); + //P.p.updateInventory(this.player); } for(int i=0;i<36;i++){ @@ -363,7 +363,7 @@ public class DPlayer { } - //DungeonsXL.p.updateInventory(this.player); + //P.p.updateInventory(this.player); } } @@ -451,7 +451,6 @@ public class DPlayer { } } dplayer.respawnInventory.clear(); - //DungeonsXL.p.updateInventory(dplayer.player); } } } diff --git a/src/com/dre/dungeonsxl/DPortal.java b/src/com/dre/dungeonsxl/DPortal.java index 35672fdb..05de4801 100644 --- a/src/com/dre/dungeonsxl/DPortal.java +++ b/src/com/dre/dungeonsxl/DPortal.java @@ -12,7 +12,7 @@ import org.bukkit.entity.Player; import com.dre.dungeonsxl.game.GameWorld; public class DPortal { - public static DungeonsXL p=DungeonsXL.p; + public static P p=P.p; public static CopyOnWriteArrayList portals = new CopyOnWriteArrayList(); diff --git a/src/com/dre/dungeonsxl/EditWorld.java b/src/com/dre/dungeonsxl/EditWorld.java index 873bfd3a..b128ff6f 100644 --- a/src/com/dre/dungeonsxl/EditWorld.java +++ b/src/com/dre/dungeonsxl/EditWorld.java @@ -18,7 +18,7 @@ import org.bukkit.block.Sign; import org.bukkit.entity.Player; public class EditWorld { - private static DungeonsXL p=DungeonsXL.p; + private static P p=P.p; public static CopyOnWriteArrayList eworlds=new CopyOnWriteArrayList(); //Variables @@ -62,10 +62,10 @@ public class EditWorld { public void save(){ this.world.save(); - p.copyDirectory(new File("DXL_Edit_"+this.id),new File("plugins/DungeonsXL/dungeons/"+this.dungeonname)); - p.deletenotusingfiles(new File("plugins/DungeonsXL/dungeons/"+this.dungeonname)); + p.copyDirectory(new File("DXL_Edit_"+this.id),new File(p.getDataFolder(),"/dungeons/"+this.dungeonname)); + p.deletenotusingfiles(new File(p.getDataFolder(),"/dungeons/"+this.dungeonname)); try { - ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream(new File("plugins/DungeonsXL/dungeons/"+this.dungeonname+"/DXLData.data"))); + ObjectOutputStream out=new ObjectOutputStream(new FileOutputStream(new File(p.getDataFolder(),"/dungeons/"+this.dungeonname+"/DXLData.data"))); out.writeInt(this.sign.size()); for(Block sign:this.sign){ out.writeInt(sign.getX()); @@ -81,26 +81,6 @@ public class EditWorld { // TODO Auto-generated catch block e.printStackTrace(); } - - //Check Configuration - /*File file=new File("plugins/DungeonsXL/dungeons/"+this.dungeonname+"/config.yml"); - if(!file.exists()){ - File copyfile=new File("plugins/DungeonsXL/config.yml"); - if(copyfile.exists()){ - try { - DungeonsXL.p.copyFile(copyfile,file); - } catch (IOException e) { - e.printStackTrace(); - } - }else{ - try { - file.createNewFile(); - } catch (IOException e) { - e.printStackTrace(); - } - } - }*/ - } public void checkSign(Block block){ @@ -169,7 +149,7 @@ public class EditWorld { } } - File file=new File("plugins/DungeonsXL/dungeons/"+name); + File file=new File(p.getDataFolder(),"/dungeons/"+name); if(file.exists()){ EditWorld eworld = new EditWorld(); @@ -180,7 +160,7 @@ public class EditWorld { eworld.world=p.getServer().createWorld(WorldCreator.name("DXL_Edit_"+eworld.id)); try { - ObjectInputStream os=new ObjectInputStream(new FileInputStream(new File("plugins/DungeonsXL/dungeons/"+eworld.dungeonname+"/DXLData.data"))); + ObjectInputStream os=new ObjectInputStream(new FileInputStream(new File(p.getDataFolder(),"/dungeons/"+eworld.dungeonname+"/DXLData.data"))); int length=os.readInt(); for(int i=0; i gmessages=new CopyOnWriteArrayList(); @@ -37,7 +37,7 @@ public class GameMessage { for(DPlayer dplayer:DPlayer.get(gmessage.gworld.world)){ if(!gmessage.playerDone.contains(dplayer)){ if(dplayer.player.getLocation().distance(gmessage.block.getLocation()) gworlds=new CopyOnWriteArrayList(); //Variables placeable @@ -322,7 +322,7 @@ public class GameWorld { public static GameWorld load(String name){ - File file=new File("plugins/DungeonsXL/dungeons/"+name); + File file=new File(p.getDataFolder(),"/dungeons/"+name); if(file.exists()){ GameWorld gworld = new GameWorld(); diff --git a/src/com/dre/dungeonsxl/listener/BlockListener.java b/src/com/dre/dungeonsxl/listener/BlockListener.java index 439db15f..40031cd8 100644 --- a/src/com/dre/dungeonsxl/listener/BlockListener.java +++ b/src/com/dre/dungeonsxl/listener/BlockListener.java @@ -14,7 +14,7 @@ import org.bukkit.event.block.SignChangeEvent; import com.dre.dungeonsxl.DGSign; import com.dre.dungeonsxl.DPortal; -import com.dre.dungeonsxl.DungeonsXL; +import com.dre.dungeonsxl.P; import com.dre.dungeonsxl.EditWorld; import com.dre.dungeonsxl.LeaveSign; import com.dre.dungeonsxl.game.GameWorld; @@ -108,7 +108,7 @@ public class BlockListener implements Listener { //Group Signs if(eworld==null){ - if(player.isOp() || DungeonsXL.p.permission.has(player, "dxl.sign")){ + if(player.isOp() || P.p.permission.has(player, "dxl.sign")){ if(lines[0].equalsIgnoreCase("[DXL]")){ diff --git a/src/com/dre/dungeonsxl/listener/CommandListener.java b/src/com/dre/dungeonsxl/listener/CommandListener.java index 394aab3c..16b4a09e 100644 --- a/src/com/dre/dungeonsxl/listener/CommandListener.java +++ b/src/com/dre/dungeonsxl/listener/CommandListener.java @@ -6,7 +6,7 @@ import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -import com.dre.dungeonsxl.DungeonsXL; +import com.dre.dungeonsxl.P; import com.dre.dungeonsxl.commands.DCommand; import com.dre.dungeonsxl.commands.DCommandRoot; @@ -31,14 +31,14 @@ public class CommandListener implements CommandExecutor { } } else{ - DungeonsXL.p.msg(player, ChatColor.RED+"Du hast keine Permissions dazu!"); + P.p.msg(player, ChatColor.RED+"Du hast keine Permissions dazu!"); } return true; } } - DungeonsXL.p.msg(player, ChatColor.RED+"Befehl "+ChatColor.GOLD+cmd+ChatColor.RED+" existiert nicht!"); - DungeonsXL.p.msg(player, ChatColor.RED+"Bitte gib "+ChatColor.GOLD+"/dxl help"+ChatColor.RED+" für Hilfe ein!"); + P.p.msg(player, ChatColor.RED+"Befehl "+ChatColor.GOLD+cmd+ChatColor.RED+" existiert nicht!"); + P.p.msg(player, ChatColor.RED+"Bitte gib "+ChatColor.GOLD+"/dxl help"+ChatColor.RED+" für Hilfe ein!"); }else{ DCommandRoot.root.cmdHelp.onExecute(args,player); } diff --git a/src/com/dre/dungeonsxl/listener/PlayerListener.java b/src/com/dre/dungeonsxl/listener/PlayerListener.java index 23ad19e4..c19eca76 100644 --- a/src/com/dre/dungeonsxl/listener/PlayerListener.java +++ b/src/com/dre/dungeonsxl/listener/PlayerListener.java @@ -28,14 +28,14 @@ import com.dre.dungeonsxl.DGroup; import com.dre.dungeonsxl.DLootInventory; import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.DPortal; -import com.dre.dungeonsxl.DungeonsXL; +import com.dre.dungeonsxl.P; import com.dre.dungeonsxl.EditWorld; import com.dre.dungeonsxl.LeaveSign; import com.dre.dungeonsxl.game.GameChest; import com.dre.dungeonsxl.game.GameWorld; public class PlayerListener implements Listener{ - public DungeonsXL p=DungeonsXL.p; + public P p=P.p; @EventHandler(priority = EventPriority.HIGHEST) @@ -305,7 +305,7 @@ public class PlayerListener implements Listener{ //Deny Player Cmds @EventHandler(priority = EventPriority.HIGH) public void onPlayerCommand(PlayerCommandPreprocessEvent event){ - if(DungeonsXL.p.permission.has(event.getPlayer(), "dungeonsxl.cmd")||event.getPlayer().isOp()){ + if(p.permission.has(event.getPlayer(), "dungeonsxl.cmd")||event.getPlayer().isOp()){ return; }