From 466b7305a734f005c5a9cdb89ca2326dba8b8be1 Mon Sep 17 00:00:00 2001 From: Grafe Date: Sat, 12 Jan 2013 04:32:30 +0100 Subject: [PATCH] =?UTF-8?q?Added:=20#10:=20Dispenser=20f=C3=BCr=20niemande?= =?UTF-8?q?m=20mehr=20zug=C3=A4nglich=20https://github.com/DieReicheEretho?= =?UTF-8?q?ns/DungeonsXL/issues/issue/10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/dre/dungeonsxl/LanguageReader.java | 3 +-- .../dungeonsxl/listener/PlayerListener.java | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/com/dre/dungeonsxl/LanguageReader.java b/src/com/dre/dungeonsxl/LanguageReader.java index 87734e1e..65ebf62c 100644 --- a/src/com/dre/dungeonsxl/LanguageReader.java +++ b/src/com/dre/dungeonsxl/LanguageReader.java @@ -22,8 +22,6 @@ public class LanguageReader { /* Load */ this.file = file; - P.p.log("FilePath:"+file.getPath()); - FileConfiguration configFile = YamlConfiguration.loadConfiguration(file); Set 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!"); diff --git a/src/com/dre/dungeonsxl/listener/PlayerListener.java b/src/com/dre/dungeonsxl/listener/PlayerListener.java index 5893c3d8..fca6e7f8 100644 --- a/src/com/dre/dungeonsxl/listener/PlayerListener.java +++ b/src/com/dre/dungeonsxl/listener/PlayerListener.java @@ -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); + } } } }