1
0
mirror of https://e.coding.net/circlecloud/RocketJump.git synced 2025-11-24 23:56:06 +00:00

Update...

This commit is contained in:
502647092
2015-09-02 18:21:31 +08:00
parent 4ea7b265e2
commit 1bf2e39a10
2 changed files with 53 additions and 60 deletions

View File

@@ -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);
}
}