From 8145fae48729a92cf53a4b76dd544ee98df51408 Mon Sep 17 00:00:00 2001 From: Grafe Date: Sat, 12 Jan 2013 04:22:02 +0100 Subject: [PATCH] Fixed #22 --- src/com/dre/dungeonsxl/DGSign.java | 2 +- src/com/dre/dungeonsxl/DMobType.java | 60 +++---- src/com/dre/dungeonsxl/DPlayer.java | 4 +- src/com/dre/dungeonsxl/DPortal.java | 62 +++---- src/com/dre/dungeonsxl/LanguageReader.java | 169 +++++++++--------- src/com/dre/dungeonsxl/LeaveSign.java | 24 +-- src/com/dre/dungeonsxl/P.java | 34 ++-- src/com/dre/dungeonsxl/commands/CMDChat.java | 14 +- .../dre/dungeonsxl/commands/CMDChatSpy.java | 10 +- .../dre/dungeonsxl/commands/CMDCreate.java | 28 +-- src/com/dre/dungeonsxl/commands/CMDEdit.java | 22 +-- src/com/dre/dungeonsxl/commands/CMDHelp.java | 16 +- .../dre/dungeonsxl/commands/CMDInvite.java | 10 +- src/com/dre/dungeonsxl/commands/CMDLeave.java | 16 +- src/com/dre/dungeonsxl/commands/CMDList.java | 12 +- src/com/dre/dungeonsxl/commands/CMDMsg.java | 36 ++-- .../dre/dungeonsxl/commands/CMDPortal.java | 10 +- .../dre/dungeonsxl/commands/CMDReload.java | 8 +- src/com/dre/dungeonsxl/commands/CMDSave.java | 10 +- src/com/dre/dungeonsxl/commands/CMDTest.java | 38 ++-- .../dre/dungeonsxl/commands/CMDUninvite.java | 8 +- .../dre/dungeonsxl/game/GameCheckpoint.java | 18 +- src/com/dre/dungeonsxl/game/GameChest.java | 26 +-- .../dungeonsxl/listener/CommandListener.java | 16 +- .../dungeonsxl/listener/PlayerListener.java | 21 +-- 25 files changed, 330 insertions(+), 344 deletions(-) diff --git a/src/com/dre/dungeonsxl/DGSign.java b/src/com/dre/dungeonsxl/DGSign.java index 6444e72c..5e2baab6 100644 --- a/src/com/dre/dungeonsxl/DGSign.java +++ b/src/com/dre/dungeonsxl/DGSign.java @@ -248,7 +248,7 @@ public class DGSign { if(file!=null){ ConfigReader confReader=new ConfigReader(file); if(confReader!=null){ - P.p.msg(player, P.p.language.get("player_join_error",""+confReader.timeToNextPlay)); + P.p.msg(player, P.p.language.get("Error_Cooldown",""+confReader.timeToNextPlay)); } } } diff --git a/src/com/dre/dungeonsxl/DMobType.java b/src/com/dre/dungeonsxl/DMobType.java index 4b78f158..93c04472 100644 --- a/src/com/dre/dungeonsxl/DMobType.java +++ b/src/com/dre/dungeonsxl/DMobType.java @@ -38,14 +38,14 @@ public class DMobType { private ItemStack ItemChestplate; private ItemStack ItemLeggings; private ItemStack ItemBoots; - + private Map drops = new HashMap(); public Map getDrops() { return this.drops; } - + /* Extra Values for different Mob Types */ private boolean isWitherSkeleton = false; private String ocelotType = null; - + /* Methods */ public DMobType(String name, EntityType type){ mobTypes.add(this); @@ -65,7 +65,7 @@ public class DMobType { entity.getEquipment().setChestplate(ItemChestplate); entity.getEquipment().setLeggings(ItemLeggings); entity.getEquipment().setBoots(ItemBoots); - + /* Check mob specified stuff */ if(type==EntityType.SKELETON){ if(isWitherSkeleton){ @@ -74,7 +74,7 @@ public class DMobType { ((Skeleton) entity).setSkeletonType(SkeletonType.NORMAL); } } - + if(type==EntityType.OCELOT){ Ocelot ocelot=(Ocelot) entity; if(ocelotType!=null){ @@ -89,60 +89,60 @@ public class DMobType { } } } - + /* Spawn Mob */ new DMob(entity, maxHealth, gWorld, this); } } } - + //Load Config public static void load(File file){ FileConfiguration configFile = YamlConfiguration.loadConfiguration(file); - + //Read Mobs for(String mobName:configFile.getKeys(false)){ EntityType type=EntityType.fromName(configFile.getString(mobName+".Type")); - + if (type!=null) { DMobType mobType=new DMobType(mobName, type); - + //Load MaxHealth if(configFile.contains(mobName+".MaxHealth")){ mobType.maxHealth=configFile.getInt(mobName+".MaxHealth"); } - + //Load Items if(configFile.contains(mobName+".ItemHelmet")){ mobType.ItemHelmet = new ItemStack(configFile.getInt(mobName+".ItemHelmet"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHelmet"))).getItem(); } - + if(configFile.contains(mobName+".ItemChestplate")){ mobType.ItemChestplate = new ItemStack(configFile.getInt(mobName+".ItemChestplate"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemChestplate"))).getItem(); } - + if(configFile.contains(mobName+".ItemBoots")){ mobType.ItemBoots = new ItemStack(configFile.getInt(mobName+".ItemBoots"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemBoots"))).getItem(); } - + if(configFile.contains(mobName+".ItemLeggings")){ mobType.ItemLeggings = new ItemStack(configFile.getInt(mobName+".ItemLeggings"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemLeggings"))).getItem(); } - + if(configFile.contains(mobName+".ItemHand")){ mobType.ItemHand = new ItemStack(configFile.getInt(mobName+".ItemHand"));//CraftItemStack.asNMSCopy(new ItemStack(configFile.getInt(mobName+".ItemHand"))).getItem(); } - + //Load different Mob options if(configFile.contains(mobName+".isWitherSkeleton")){ mobType.isWitherSkeleton = configFile.getBoolean(mobName+".isWitherSkeleton"); } - + if(configFile.contains(mobName+".ocelotType")){ mobType.ocelotType = configFile.getString(mobName+".ocelotType"); } - + //Drops ConfigurationSection configSetion = configFile.getConfigurationSection(mobName+".drops"); if(configSetion!=null){ @@ -151,22 +151,22 @@ public class DMobType { ItemStack item = null; ItemMeta itemMeta = null; int chance = 100; - + /* Item Stack */ Material mat = Material.getMaterial(configSetion.getInt(dropPath+".id")); int amount = 1; short data = 0; - + if(configSetion.contains(dropPath+".amount")){ amount = configSetion.getInt(dropPath+".amount"); } if(configSetion.contains(dropPath+".data")){ data = Short.parseShort(configSetion.getString(dropPath+".data")); } - + item = new ItemStack(mat,amount,data); itemMeta = item.getItemMeta(); - + /* Enchantments */ if (configSetion.contains(dropPath+".enchantments")) { for(String enchantment:configSetion.getStringList(dropPath+".enchantments")){ @@ -178,43 +178,43 @@ public class DMobType { itemMeta.addEnchant(Enchantment.getByName(splittedEnchantment[0].toUpperCase()), 1, true); } } else { - P.p.log(Level.WARNING, P.p.language.get("log_error_mobenchantment",splittedEnchantment[0])); + P.p.log(Level.WARNING, P.p.language.get("Log_Error_MobEnchantment",splittedEnchantment[0])); } } } - + /* Item Name */ if (configSetion.contains(dropPath+".name")) { itemMeta.setDisplayName(configSetion.getString(dropPath+".name")); } - + /* Item Lore */ if (configSetion.contains(dropPath+".lore")) { String[] lore=configSetion.getString(dropPath+".lore").split("//"); itemMeta.setLore(Arrays.asList(lore)); } - + /* Drop chance */ if (configSetion.contains(dropPath+".chance")) { chance = configSetion.getInt(dropPath+".chance"); } - + /* Add Item to the drops map */ item.setItemMeta(itemMeta); mobType.drops.put(item, chance); } } } else { - P.p.log(Level.WARNING, P.p.language.get("log_error_mobtype",configFile.getString(mobName+".Type"))); + P.p.log(Level.WARNING, P.p.language.get("Log_Error_MobType",configFile.getString(mobName+".Type"))); } } } - + //Clear public static void clear(){ mobTypes.clear(); } - + //Get public static DMobType get(String name){ for(DMobType mobType:DMobType.mobTypes){ diff --git a/src/com/dre/dungeonsxl/DPlayer.java b/src/com/dre/dungeonsxl/DPlayer.java index 60fd7784..b97e23f1 100644 --- a/src/com/dre/dungeonsxl/DPlayer.java +++ b/src/com/dre/dungeonsxl/DPlayer.java @@ -237,7 +237,7 @@ public class DPlayer { } public void finish(){ - P.p.msg(this.player, p.language.get("player_finisheddungeon"));//ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!"); + P.p.msg(this.player, p.language.get("Player_FinishedDungeon"));//ChatColor.YELLOW+"Du hast den Dungeon erfolgreich beendet!"); this.isFinished=true; DGroup dgroup=DGroup.get(this.player); @@ -246,7 +246,7 @@ public class DPlayer { for(Player player:dgroup.players){ DPlayer dplayer=get(player); if(!dplayer.isFinished){ - P.p.msg(this.player, p.language.get("player_waitforotherplayers"));//ChatColor.YELLOW+"Noch auf Mitspieler warten..."); + P.p.msg(this.player, p.language.get("Player_WaitForOtherPlayers"));//ChatColor.YELLOW+"Noch auf Mitspieler warten..."); return; } } diff --git a/src/com/dre/dungeonsxl/DPortal.java b/src/com/dre/dungeonsxl/DPortal.java index b63bfc4b..6fe21131 100644 --- a/src/com/dre/dungeonsxl/DPortal.java +++ b/src/com/dre/dungeonsxl/DPortal.java @@ -12,42 +12,42 @@ import com.dre.dungeonsxl.game.GameWorld; public class DPortal { public static P p=P.p; - + public static CopyOnWriteArrayList portals = new CopyOnWriteArrayList(); - + //Variables public World world; public Block block1,block2; public Player player; public boolean isActive; public String type; - - + + public DPortal(boolean active){ portals.add(this); this.isActive=active; } - + public boolean fillwithportal(){ if(this.block1!=null && this.block2!=null){ int x1=block1.getX(),y1=block1.getY(),z1=block1.getZ(); int x2=block2.getX(),y2=block2.getY(),z2=block2.getZ(); int xcount=0,ycount=0,zcount=0; - + if(x1>x2){xcount=-1;}else if(x1y2){ycount=-1;}else if(y1z2){zcount=-1;}else if(z1x2){ if(x3x1) continue; }else{ if(x3>x2 || x3y2){ if(y3y1) continue; }else{ if(y3>y2 || y3z2){ if(z3z1) continue; }else{ if(z3>z2 || z3 entries = new TreeMap(); private Map defaults = new TreeMap(); - + private File file; private boolean changed; - + public LanguageReader(File file){ this.setDefaults(); - + /* Load */ this.file = file; - + P.p.log("FilePath:"+file.getPath()); - + FileConfiguration configFile = YamlConfiguration.loadConfiguration(file); - + Set keySet = configFile.getKeys(false); for(String key:keySet){ entries.put(key, configFile.getString(key)); } - + /* Check */ this.check(); } - + private void setDefaults(){ - defaults.put("error_tutorialnotexist","&4Tutorial Dungeon existiert nicht!"); - + /* Log */ - defaults.put("log_newdungeon","New Dungeon: "); - defaults.put("log_generatenewworld","Generate new world..."); - defaults.put("log_worldgenerationfinished","World generation finished!"); - defaults.put("log_error_mobenchantment","Error at loading mob.yml: Enchantmet &v1 doesn't exist!"); - defaults.put("log_error_mobtype","Error at loading mob.yml: Mob &v1 doesn't exist!"); - + defaults.put("Log_NewDungeon","New Dungeon: "); + defaults.put("Log_GenerateNewWorld","Generate new world..."); + defaults.put("Log_WorldGenerationFinished","World generation finished!"); + defaults.put("Log_Error_MobEnchantment","Error at loading mob.yml: Enchantmet &v1 doesn't exist!"); + defaults.put("Log_Error_MobType","Error at loading mob.yml: Mob &v1 doesn't exist!"); + /* Player */ - defaults.put("player_checkpoint_reached","&6Checkpoint erreicht!"); - defaults.put("player_lootadded","&6Deinem Belohnungsinventar sind&4&v1&6 hinzugefügt worden!"); - defaults.put("player_enderchest_error","&4Du kannst keine Enderchest in einem Dungeon verwenden!"); - defaults.put("player_ready","&6Du bist nun bereit für den Dungeon!"); - defaults.put("player_ready_error","&4Wähle zuerst eine Klasse aus!"); - defaults.put("player_leftklick_error","&4Du musst das Schild mit Links-klick berühren!"); - defaults.put("player_drop_error","&4Du kannst keine sicheren Objekte droppen"); - defaults.put("player_cmd_error","&4Befehle sind während des Dungeons nicht erlaubt!"); - defaults.put("player_join_error","&4Du kannst den Dungeon nur alle &6&v1&4 Stunden betreten!"); - defaults.put("player_finisheddungeon","&6Du hast den Dungeon erfolgreich beendet!"); - defaults.put("player_waitforotherplayers","&6Noch auf Mitspieler warten..."); - defaults.put("player_dungeon_error","&4Dungeon &6&v1&4 existiert nicht!"); - defaults.put("player_group_error","&4Du musst zuerst einer Gruppe beitreten!"); - defaults.put("player_leavegroup","&6Du hast deine Gruppe erfolgreich verlassen!"); - + defaults.put("Player_CheckpointReached","&6Checkpoint erreicht!"); + defaults.put("Player_LootAdded","&6Deinem Belohnungsinventar sind&4&v1&6 hinzugefügt worden!"); + defaults.put("Player_Ready","&6Du bist nun bereit für den Dungeon!"); + defaults.put("Player_FinishedDungeon","&6Du hast den Dungeon erfolgreich beendet!"); + defaults.put("Player_WaitForOtherPlayers","&6Noch auf Mitspieler warten..."); + defaults.put("Player_LeaveGroup","&6Du hast deine Gruppe erfolgreich verlassen!"); + /* Cmds */ - defaults.put("cmd_chat_dungeonchat","&6Du bist nun im Dungeon-Chat"); - defaults.put("cmd_chat_error1","&4Du bist in keinem Dungeon!"); - defaults.put("cmd_chat_normalchat","&6Du bist nun im öffentlichen Chat"); - defaults.put("cmd_chatspy_stopped","&6Du hast aufgehört den DXL-Chat auszuspähen!"); - defaults.put("cmd_chatspy_start","&Du hast begonnen den DXL-Chat auszuspähen!"); - defaults.put("cmd_create_error1","&4Der Name darf nicht länger sein als 15 Zeichen!"); - defaults.put("cmd_create_error2","&4Du musst zuerst aus dem aktuellen Dungeon raus!"); - defaults.put("cmd_edit_error1","&4Dungeon &6&v1&4 existiert nicht!"); - defaults.put("cmd_edit_error2","&4Du musst zuerst deine Gruppe verlassen!"); - defaults.put("cmd_edit_error3","&4Du musst zuerst den aktuellen Dungeon verlassen!"); - defaults.put("cmd_invite_success","&6Spieler &4&v1&6 wurde erfolgreich eingeladen am Dungeon &4&v2&6 zu arbeiten!"); - defaults.put("cmd_invite_error1","&4Dungeon &6&v1&4 existiert nicht!"); - defaults.put("cmd_leave_error1","&4You aren't in a dungeon!"); - defaults.put("cmd_leave_error2","&4Du kannst diesen Befehl nicht in einem Tutorial benutzen!"); - defaults.put("cmd_leave_success","&6Du hast deine Gruppe erfolgreich verlassen!"); - defaults.put("cmd_msg_error1","&4Nachricht mit der Id &6&v1&4 existiert nicht!"); - defaults.put("cmd_msg_error2","&4Die Nachricht muss zwischen '' liegen!"); - defaults.put("cmd_msg_error3","&4Parameter muss eine Zahl beinhalten!"); - defaults.put("cmd_msg_error4","&4Du musst einen Dungeon bearbeiten um diesen Befehl zu benutzen!"); - defaults.put("cmd_msg_added","&6Neue Nachricht (&4&v1&6) hinzugefügt!"); - defaults.put("cmd_msg_updated","&6Nachricht (&4&v1&6) aktualisiert!"); - defaults.put("cmd_reload_start","&6DungeonsXL wird neu geladen"); - defaults.put("cmd_reload_done","&6DungeonsXL erfolgreich neu geladen!"); - defaults.put("cmd_save_success","&6Dungeon erfolgreich gespeichert!"); - defaults.put("cmd_save_error1","&4Du musst einen Dungeon editieren, um ihn zu speichern!"); - defaults.put("cmd_test_error1","&4Dungeon &6&v1&4 existiert nicht!"); - defaults.put("cmd_test_error2","&4Du must zuerst den aktuellen Dungeon verlassen!"); - defaults.put("cmd_uninvite_success","&4&v1&6 wurde erfolgreich ausgeladen an &4&v1&6 zu arbeiten!"); - defaults.put("cmd_uninvite_error1","&4Dungeon &6&v1&4 existiert nicht!"); - defaults.put("cmd_nopermissions","&4Du hast keine Erlaubnis dies zu tun!"); - defaults.put("cmd_notexist1","&4Befehl &6&v1&4 existiert nicht!"); - defaults.put("cmd_notexist2","&4Bitte gib &6/dxl help&4 für Hilfe ein!"); - + defaults.put("Cmd_Chat_DungeonChat","&6Du bist nun im Dungeon-Chat"); + defaults.put("Cmd_Chat_NormalChat","&6Du bist nun im öffentlichen Chat"); + defaults.put("Cmd_Chatspy_Stopped","&6Du hast aufgehört den DXL-Chat auszuspähen!"); + defaults.put("Cmd_Chatspy_Start","&Du hast begonnen den DXL-Chat auszuspähen!"); + defaults.put("Cmd_Invite_Success","&6Spieler &4&v1&6 wurde erfolgreich eingeladen am Dungeon &4&v2&6 zu arbeiten!"); + defaults.put("Cmd_Leave_Success","&6Du hast deine Gruppe erfolgreich verlassen!"); + defaults.put("Cmd_Msg_Added","&6Neue Nachricht (&4&v1&6) hinzugefügt!"); + defaults.put("Cmd_Msg_Updated","&6Nachricht (&4&v1&6) aktualisiert!"); + defaults.put("Cmd_Reload_Start","&6DungeonsXL wird neu geladen"); + defaults.put("Cmd_Reload_Done","&6DungeonsXL erfolgreich neu geladen!"); + defaults.put("Cmd_Save_Success","&6Dungeon erfolgreich gespeichert!"); + defaults.put("Cmd_Uninvite_Success","&4&v1&6 wurde erfolgreich ausgeladen an &4&v1&6 zu arbeiten!"); + + /* Errors */ + defaults.put("Error_Enderchest","&4Du kannst keine Enderchest in einem Dungeon verwenden!"); + defaults.put("Error_Ready","&4Wähle zuerst eine Klasse aus!"); + defaults.put("Error_Cooldown","&4Du kannst den Dungeon nur alle &6&v1&4 Stunden betreten!"); + defaults.put("Error_Leftklick","&4Du musst das Schild mit Links-klick berühren!"); + defaults.put("Error_Drop","&4Du kannst keine sicheren Objekte droppen"); + defaults.put("Error_Cmd","&4Befehle sind während des Dungeons nicht erlaubt!"); + defaults.put("Error_NotInGroup","&4Du musst zuerst einer Gruppe beitreten!"); + defaults.put("Error_NoPermissions","&4Du hast keine Erlaubnis dies zu tun!"); + defaults.put("Error_CmdNotExist1","&4Befehl &6&v1&4 existiert nicht!"); + defaults.put("Error_CmdNotExist2","&4Bitte gib &6/dxl help&4 für Hilfe ein!"); + defaults.put("Error_NotInDungeon","&4Du bist in keinem Dungeon!"); + defaults.put("Error_DungeonNotExist","&4Dungeon &6&v1&4 existiert nicht!"); + defaults.put("Error_LeaveDungeon","&4Du musst zuerst den aktuellen Dungeon verlassen!"); + defaults.put("Error_NameToLong","&4Der Name darf nicht länger sein als 15 Zeichen!"); + defaults.put("Error_LeaveGroup","&4Du musst zuerst deine Gruppe verlassen!"); + defaults.put("Error_NoLeaveInTutorial","&4Du kannst diesen Befehl nicht in einem Tutorial benutzen!"); + defaults.put("Error_MsgIdNotExist","&4Nachricht mit der Id &6&v1&4 existiert nicht!"); + defaults.put("Error_MsgFormat","&4Die Nachricht muss zwischen '' liegen!"); + defaults.put("Error_MsgNoInt","&4Parameter muss eine Zahl beinhalten!"); + defaults.put("Error_TutorialNotExist","&4Tutorial Dungeon existiert nicht!"); + /* Help */ - defaults.put("help_cmd_chat","/dxl chat - Ändert den Chat-Modus"); - defaults.put("help_cmd_chatspy","/dxl chatspy - De/Aktiviert den Spioniermodus"); - defaults.put("help_cmd_create","/dxl create - Erstellt einen neuen Dungeon"); - defaults.put("help_cmd_edit","/dxl edit - Editiere einen existierenden Dungeon"); - defaults.put("help_cmd_help","/dxl help - Zeigt die Hilfeseite an"); - defaults.put("help_cmd_invite","/dxl invite - Ladet einen Spieler dazu ein den Dungeon zu editieren"); - defaults.put("help_cmd_leave","/dxl leave - Verlässt den aktuellen Dungeon"); - defaults.put("help_cmd_list","/dxl list - Zeigt alle Dungeons an"); - defaults.put("help_cmd_msg","/dxl msg '[msg]' - Zeigt oder editiert eine Nachricht"); - defaults.put("help_cmd_portal","/dxl portal - Erstellt ein Portal welches in Dungeons führt"); - defaults.put("help_cmd_reload","/dxl reload - Ladet das Plugin neu"); - defaults.put("help_cmd_save","/dxl save - Speichert den aktuellen Dungeon"); - defaults.put("help_cmd_test","/dxl test [dungeon] - Testet einen Dungeon"); - defaults.put("help_cmd_uninvite","/dxl uninvite - Lädt einen Spieler aus den Dungeon zu editieren"); + defaults.put("Help_Cmd_Chat","/dxl chat - Ändert den Chat-Modus"); + defaults.put("Help_Cmd_Chatspy","/dxl chatspy - De/Aktiviert den Spioniermodus"); + defaults.put("Help_Cmd_Create","/dxl create - Erstellt einen neuen Dungeon"); + defaults.put("Help_Cmd_Edit","/dxl edit - Editiere einen existierenden Dungeon"); + defaults.put("Help_Cmd_Help","/dxl help - Zeigt die Hilfeseite an"); + defaults.put("Help_Cmd_Invite","/dxl invite - Ladet einen Spieler dazu ein den Dungeon zu editieren"); + defaults.put("Help_Cmd_Leave","/dxl leave - Verlässt den aktuellen Dungeon"); + defaults.put("Help_Cmd_List","/dxl list - Zeigt alle Dungeons an"); + defaults.put("Help_Cmd_Msg","/dxl msg '[msg]' - Zeigt oder editiert eine Nachricht"); + defaults.put("Help_Cmd_Portal","/dxl portal - Erstellt ein Portal welches in Dungeons führt"); + defaults.put("Help_Cmd_Reload","/dxl reload - Ladet das Plugin neu"); + defaults.put("Help_Cmd_Save","/dxl save - Speichert den aktuellen Dungeon"); + defaults.put("Help_Cmd_Test","/dxl test [dungeon] - Testet einen Dungeon"); + defaults.put("Help_Cmd_Uninvite","/dxl uninvite - Lädt einen Spieler aus den Dungeon zu editieren"); } - + private void check(){ for(String defaultEntry:defaults.keySet()){ if(!entries.containsKey(defaultEntry)){ @@ -120,26 +113,26 @@ public class LanguageReader { } } } - + public void save(){ if(changed){ /* Copy old File */ File source = new File(file.getPath()); String filePath = file.getPath(); File temp = new File(filePath.substring(0,filePath.length()-4)+"_old.yml"); - + if(temp.exists()) temp.delete(); - + source.renameTo(temp); - + /* Save */ FileConfiguration configFile = new YamlConfiguration(); - + for(String key:entries.keySet()){ configFile.set(key, entries.get(key)); } - + try { configFile.save(file); } catch (IOException e) { @@ -147,10 +140,10 @@ public class LanguageReader { } } } - + public String get(String key, String... args){ String entry = entries.get(key); - + if(entry!=null){ int i=0; for(String arg:args){ @@ -158,7 +151,7 @@ public class LanguageReader { entry = entry.replace("&v"+i, arg); } } - + return entry; } } diff --git a/src/com/dre/dungeonsxl/LeaveSign.java b/src/com/dre/dungeonsxl/LeaveSign.java index 4171c487..d141e061 100644 --- a/src/com/dre/dungeonsxl/LeaveSign.java +++ b/src/com/dre/dungeonsxl/LeaveSign.java @@ -11,16 +11,16 @@ import org.bukkit.entity.Player; public class LeaveSign{ public static CopyOnWriteArrayList lsigns=new CopyOnWriteArrayList(); - + public Sign sign; - + public LeaveSign(Sign sign){ lsigns.add(this); - + this.sign=sign; this.setText(); } - + public void setText(){ this.sign.setLine(0, ChatColor.BLUE+"############"); this.sign.setLine(1, ChatColor.DARK_GREEN+"Leave"); @@ -30,9 +30,9 @@ public class LeaveSign{ } public static boolean playerInteract(Block block, Player player) { - + LeaveSign lsign=getSign(block); - + if(lsign!=null){ DPlayer dplayer=DPlayer.get(player); if(dplayer!=null){ @@ -42,14 +42,14 @@ public class LeaveSign{ DGroup dgroup=DGroup.get(player); if(dgroup!=null){ dgroup.removePlayer(player); - P.p.msg(player,P.p.language.get("player_leavegroup"));//ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!"); + P.p.msg(player,P.p.language.get("Player_LeaveGroup"));//ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!"); return true; } } } return false; } - + public static boolean isRelativeSign(Block block,int x,int z){ LeaveSign lsign=getSign(block.getRelative(x,0,z)); if(lsign!=null){ @@ -58,7 +58,7 @@ public class LeaveSign{ if(z==-1 && lsign.sign.getData().getData()==2) return true; if(z==1 && lsign.sign.getData().getData()==3) return true; } - + return false; } @@ -74,7 +74,7 @@ public class LeaveSign{ } return null; } - + //Save and Load public static void save(FileConfiguration configFile){ int id = 0; @@ -95,7 +95,7 @@ public class LeaveSign{ do{ id++; preString="leavesign."+world.getName()+"."+id+"."; - if(configFile.contains(preString)){ + if(configFile.contains(preString)){ Block block=world.getBlockAt(configFile.getInt(preString+".x"),configFile.getInt(preString+".y"),configFile.getInt(preString+".z")); if(block.getState() instanceof Sign){ Sign sign = (Sign) block.getState(); @@ -106,5 +106,5 @@ public class LeaveSign{ } } } - + } diff --git a/src/com/dre/dungeonsxl/P.java b/src/com/dre/dungeonsxl/P.java index 08d7b12e..a11699f9 100644 --- a/src/com/dre/dungeonsxl/P.java +++ b/src/com/dre/dungeonsxl/P.java @@ -43,7 +43,7 @@ public class P extends JavaPlugin{ //Main Config Reader public ConfigReader mainConfig; - + //Language Reader public LanguageReader language; @@ -62,22 +62,22 @@ public class P extends JavaPlugin{ //Commands getCommand("dungeonsxl").setExecutor(new CommandListener()); - + //Load Config mainConfig=new ConfigReader(new File(p.getDataFolder(), "config.yml")); - + //Load Language language = new LanguageReader(new File(p.getDataFolder(), "languages/de.yml")); //Init Classes new DCommandRoot(); - + //InitFolders this.initFolders(); - + //Setup Permissions this.setupPermissions(); - + //Listener entitylistener=new EntityListener(); playerlistener=new PlayerListener(); @@ -139,7 +139,7 @@ public class P extends JavaPlugin{ new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false); } }else{ - p.msg(player,p.language.get("error_tutorialnotexist"));//ChatColor.RED+"Tutorial Dungeon existiert nicht!"); + p.msg(player,p.language.get("Error_TutorialNotExist")); } } } @@ -154,7 +154,7 @@ public class P extends JavaPlugin{ DPlayer.update(false); } }, 0L, 2L); - + //MSG this.log(this.getDescription().getName()+" enabled!"); } @@ -162,10 +162,10 @@ public class P extends JavaPlugin{ @Override public void onDisable(){ - //Save + //Save this.saveData(); language.save(); - + //MSG this.log(this.getDescription().getName()+" disabled!"); @@ -186,14 +186,14 @@ public class P extends JavaPlugin{ GameCheckpoint.gcheckpoints.clear(); GameMessage.gmessages.clear(); MobSpawner.mobspawners.clear(); - + //Delete Worlds GameWorld.deleteAll(); EditWorld.deleteAll(); - + //Disable listeners HandlerList.unregisterAll(p); - + //Stop shedulers p.getServer().getScheduler().cancelTasks(this); } @@ -387,7 +387,7 @@ public class P extends JavaPlugin{ player.sendMessage(ChatColor.WHITE+msg); } } - + private String replaceColors(String msg){ if (msg!=null) { msg = msg.replace("&0", ChatColor.getByChar("0").toString()); @@ -413,10 +413,10 @@ public class P extends JavaPlugin{ msg = msg.replace("&o", ChatColor.getByChar("o").toString()); msg = msg.replace("&r", ChatColor.getByChar("r").toString()); } - + return msg; } - + //Misc. public EntityType getEntitiyType(String name){ for(EntityType type:EntityType.values()){ @@ -424,7 +424,7 @@ public class P extends JavaPlugin{ return type; } } - + return null; } diff --git a/src/com/dre/dungeonsxl/commands/CMDChat.java b/src/com/dre/dungeonsxl/commands/CMDChat.java index 487368fe..6a045a28 100644 --- a/src/com/dre/dungeonsxl/commands/CMDChat.java +++ b/src/com/dre/dungeonsxl/commands/CMDChat.java @@ -9,24 +9,24 @@ public class CMDChat extends DCommand{ public CMDChat(){ this.command="chat"; this.args=0; - this.help=p.language.get("help_cmd_chat");//"/dxl chat - Ändert den Chat-Modus"; + this.help=p.language.get("Help_Cmd_Chat"); } - - + + @Override public void onExecute(String[] args, Player player) { DPlayer dplayer=DPlayer.get(player); if(dplayer!=null){ if(dplayer.isInWorldChat) { dplayer.isInWorldChat=false; - p.msg(player,p.language.get("cmd_chat_normalchat")); + p.msg(player,p.language.get("Cmd_Chat_NormalChat")); }else{ dplayer.isInWorldChat=true; - p.msg(player,p.language.get("cmd_chat_dungeonchat")); + p.msg(player,p.language.get("Cmd_Chat_DungeonChat")); } }else{ - p.msg(player,p.language.get("cmd_chat_error1")); + p.msg(player,p.language.get("Error_NotInDungeon")); } } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDChatSpy.java b/src/com/dre/dungeonsxl/commands/CMDChatSpy.java index f81078c5..335d4944 100644 --- a/src/com/dre/dungeonsxl/commands/CMDChatSpy.java +++ b/src/com/dre/dungeonsxl/commands/CMDChatSpy.java @@ -6,20 +6,20 @@ public class CMDChatSpy extends DCommand{ public CMDChatSpy(){ this.command="chatspy"; this.args=0; - this.help=p.language.get("help_cmd_chatspy"); + this.help=p.language.get("Help_Cmd_Chatspy"); this.permissions="dxl.chatspy"; } - + @Override public void onExecute(String[] args, Player player) { if(p.chatSpyer.contains(player)){ p.chatSpyer.remove(player); - p.msg(player, p.language.get("cmd_chatspy_stopped"));//ChatColor.GOLD+"Du hast aufgehört den DXL-Chat auszuspähen!"); + p.msg(player, p.language.get("Cmd_Chatspy_Stopped")); } - + else{ p.chatSpyer.add(player); - p.msg(player, p.language.get("cmd_chatspy_start"));//ChatColor.GOLD+"Du hast begonnen den DXL-Chat auszuspähen!"); + p.msg(player, p.language.get("Cmd_Chatspy_Start")); } } } diff --git a/src/com/dre/dungeonsxl/commands/CMDCreate.java b/src/com/dre/dungeonsxl/commands/CMDCreate.java index 58fc6024..35e30cd6 100644 --- a/src/com/dre/dungeonsxl/commands/CMDCreate.java +++ b/src/com/dre/dungeonsxl/commands/CMDCreate.java @@ -6,33 +6,33 @@ import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.EditWorld; public class CMDCreate extends DCommand { - + public CMDCreate(){ this.args=1; this.command="create"; - this.help=p.language.get("help_cmd_create"); + this.help=p.language.get("Help_Cmd_Create"); this.permissions="dxl.create"; } - + @Override public void onExecute(String[] args, Player player) { String name=args[1]; - + if(DPlayer.get(player)==null){ if(name.length()<=15){ - + //Msg create - p.log(p.language.get("log_newdungeon"));//"New Dungeon: "+name); - p.log(p.language.get("log_generatenewworld"));//"Generate new world..."); - + p.log(p.language.get("Log_NewDungeon")); + p.log(p.language.get("Log_GenerateNewWorld")); + //Create World EditWorld eworld=new EditWorld(); eworld.generate(); eworld.dungeonname=name; - + //MSG Done - p.log(p.language.get("log_worldgenerationfinished"));//"World generation finished!" - + p.log(p.language.get("Log_WorldGenerationFinished")); + //Tp Player if(eworld.lobby==null){ new DPlayer(player,eworld.world,eworld.world.getSpawnLocation(), true); @@ -40,12 +40,12 @@ public class CMDCreate extends DCommand { new DPlayer(player,eworld.world,eworld.lobby, true); } }else{ - p.msg(player, p.language.get("cmd_create_error1"));//ChatColor.RED+"Der Name darf nicht länger sein als 15 Zeichen!"); + p.msg(player, p.language.get("Error_NameToLong")); } }else{ - p.msg(player, p.language.get("cmd_create_error2"));//ChatColor.RED+"Du musst zuerst aus dem aktuellen Dungeon raus!"); + p.msg(player, p.language.get("Error_LeaveDungeon")); } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDEdit.java b/src/com/dre/dungeonsxl/commands/CMDEdit.java index 0266c685..b5f5dfd8 100644 --- a/src/com/dre/dungeonsxl/commands/CMDEdit.java +++ b/src/com/dre/dungeonsxl/commands/CMDEdit.java @@ -7,23 +7,23 @@ import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.EditWorld; public class CMDEdit extends DCommand{ - + public CMDEdit(){ this.command="edit"; this.args=1; - this.help=p.language.get("help_cmd_edit");//"/dxl edit - Edit a existing dungeon"; + this.help=p.language.get("Help_Cmd_Edit"); } - + @Override public void onExecute(String[] args, Player player) { String dungeonname=args[1]; - + EditWorld eworld=EditWorld.load(dungeonname); - - + + DGroup dgroup=DGroup.get(player); DPlayer dplayer=DPlayer.get(player); - + if(EditWorld.isInvitedPlayer(dungeonname,player.getName())||p.permission.has(player, "dxl.edit")||player.isOp()){ if(dplayer==null){ if(dgroup==null){ @@ -34,16 +34,16 @@ public class CMDEdit extends DCommand{ new DPlayer(player,eworld.world,eworld.lobby, true); } }else{ - p.msg(player,p.language.get("cmd_edit_error1",dungeonname)); + p.msg(player,p.language.get("Error_DungeonNotExist",dungeonname)); } }else{ - p.msg(player,p.language.get("cmd_edit_error2")); + p.msg(player,p.language.get("Error_LeaveGroup")); } }else{ - p.msg(player,p.language.get("cmd_edit_error3")); + p.msg(player,p.language.get("Error_LeaveDungeon")); } } - + } } diff --git a/src/com/dre/dungeonsxl/commands/CMDHelp.java b/src/com/dre/dungeonsxl/commands/CMDHelp.java index 66f5a13b..18d2e1ce 100644 --- a/src/com/dre/dungeonsxl/commands/CMDHelp.java +++ b/src/com/dre/dungeonsxl/commands/CMDHelp.java @@ -4,18 +4,18 @@ import org.bukkit.ChatColor; import org.bukkit.entity.Player; public class CMDHelp extends DCommand{ - + public CMDHelp(){ this.command="help"; this.args=-1; - this.help=p.language.get("help_cmd_help");//"/dxl help - Displays the Help-Page"; + this.help=p.language.get("Help_Cmd_Help"); } - + @Override public void onExecute(String[] args, Player player) { int page=1; int pages=(int)(DCommandRoot.root.commands.size()/6); - + if(args.length>1){ try{ page=Integer.parseInt(args[1]); @@ -25,9 +25,9 @@ public class CMDHelp extends DCommand{ if(page<1) page=1; if(page>pages) page=pages; } - + p.msg(player, ChatColor.GREEN+"============[ "+ChatColor.GOLD+"Help DungeonsXL - "+page+"/"+pages+ChatColor.GREEN+" ]============",false); - + int i=0; int ipage=1; for(DCommand command:DCommandRoot.root.commands){ @@ -40,8 +40,8 @@ public class CMDHelp extends DCommand{ p.msg(player, ChatColor.YELLOW+command.help,false); } } - + p.msg(player, ChatColor.GREEN+"==============[ "+ChatColor.GOLD+"By Frank Baumann"+ChatColor.GREEN+" ]==============",false); } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDInvite.java b/src/com/dre/dungeonsxl/commands/CMDInvite.java index 10e30229..a1ae34fe 100644 --- a/src/com/dre/dungeonsxl/commands/CMDInvite.java +++ b/src/com/dre/dungeonsxl/commands/CMDInvite.java @@ -8,17 +8,17 @@ public class CMDInvite extends DCommand{ public CMDInvite(){ this.args=2; this.command="invite"; - this.help=p.language.get("help_cmd_invite");//"/dxl invite - Invites a Player to edit a Dungeon"; + this.help=p.language.get("Help_Cmd_Invite"); this.permissions="dxl.invite"; } - + @Override public void onExecute(String[] args, Player player) { if(EditWorld.addInvitedPlayer(args[2], args[1])){ - p.msg(player, p.language.get("cmd_invite_success",args[1],args[2]));//ChatColor.GREEN+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.GREEN+" wurde erfolgreich eingeladen am Dungeon "+ChatColor.GOLD+args[2]+ChatColor.GREEN+" zu arbeiten!"); + p.msg(player, p.language.get("Cmd_Invite_Success",args[1],args[2])); }else{ - p.msg(player, p.language.get("cmd_invite_error1",args[2]));//ChatColor.RED+"Spieler "+ChatColor.GOLD+args[1]+ChatColor.RED+" konnte nicht eingeladen werden. Existiert der Dungeon?"); + p.msg(player, p.language.get("Error_DungeonNotExist",args[2])); } - + } } diff --git a/src/com/dre/dungeonsxl/commands/CMDLeave.java b/src/com/dre/dungeonsxl/commands/CMDLeave.java index dc1c61bb..46bb2fe2 100644 --- a/src/com/dre/dungeonsxl/commands/CMDLeave.java +++ b/src/com/dre/dungeonsxl/commands/CMDLeave.java @@ -7,24 +7,24 @@ import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.game.GameWorld; public class CMDLeave extends DCommand { - + public CMDLeave(){ this.command="leave"; this.args=0; - this.help=p.language.get("help_cmd_leave");//"/dxl leave - leaves the current dungeon."; + this.help=p.language.get("Help_Cmd_Leave"); } - + @Override public void onExecute(String[] args, Player player) { DPlayer dplayer=DPlayer.get(player); - + if(GameWorld.get(player.getWorld())!=null){ if(GameWorld.get(player.getWorld()).isTutorial){ - p.msg(player,p.language.get("cmd_leave_error2"));//ChatColor.RED+"Du kannst diesen Befehl nicht in einem Tutorial benutzen!"); + p.msg(player,p.language.get("Error_NoLeaveInTutorial")); return; } } - + if(dplayer!=null){ dplayer.leave(); return; @@ -32,10 +32,10 @@ public class CMDLeave extends DCommand { DGroup dgroup=DGroup.get(player); if(dgroup!=null){ dgroup.removePlayer(player); - p.msg(player,p.language.get("cmd_leave_success"));//ChatColor.YELLOW+"Du hast deine Gruppe erfolgreich verlassen!"); + p.msg(player,p.language.get("Cmd_Leave_Success")); return; } - p.msg(player,p.language.get("cmd_leave_error1"));//ChatColor.RED+"You aren't in a dungeon!"); + p.msg(player,p.language.get("Error_NotInDungeon")); } } } diff --git a/src/com/dre/dungeonsxl/commands/CMDList.java b/src/com/dre/dungeonsxl/commands/CMDList.java index 7a7d7ebd..0b0b4990 100644 --- a/src/com/dre/dungeonsxl/commands/CMDList.java +++ b/src/com/dre/dungeonsxl/commands/CMDList.java @@ -10,21 +10,21 @@ public class CMDList extends DCommand{ public CMDList(){ this.command="list"; this.args=0; - this.help=p.language.get("help_cmd_list");//"/dxl list - Zeigt alle Dungeons an"; + this.help=p.language.get("Help_Cmd_List"); } - - + + @Override public void onExecute(String[] args, Player player) { - + File dungeonsfolder=new File(p.getDataFolder()+"/dungeons"); if(dungeonsfolder.exists()){ p.msg(player, ChatColor.DARK_GREEN+"-----[ "+ChatColor.GOLD+"Dungeons "+ChatColor.RED+dungeonsfolder.list().length+ChatColor.DARK_GREEN+"]-----"); - + for(String dungeon:dungeonsfolder.list()){ p.msg(player, dungeon); } } } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDMsg.java b/src/com/dre/dungeonsxl/commands/CMDMsg.java index d564de73..954153ea 100644 --- a/src/com/dre/dungeonsxl/commands/CMDMsg.java +++ b/src/com/dre/dungeonsxl/commands/CMDMsg.java @@ -8,33 +8,33 @@ import com.dre.dungeonsxl.ConfigReader; import com.dre.dungeonsxl.EditWorld; public class CMDMsg extends DCommand{ - + public CMDMsg(){ this.args=-1; this.command="msg"; - this.help=p.language.get("help_cmd_msg");//"/dxl msg '[msg]' - Display the msg or change the msg"; + this.help=p.language.get("Help_Cmd_Msg"); this.permissions="dxl.msg"; } - + @Override public void onExecute(String[] args, Player player) { EditWorld eworld=EditWorld.get(player.getWorld()); - + if(eworld!=null){ if(args.length>1){ try{ int id=Integer.parseInt(args[1]); - + ConfigReader confreader=new ConfigReader(new File(p.getDataFolder()+"/dungeons/"+eworld.dungeonname, "config.yml")); - + if(args.length==2){ String msg=confreader.msgs.get(id); if(msg!=null){ p.msg(player, ChatColor.WHITE+msg); }else{ - p.msg(player, p.language.get("cmd_msg_error1",""+id));//ChatColor.RED+"Nachricht mit der Id "+ChatColor.GOLD+id+ChatColor.RED+" existiert nicht!"); + p.msg(player, p.language.get("Error_MsgIdNotExist",""+id)); } - + }else{ String msg=""; int i=0; @@ -44,35 +44,35 @@ public class CMDMsg extends DCommand{ msg=msg+" "+arg; } } - + String[] splitMsg=msg.split("'"); if(splitMsg.length>1){ msg=splitMsg[1]; String old=confreader.msgs.get(id); if(old==null){ - p.msg(player, p.language.get("cmd_msg_added",""+id));//ChatColor.GREEN+"Neue Nachricht ("+ChatColor.GOLD+id+ChatColor.GREEN+") hinzugefügt!"); + p.msg(player, p.language.get("Cmd_Msg_Added",""+id)); }else{ - p.msg(player, p.language.get("cmd_msg_updated",""+id));//ChatColor.GREEN+"Nachricht ("+ChatColor.GOLD+id+ChatColor.GREEN+") aktualisiert!"); + p.msg(player, p.language.get("Cmd_Msg_Updated",""+id)); } - + confreader.msgs.put(id, msg); confreader.save(); }else{ - p.msg(player, p.language.get("cmd_msg_error2"));//ChatColor.RED+"Du musst die Nachricht zwischen ' einfügen!"); + p.msg(player, p.language.get("Error_MsgFormat")); } } }catch(NumberFormatException e){ - p.msg(player, p.language.get("cmd_msg_error3"));//ChatColor.RED+"Parameter muss eine Zahl beinhalten!"); + p.msg(player, p.language.get("Error_MsgNoInt")); } - + }else{ this.displayhelp(player); } }else{ - p.msg(player, p.language.get("cmd_msg_error4"));//ChatColor.RED+"Du musst einen Dungeon bearbeiten um diesen Befehl zu benutzen!"); + p.msg(player, p.language.get("Error_NotInDungeon")); } - + } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDPortal.java b/src/com/dre/dungeonsxl/commands/CMDPortal.java index 42873f1d..b9caa985 100644 --- a/src/com/dre/dungeonsxl/commands/CMDPortal.java +++ b/src/com/dre/dungeonsxl/commands/CMDPortal.java @@ -7,21 +7,21 @@ import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.DPortal; public class CMDPortal extends DCommand{ - + public CMDPortal(){ this.command="portal"; this.args=0; - this.help=p.language.get("help_cmd_portal");//"/dxl portal - Create a portal that goes in a dungeon or out a dungeon"; + this.help=p.language.get("Help_Cmd_Portal"); this.permissions="dxl.portal"; } - + @Override public void onExecute(String[] args, Player player) { DPortal dportal=new DPortal(false); dportal.player=player; dportal.world=player.getWorld(); player.getInventory().setItemInHand(new ItemStack(268)); - + //Check Destination DPlayer dplayer=DPlayer.get(player); if(dplayer!=null){ //Is player in EditWorld @@ -30,5 +30,5 @@ public class CMDPortal extends DCommand{ dportal.type="todungeon"; } } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDReload.java b/src/com/dre/dungeonsxl/commands/CMDReload.java index e04221d6..94fd061d 100644 --- a/src/com/dre/dungeonsxl/commands/CMDReload.java +++ b/src/com/dre/dungeonsxl/commands/CMDReload.java @@ -8,15 +8,15 @@ public class CMDReload extends DCommand{ public CMDReload(){ this.command="reload"; this.args=0; - this.help=p.language.get("help_cmd_reload");//"/dxl reload - Reloadet das Plugin"; + this.help=p.language.get("Help_Cmd_Reload"); this.permissions="dxl.reload"; } - + @Override public void onExecute(String[] args, Player player) { - p.msg(player, p.language.get("cmd_reload_start"));//ChatColor.GREEN+"DungeonsXL wird neu geladen"); + p.msg(player, p.language.get("Cmd_Reload_Start")); p.onDisable(); p.onEnable(); - p.msg(player, p.language.get("cmd_reload_done"));//ChatColor.GREEN+"DungeonsXL neuladen erfolgreich!"); + p.msg(player, p.language.get("Cmd_Reload_Done")); } } diff --git a/src/com/dre/dungeonsxl/commands/CMDSave.java b/src/com/dre/dungeonsxl/commands/CMDSave.java index a242bc10..2d38f2c2 100644 --- a/src/com/dre/dungeonsxl/commands/CMDSave.java +++ b/src/com/dre/dungeonsxl/commands/CMDSave.java @@ -9,19 +9,19 @@ public class CMDSave extends DCommand{ public CMDSave(){ this.command="save"; this.args=0; - this.help=p.language.get("help_cmd_save");//"/dxl save - Save the current dungeon."; + this.help=p.language.get("Help_Cmd_Save"); this.permissions="dxl.save"; } - - + + @Override public void onExecute(String[] args, Player player) { EditWorld eworld=EditWorld.get(player.getWorld()); if(eworld!=null){ eworld.save(); - p.msg(player,p.language.get("cmd_save_success"));//ChatColor.GOLD+"Dungeon erfolgreich gespeichert!"); + p.msg(player,p.language.get("Cmd_Save_Success")); }else{ - p.msg(player,p.language.get("cmd_save_error1"));//ChatColor.RED+"Du musst einen Dungeon editieren, um ihn zu speichern!"); + p.msg(player,p.language.get("Error_NotInDungeon")); } } } diff --git a/src/com/dre/dungeonsxl/commands/CMDTest.java b/src/com/dre/dungeonsxl/commands/CMDTest.java index f2707d4f..77c33d60 100644 --- a/src/com/dre/dungeonsxl/commands/CMDTest.java +++ b/src/com/dre/dungeonsxl/commands/CMDTest.java @@ -8,32 +8,32 @@ import com.dre.dungeonsxl.EditWorld; import com.dre.dungeonsxl.game.GameWorld; public class CMDTest extends DCommand { - + public CMDTest(){ this.command="test"; this.args=-1; - this.help=p.language.get("help_cmd_test");//"/dxl test [dungeon] - Test a Dungeon"; + this.help=p.language.get("Help_Cmd_Test"); this.permissions="dxl.test"; } - + @Override public void onExecute(String[] args, Player player) { DPlayer dplayer=DPlayer.get(player); String dungeonname; - + if(dplayer==null){ if(args.length>1){ dungeonname=args[1]; - + if(EditWorld.exist(dungeonname)){ DGroup dgroup=new DGroup(player, dungeonname); if(dgroup!=null){ if(dgroup.gworld==null){ dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname); } - + DPlayer newDPlayer; - + if(dgroup.gworld.locLobby==null){ newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false); }else{ @@ -42,43 +42,43 @@ public class CMDTest extends DCommand { newDPlayer.isinTestMode=2; } }else{ - p.msg(player, p.language.get("cmd_test_error1",dungeonname)); + p.msg(player, p.language.get("Error_DungeonNotExist",dungeonname)); } }else{ this.displayhelp(player); } }else if(dplayer.isEditing){ - + if(args.length>1){ dungeonname=args[1]; }else{ dungeonname=EditWorld.get(dplayer.world).dungeonname; } - + DGroup dgroup=new DGroup(player, dungeonname); if(dgroup!=null){ if(dgroup.gworld==null){ dgroup.gworld=GameWorld.load(DGroup.get(player).dungeonname); } - + DPlayer newDPlayer; - + if(dgroup.gworld.locLobby==null){ newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.world.getSpawnLocation(), false); }else{ newDPlayer=new DPlayer(player,dgroup.gworld.world,dgroup.gworld.locLobby, false); } - + newDPlayer.oldDPlayer=dplayer; dplayer.isinTestMode=1; } - + }else{ - p.msg(player, p.language.get("cmd_test_error2")); + p.msg(player, p.language.get("Error_LeaveDungeon")); } - - - + + + } - + } diff --git a/src/com/dre/dungeonsxl/commands/CMDUninvite.java b/src/com/dre/dungeonsxl/commands/CMDUninvite.java index 8bf42a29..c70ac312 100644 --- a/src/com/dre/dungeonsxl/commands/CMDUninvite.java +++ b/src/com/dre/dungeonsxl/commands/CMDUninvite.java @@ -8,16 +8,16 @@ public class CMDUninvite extends DCommand{ public CMDUninvite(){ this.args=2; this.command="uninvite"; - this.help=p.language.get("help_cmd_uninvite"); + this.help=p.language.get("Help_Cmd_Uninvite"); this.permissions="dxl.uninvite"; } - + @Override public void onExecute(String[] args, Player player) { if(EditWorld.removeInvitedPlayer(args[2], args[1])){ - p.msg(player, p.language.get("cmd_uninvite_success",args[1],args[2])); + p.msg(player, p.language.get("Cmd_Uninvite_Success",args[1],args[2])); }else{ - p.msg(player, p.language.get("cmd_uninvite_error1",args[2])); + p.msg(player, p.language.get("Error_DungeonNotExist",args[2])); } } } diff --git a/src/com/dre/dungeonsxl/game/GameCheckpoint.java b/src/com/dre/dungeonsxl/game/GameCheckpoint.java index 41f81ae9..af39313b 100644 --- a/src/com/dre/dungeonsxl/game/GameCheckpoint.java +++ b/src/com/dre/dungeonsxl/game/GameCheckpoint.java @@ -10,16 +10,16 @@ import com.dre.dungeonsxl.P; public class GameCheckpoint { public static CopyOnWriteArrayList gcheckpoints=new CopyOnWriteArrayList(); - + //Variables public GameWorld gworld; public Location location; public int radius; public CopyOnWriteArrayList dplayerHasUsed=new CopyOnWriteArrayList(); - + public GameCheckpoint(GameWorld gworld, Location location, int radius){ gcheckpoints.add(this); - + this.location=location; this.radius=radius; if(this.radius==0){ @@ -27,23 +27,23 @@ public class GameCheckpoint { } this.gworld=gworld; } - - + + //Statics - + public static void update(){ for(GameCheckpoint gpoint:gcheckpoints){ for(DPlayer dplayer:DPlayer.get(gpoint.gworld.world)){ if(!gpoint.dplayerHasUsed.contains(dplayer)){ if(dplayer.player.getLocation().distance(gpoint.location)<=gpoint.radius){ dplayer.setCheckpoint(gpoint); - P.p.msg(dplayer.player, P.p.language.get("player_checkpoint_reached"));//ChatColor.GOLD+"Checkpoint erreicht!"); + P.p.msg(dplayer.player, P.p.language.get("Player_CheckpointReached"));//ChatColor.GOLD+"Checkpoint erreicht!"); gpoint.dplayerHasUsed.add(dplayer); } } } } } - - + + } diff --git a/src/com/dre/dungeonsxl/game/GameChest.java b/src/com/dre/dungeonsxl/game/GameChest.java index 757c67f9..de20ef0b 100644 --- a/src/com/dre/dungeonsxl/game/GameChest.java +++ b/src/com/dre/dungeonsxl/game/GameChest.java @@ -13,23 +13,23 @@ import com.dre.dungeonsxl.DPlayer; import com.dre.dungeonsxl.P; public class GameChest { - + //Variables public boolean isUsed=false; public Chest chest; public GameWorld gworld; - + public GameChest(Block chest, GameWorld gworld){ if(chest.getState() instanceof Chest ){ this.chest=(Chest)chest.getState(); - + this.gworld=gworld; - + gworld.gchests.add(this); } } - - + + public void addTreasure(DGroup dgroup){ if(dgroup!=null){ for(Player player:dgroup.players){ @@ -43,23 +43,23 @@ public class GameChest { } } msg=msg.substring(0,msg.length()-1); - - P.p.msg(player, P.p.language.get("player_lootadded",msg)); + + P.p.msg(player, P.p.language.get("Player_LootAdded",msg)); } } } } - + //Statics public static void onOpenInventory(InventoryOpenEvent event){ InventoryView inventory=event.getView(); - + GameWorld gworld=GameWorld.get(event.getPlayer().getWorld()); - + if(gworld!=null){ if(inventory.getTopInventory().getHolder() instanceof Chest){ Chest chest=(Chest) inventory.getTopInventory().getHolder(); - + for(GameChest gchest:gworld.gchests){ if(gchest.chest.equals(chest)){ if(!gchest.isUsed){ @@ -77,5 +77,5 @@ public class GameChest { } } } - + } diff --git a/src/com/dre/dungeonsxl/listener/CommandListener.java b/src/com/dre/dungeonsxl/listener/CommandListener.java index ee393c7a..2049a236 100644 --- a/src/com/dre/dungeonsxl/listener/CommandListener.java +++ b/src/com/dre/dungeonsxl/listener/CommandListener.java @@ -13,13 +13,13 @@ public class CommandListener implements CommandExecutor { @Override public boolean onCommand(CommandSender sender, Command cmd_notused, String arg, String[] args) { - + //Only Playercommands if(sender instanceof Player){ Player player = (Player) sender; if(args.length > 0){ String cmd = args[0]; - + for(DCommand command:DCommandRoot.root.commands){ if(cmd.equals(command.command)){ if(command.playerHasPermissions(player)){ @@ -30,21 +30,21 @@ public class CommandListener implements CommandExecutor { } } else{ - P.p.msg(player, P.p.language.get("cmd_nopermissions"));//ChatColor.RED+"Du hast keine Permissions dazu!"); + P.p.msg(player, P.p.language.get("Error_NoPermissions")); } return true; } } - - P.p.msg(player, P.p.language.get("cmd_notexist1",cmd));//ChatColor.RED+"Befehl "+ChatColor.GOLD+cmd+ChatColor.RED+" existiert nicht!"); - P.p.msg(player, P.p.language.get("cmd_notexist2"));//ChatColor.RED+"Bitte gib "+ChatColor.GOLD+"/dxl help"+ChatColor.RED+" für Hilfe ein!"); + + P.p.msg(player, P.p.language.get("Error_CmdNotExist1",cmd)); + P.p.msg(player, P.p.language.get("Error_CmdNotExist2")); }else{ DCommandRoot.root.cmdHelp.onExecute(args,player); } } return false; } - - + + } diff --git a/src/com/dre/dungeonsxl/listener/PlayerListener.java b/src/com/dre/dungeonsxl/listener/PlayerListener.java index c0123567..5893c3d8 100644 --- a/src/com/dre/dungeonsxl/listener/PlayerListener.java +++ b/src/com/dre/dungeonsxl/listener/PlayerListener.java @@ -48,7 +48,7 @@ public class PlayerListener implements Listener{ if(GameWorld.get(player.getWorld())!=null || EditWorld.get(player.getWorld())!=null){ if(event.getAction()!=Action.LEFT_CLICK_BLOCK){ if(clickedBlock.getType()==Material.ENDER_CHEST){ - p.msg(player, p.language.get("player_enderchest_error"));//ChatColor.RED+"Du kannst keine Enderchest in einem Dungeon verwenden!"); + p.msg(player, p.language.get("Error_Enderchest")); event.setCancelled(true); } } @@ -108,10 +108,10 @@ public class PlayerListener implements Listener{ if(!dplayer.isReady){ if(gworld.signClass.isEmpty() || dplayer.dclass!=null){ dplayer.ready(); - p.msg(player,p.language.get("player_ready"));//ChatColor.GOLD+"Du bist nun bereit für den Dungeon!"); + p.msg(player,p.language.get("Player_Ready")); return; }else{ - p.msg(player,p.language.get("player_ready_error"));//ChatColor.RED+"Wähle zuerst eine Klasse!"); + p.msg(player,p.language.get("Error_Ready")); } } } @@ -125,7 +125,7 @@ public class PlayerListener implements Listener{ dplayer.finish(); return; }else{ - p.msg(player,p.language.get("player_leftklick_error"));//ChatColor.RED+"Du musst das Schild mit Links-klick berühren!"); + p.msg(player,p.language.get("Error_Leftklick")); } } } @@ -147,7 +147,7 @@ public class PlayerListener implements Listener{ if(event.getAction()==Action.LEFT_CLICK_BLOCK){ dplayer.setClass(ChatColor.stripColor(classSign.getLine(1))); }else{ - p.msg(player,p.language.get("player_leftklick_error"));//+"Du musst die Klasse mit Links-klick auswählen!"); + p.msg(player,p.language.get("Error_Leftklick")); } return; } @@ -182,17 +182,10 @@ public class PlayerListener implements Listener{ for(Material material:gworld.confReader.secureobjects){ if(material==event.getItemDrop().getItemStack().getType()){ event.setCancelled(true); - p.msg(player,p.language.get("player_drop_error"));//ChatColor.RED+"Du kannst keine sicheren Objekte droppen"); + p.msg(player,p.language.get("Error_Drop")); return; } } - /*if(dplayer.invItemInHand==event.getItemDrop().getItemStack().getTypeId()){ - dplayer.invItemInHand=0; - }else{ - p.msg(player,ChatColor.RED+"Du kannst keine sicheren Objekte droppen"); - event.setCancelled(true); - return; - }*/ } } } @@ -314,7 +307,7 @@ public class PlayerListener implements Listener{ if(!dplayer.isEditing){ String[] splittedCmd=event.getMessage().split(" "); if(!splittedCmd[0].equalsIgnoreCase("/dungeon") && !splittedCmd[0].equalsIgnoreCase("/dungeonsxl") && !splittedCmd[0].equalsIgnoreCase("/dxl")){ - p.msg(event.getPlayer(), p.language.get("player_cmd_error"));//ChatColor.RED+"Befehle sind während des Dungeons nicht erlaubt"); + p.msg(event.getPlayer(), p.language.get("Error_Cmd")); event.setCancelled(true); } }