Added: #10: Dispenser für niemandem mehr zugänglich

https://github.com/DieReicheErethons/DungeonsXL/issues/issue/10
This commit is contained in:
Grafe 2013-01-12 04:32:30 +01:00
parent 8145fae487
commit 466b7305a7
2 changed files with 19 additions and 5 deletions

View File

@ -22,8 +22,6 @@ public class LanguageReader {
/* Load */
this.file = file;
P.p.log("FilePath:"+file.getPath());
FileConfiguration configFile = YamlConfiguration.loadConfiguration(file);
Set<String> keySet = configFile.getKeys(false);
@ -68,6 +66,7 @@ public class LanguageReader {
/* Errors */
defaults.put("Error_Enderchest","&4Du kannst keine Enderchest in einem Dungeon verwenden!");
defaults.put("Error_Dispenser","&4Du kannst nicht auf diesen Dispenser zugreifen!");
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!");

View File

@ -43,13 +43,28 @@ public class PlayerListener implements Listener{
Player player = event.getPlayer();
Block clickedBlock=event.getClickedBlock();
//Block Enderchests
if(clickedBlock!=null){
//Block Enderchests
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("Error_Enderchest"));
event.setCancelled(true);
if(!player.isOp()){
p.msg(player, p.language.get("Error_Enderchest"));
event.setCancelled(true);
}
}
}
}
//Block Dispensers
if(GameWorld.get(player.getWorld())!=null){
if(event.getAction()!=Action.LEFT_CLICK_BLOCK){
if(clickedBlock.getType()==Material.DISPENSER){
if(!player.isOp()){
p.msg(player, p.language.get("Error_Dispenser"));
event.setCancelled(true);
}
}
}
}