-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from PrimordialMoros/java8
Merge version 1.2
- Loading branch information
Showing
32 changed files
with
1,185 additions
and
1,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hyperion is compiled and tested with Java 11+. | ||
|
||
To compile using Java 8 go to pom.xml and replace `<release>11</release>` with `<source>1.8</source><target>1.8</target>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
src/com/github/primordialmoros/hyperion/abilities/airbending/Evade.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* | ||
* Copyright 2016, 2017, 2020 Moros <https://github.com/PrimordialMoros> | ||
* | ||
* This file is part of Hyperion. | ||
* | ||
* Hyperion is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Hyperion is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Hyperion. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.github.primordialmoros.hyperion.abilities.airbending; | ||
|
||
import com.github.primordialmoros.hyperion.Hyperion; | ||
import com.projectkorra.projectkorra.ability.AddonAbility; | ||
import com.projectkorra.projectkorra.ability.AirAbility; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.util.Vector; | ||
|
||
public class Evade extends AirAbility implements AddonAbility { | ||
private Vector direction; | ||
|
||
private long cooldown; | ||
|
||
private double angleStep; | ||
|
||
public Evade(Player player) { | ||
super(player); | ||
|
||
if (!player.isOnGround() || player.getEyeLocation().getBlock().isLiquid() || hasAbility(player, Evade.class) || !bPlayer.canBend(this)) { | ||
return; | ||
} | ||
|
||
cooldown = Hyperion.getPlugin().getConfig().getLong("Abilities.Air.Evade.Cooldown"); | ||
direction = player.getEyeLocation().getDirection().setY(0).normalize().multiply(-0.2); | ||
|
||
angleStep = Math.PI / 10; | ||
if (player.getEyeLocation().getDirection().getY() >= 0) angleStep = -angleStep; | ||
|
||
player.setVelocity(player.getVelocity().add(new Vector(0, 0.1, 0))); | ||
|
||
bPlayer.addCooldown(this); | ||
player.setNoDamageTicks(5); | ||
start(); | ||
} | ||
|
||
@Override | ||
public void progress() { | ||
if (!bPlayer.canBendIgnoreCooldowns(this) || getCurrentTick() > getStartTick() + 10) { | ||
remove(); | ||
return; | ||
} | ||
for (int i = 0; i < 2; i++) { | ||
player.setVelocity(player.getVelocity().add(direction.clone())); | ||
direction.rotateAroundY(angleStep); | ||
playAirbendingParticles(player.getLocation().add(0, 1, 0), 2, 0, 0, 0); | ||
} | ||
} | ||
|
||
@Override | ||
public boolean isEnabled() { | ||
return Hyperion.getPlugin().getConfig().getBoolean("Abilities.Air.Evade.Enabled"); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "Evade"; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return Hyperion.getPlugin().getConfig().getString("Abilities.Air.Evade.Description"); | ||
} | ||
|
||
@Override | ||
public String getAuthor() { | ||
return Hyperion.getAuthor(); | ||
} | ||
|
||
@Override | ||
public String getVersion() { | ||
return Hyperion.getVersion(); | ||
} | ||
|
||
@Override | ||
public boolean isHarmlessAbility() { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isSneakAbility() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public long getCooldown() { | ||
return cooldown; | ||
} | ||
|
||
@Override | ||
public Location getLocation() { | ||
return player.getLocation(); | ||
} | ||
|
||
@Override | ||
public void load() { | ||
} | ||
|
||
@Override | ||
public void stop() { | ||
} | ||
|
||
@Override | ||
public void remove() { | ||
player.setNoDamageTicks(0); | ||
super.remove(); | ||
} | ||
} |
Oops, something went wrong.