From 69ed96637362e4f5af92d72fa3e03d70c0839f6f Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sun, 21 Feb 2016 22:28:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BD=BF=E7=94=A8=E8=B7=B3?= =?UTF-8?q?=E6=9D=BF=E5=90=8E=E4=B8=8D=E6=89=A3=E8=A1=80=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- pom.xml | 4 ++-- .../cn/citycraft/JumpPlate/JumpPlate.java | 20 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index 79b3a96..8474696 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft JumpPlate - 1.2 + 1.3 JumpPlate ${project.name} @@ -54,7 +54,7 @@ http://ci.citycraft.cn:8080 - &c修复跳板命令问题... + &c修复使用跳板后不扣血的问题... DEBUG UTF-8 diff --git a/src/main/java/cn/citycraft/JumpPlate/JumpPlate.java b/src/main/java/cn/citycraft/JumpPlate/JumpPlate.java index 7379d85..601eedd 100644 --- a/src/main/java/cn/citycraft/JumpPlate/JumpPlate.java +++ b/src/main/java/cn/citycraft/JumpPlate/JumpPlate.java @@ -69,13 +69,13 @@ public class JumpPlate extends JavaPlugin implements Listener, HandlerCommands { public void onFallDamage(final EntityDamageEvent e) { if (e.getEntity() instanceof Player) { final Player p = (Player) e.getEntity(); - if (e.getCause() == DamageCause.FALL && (fall.contains(p.getName()))) { - final Location gb = p.getLocation(); - final Block loc = gb.add(0.0D, -1.0D, 0.0D).getBlock(); - final Block loc_1 = gb.add(0.0D, -1.0D, 0.0D).getBlock(); - final Block loc_2 = gb.add(0.0D, -1.0D, 0.0D).getBlock(); + if (e.getCause() == DamageCause.FALL && fall.contains(p.getName())) { + final Block gb = p.getLocation().getBlock(); + final Block loc = gb.getRelative(BlockFace.DOWN); + final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2); + final Block loc_2 = gb.getRelative(BlockFace.DOWN, 3); if (loc_1.getType() != Material.GLASS || loc_2.getType() != Material.LAPIS_BLOCK || !ml.contains(loc.getType())) { - fall.remove(p); + fall.remove(p.getName()); } e.setDamage(DamageModifier.BASE, 0); } @@ -95,35 +95,31 @@ public class JumpPlate extends JavaPlugin implements Listener, HandlerCommands { final Block loc = gb.getRelative(BlockFace.DOWN); final Block loc_1 = gb.getRelative(BlockFace.DOWN, 2); final Block loc_2 = gb.getRelative(BlockFace.DOWN, 3); - if ((loc_1.getType() == Material.GLASS) && (loc_2.getType() == Material.LAPIS_BLOCK)) { + if (loc_1.getType() == Material.GLASS && loc_2.getType() == Material.LAPIS_BLOCK && ml.contains(loc.getType())) { if (!p.hasPermission("JumpPlate.use")) { p.sendMessage(pluginname + config.getMessage("no-permission")); return; } switch (loc.getType()) { case IRON_BLOCK: - fall.add(p.getName()); p.setVelocity(p.getVelocity().setY(1)); break; case GOLD_BLOCK: - fall.add(p.getName()); p.setVelocity(p.getVelocity().setY(1.5)); break; case DIAMOND_BLOCK: - fall.add(p.getName()); p.setVelocity(p.getVelocity().setY(2)); break; case EMERALD_BLOCK: - fall.add(p.getName()); p.setVelocity(p.getVelocity().setY(2.5)); break; case BEDROCK: - fall.add(p.getName()); p.setVelocity(p.getVelocity().setY(config.getDouble("BEDROCK"))); break; default: break; } + fall.add(p.getName()); } }