1
0
mirror of https://e.coding.net/circlecloud/RocketJump.git synced 2024-11-23 15:08:51 +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

@ -7,7 +7,6 @@
<name>RocketJump</name>
<build>
<finalName>${project.name}</finalName>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
@ -19,8 +18,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>

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,43 +52,14 @@ 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)) {
@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);
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;
}
}
}
@ -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());
@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);
}
}