From 1bf2e39a1051b6c71887530c9667bc4ad6a95c84 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 2 Sep 2015 18:21:31 +0800 Subject: [PATCH] Update... --- pom.xml | 5 +- .../java/cn/citycraft/RocketJump/Listen.java | 108 +++++++++--------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/pom.xml b/pom.xml index b76ee2f..429563e 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,6 @@ RocketJump ${project.name} - src src/main/resources @@ -19,8 +18,8 @@ maven-compiler-plugin 3.1 - 1.7 - 1.7 + 1.8 + 1.8 diff --git a/src/main/java/cn/citycraft/RocketJump/Listen.java b/src/main/java/cn/citycraft/RocketJump/Listen.java index 376a3d9..2899e17 100644 --- a/src/main/java/cn/citycraft/RocketJump/Listen.java +++ b/src/main/java/cn/citycraft/RocketJump/Listen.java @@ -27,6 +27,16 @@ public class Listen implements Listener { plugin = main; } + public void add(String p) { + if (!fall.contains(p)) + fall.add(p); + } + + public void efcadd(String p) { + if (!efc.contains(p)) + efc.add(p); + } + @EventHandler(ignoreCancelled = true) public void MoveEvent(PlayerMoveEvent e) { Player p = e.getPlayer(); @@ -42,44 +52,15 @@ public class Listen implements Listener { } } - @EventHandler(ignoreCancelled = true) - public void ToggleFlightEvent(PlayerToggleFlightEvent e) { - final Player p = e.getPlayer(); - if (plugin.Dante.contains(p.getName())) { - if (p.getLocation().add(0, -1, 0).getBlock().getType() == (Material.AIR) - && p.getLocation().add(0, -2, 0).getBlock().getType() == (Material.AIR)) { - e.setCancelled(true); - return; - } - if (!p.isFlying()) { - e.setCancelled(true); - pEffect(p.getLocation(), 80); - p.setVelocity(p.getVelocity().setY(1)); - p.setAllowFlight(false); - plugin.getServer().getScheduler() - .runTaskLaterAsynchronously(plugin, new Runnable() { - @Override - public void run() { - if (p.isOnline()) { - p.setVelocity(p.getVelocity().setY(10)); - final String name = p.getName(); - efcadd(name); - add(name); - plugin.getServer() - .getScheduler() - .runTaskLaterAsynchronously(plugin, - new Runnable() { - @Override - public void run() { - if (efc.contains(name)) - efc.remove(name); - } - }, 30); - } - } - }, 10); - trng = 30; - } + @EventHandler + public void onFallDamage(EntityDamageEvent e) { + if (e.getEntity() instanceof Player) { + Player p = (Player) e.getEntity(); + if (e.getCause() == DamageCause.FALL) + if (fall.contains(p.getName())) { + fall.remove(p.getName()); + e.setCancelled(true); + } } } @@ -93,26 +74,39 @@ public class Listen implements Listener { } } - @EventHandler - public void onFallDamage(EntityDamageEvent e) { - if (e.getEntity() instanceof Player) { - Player p = (Player) e.getEntity(); - if (e.getCause() == DamageCause.FALL) { - if (fall.contains(p.getName())) { - fall.remove(p.getName()); - e.setCancelled(true); - } + @EventHandler(ignoreCancelled = true) + public void ToggleFlightEvent(PlayerToggleFlightEvent e) { + final Player p = e.getPlayer(); + if (plugin.Dante.contains(p.getName())) { + if (p.getLocation().add(0, -1, 0).getBlock().getType() == (Material.AIR) && p.getLocation().add(0, -2, 0).getBlock().getType() == (Material.AIR)) { + e.setCancelled(true); + return; + } + if (!p.isFlying()) { + e.setCancelled(true); + pEffect(p.getLocation(), 80); + p.setVelocity(p.getVelocity().setY(1)); + p.setAllowFlight(false); + plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + @Override + public void run() { + if (p.isOnline()) { + p.setVelocity(p.getVelocity().setY(10)); + final String name = p.getName(); + efcadd(name); + add(name); + plugin.getServer().getScheduler().runTaskLaterAsynchronously(plugin, new Runnable() { + @Override + public void run() { + if (efc.contains(name)) + efc.remove(name); + } + }, 30); + } + } + }, 10); + trng = 30; } } } - - public void add(String p) { - if (!fall.contains(p)) - fall.add(p); - } - - public void efcadd(String p) { - if (!efc.contains(p)) - efc.add(p); - } }