Skip to content
Permalink
Browse files

Add option for resetting fall distance when void falling teleport is on.

reset-fall-on-void-teleport, defaults to false. (I can't remember if
old WG 6 behavior was to do this or not...?)
  • Loading branch information...
wizjany committed Jul 28, 2019
1 parent 4044e2b commit afe042ef4df76c0346a658d88514420623a22813
@@ -173,6 +173,11 @@ public void sendTitle(String title, String subtitle) {
getPlayer().sendTitle(title, subtitle, -1, -1, -1);
}

@Override
public void resetFallDistance() {
getPlayer().setFallDistance(0);
}

@Override
public String[] getGroups() {
return plugin.getGroups(getPlayer());
@@ -216,6 +216,7 @@ public void loadConfiguration() {
teleportOnSuffocation = getBoolean("player-damage.teleport-on-suffocation", false);
disableVoidDamage = getBoolean("player-damage.disable-void-damage", false);
teleportOnVoid = getBoolean("player-damage.teleport-on-void-falling", false);
safeFallOnVoid = getBoolean("player-damage.reset-fall-on-void-teleport", false);
disableExplosionDamage = getBoolean("player-damage.disable-explosion-damage", false);
disableMobDamage = getBoolean("player-damage.disable-mob-damage", false);
disableDeathMessages = getBoolean("player-damage.disable-death-messages", false);
@@ -164,6 +164,9 @@ private void onEntityDamageByBlock(EntityDamageByBlockEvent event) {

if (wcfg.teleportOnVoid && type == DamageCause.VOID) {
localPlayer.findFreePosition();
if (wcfg.safeFallOnVoid) {
localPlayer.resetFallDistance();
}
event.setCancelled(true);
return;
}
@@ -207,4 +207,9 @@ default Association getAssociation(List<ProtectedRegion> regions) {
*/
@Beta
void sendTitle(String title, String subtitle);

/**
* Clears fall distance.
*/
void resetFallDistance();
}
@@ -111,6 +111,7 @@
public boolean teleportOnSuffocation;
public boolean disableVoidDamage;
public boolean teleportOnVoid;
public boolean safeFallOnVoid;
public boolean disableExplosionDamage;
public boolean disableMobDamage;
public boolean highFreqFlags;
@@ -178,6 +178,11 @@ public void sendTitle(String title, String subtitle) {

}

@Override
public void resetFallDistance() {

}

@Override
public void printRaw(String msg) {
System.out.println("-> TestPlayer{" + this.name + "}: " + msg);

0 comments on commit afe042e

Please sign in to comment.
You can’t perform that action at this time.