mirror of
https://github.com/kaboomserver/extras.git
synced 2024-11-27 09:55:36 -05:00
Improve damage detection
This commit is contained in:
parent
efe379a7cf
commit
f30655a2f8
1 changed files with 13 additions and 9 deletions
|
@ -444,8 +444,13 @@ class Events implements Listener {
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (entity.getType() == EntityType.PLAYER) {
|
if (entity.getType() == EntityType.PLAYER) {
|
||||||
if (event.getCause() == DamageCause.VOID && entity.getLocation().getY() > -64) {
|
if (((event.getCause() == DamageCause.CUSTOM ||
|
||||||
event.setDamage(0);
|
event.getCause() == DamageCause.SUICIDE) &&
|
||||||
|
event.getDamage() == Short.MAX_VALUE) ||
|
||||||
|
(event.getCause() == DamageCause.VOID &&
|
||||||
|
event.getDamage() == Float.MAX_VALUE)) {
|
||||||
|
event.setDamage(Float.MAX_VALUE);
|
||||||
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -621,9 +626,9 @@ class Events implements Listener {
|
||||||
player.setRemainingAir(player.getMaximumAir());
|
player.setRemainingAir(player.getMaximumAir());
|
||||||
player.getActivePotionEffects().clear();
|
player.getActivePotionEffects().clear();
|
||||||
|
|
||||||
if (player.getLastDamageCause().getCause() != DamageCause.CUSTOM &&
|
if (player.getLastDamageCause().getCause() != DamageCause.SUICIDE &&
|
||||||
player.getLastDamageCause().getCause() != DamageCause.SUICIDE) {
|
player.getLastDamageCause().getDamage() != Float.MAX_VALUE) {
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(main, new Runnable() {
|
Bukkit.getScheduler().runTask(main, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (player.getBedSpawnLocation() != null) {
|
if (player.getBedSpawnLocation() != null) {
|
||||||
player.teleport(player.getBedSpawnLocation());
|
player.teleport(player.getBedSpawnLocation());
|
||||||
|
@ -681,17 +686,16 @@ class Events implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerLogin(PlayerLoginEvent event) {
|
void onPlayerLogin(PlayerLoginEvent event) {
|
||||||
/*if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
if (!(event.getHostname().startsWith("play.kaboom.pw") &&
|
||||||
event.getHostname().endsWith(":53950"))) {
|
event.getHostname().endsWith(":53950"))) {
|
||||||
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
|
event.disallow(Result.KICK_OTHER, "You connected to the server using an outdated server address/IP.\nPlease use the following address/IP:\n\nkaboom.pw");
|
||||||
} else {*/
|
} else {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
||||||
event.allow();
|
event.allow();
|
||||||
player.setOp(true);
|
player.setOp(true);
|
||||||
|
|
||||||
if (main.playerPremiumUUID.containsKey(player.getName())) {
|
if (main.playerPremiumUUID.containsKey(player.getName())) {
|
||||||
System.out.println(main.playerPremiumUUID.get(player.getName()));
|
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(main, new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
|
@ -725,7 +729,7 @@ class Events implements Listener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/*}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
Loading…
Reference in a new issue