Skip to content

Commit

Permalink
2.9.7
Browse files Browse the repository at this point in the history
* Used World#getMinHeight and World#getMaxHeight instead of hard-coded Y-values for certain abilities' cancellations (for 1.18 world height changes)
* Added getters and setters to almost all abilities for improved data accessibility
* Fixed many warnings and instances of poor style
* Made almost all abilities adhere to standards concerning the possible cancellation of the AbilityStartEvent, so no irreversible changes take place if the event is cancelled
* Converted all instances of Entity#setVelocity to the new GeneralMethods#setVelocity, which calls its own event
* Removed unnecessary "time" variables that can be replaced with getStartTime() calls
* Made FirePunch not static
  • Loading branch information
Aztlon committed May 26, 2022
1 parent 4f1d9c9 commit ada04f2
Show file tree
Hide file tree
Showing 64 changed files with 5,095 additions and 1,568 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Join our [Discord](https://discord.gg/gh9MfDmwZm) to discuss the plugin, suggest

## Changelog

### 2.9.7
- Used World#getMinHeight and World#getMaxHeight instead of hard-coded Y-values for certain abilities' cancellations (for 1.18 world height changes)
- Added getters and setters to almost all abilities for improved data accessibility
- Fixed many warnings and instances of poor style
- Made almost all abilities adhere to standards concerning the possible cancellation of the AbilityStartEvent, so no irreversible changes take place if the event is cancelled
- Converted all instances of Entity#setVelocity to the new GeneralMethods#setVelocity, which calls its own event
- Removed unnecessary "time" variables that can be replaced with getStartTime() calls
- Made FirePunch not static

### 2.9.6.2
- Started using jitpack for ProjectKorra dependency

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.jedk1</groupId>
<artifactId>jedcore</artifactId>
<version>2.9.6.2-Spigot1.18-PK1.9.3</version>
<version>2.9.7-Spigot1.18-PK1.9.3</version>
<packaging>jar</packaging>
<name>JedCore</name>

Expand Down
16 changes: 7 additions & 9 deletions src/com/jedk1/jedcore/JCManager.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.jedk1.jedcore;

import com.jedk1.jedcore.ability.firebending.FirePunch;
import com.jedk1.jedcore.ability.firebending.LightningBurst;
import com.jedk1.jedcore.ability.waterbending.HealingWaters;
import com.jedk1.jedcore.ability.waterbending.IcePassive;
import com.jedk1.jedcore.util.RegenTempBlock;
import com.jedk1.jedcore.util.TempFallingBlock;
import org.bukkit.Bukkit;

import org.bukkit.Bukkit;
import com.jedk1.jedcore.ability.firebending.LightningBurst;
import com.jedk1.jedcore.ability.waterbending.HealingWaters;
import com.jedk1.jedcore.ability.waterbending.IcePassive;
import com.jedk1.jedcore.util.RegenTempBlock;
import com.jedk1.jedcore.util.TempFallingBlock;

public class JCManager implements Runnable {

Expand All @@ -18,12 +17,11 @@ public JCManager(JedCore plugin) {
}

public void run() {
FirePunch.display(Bukkit.getServer());
LightningBurst.progressAll();

HealingWaters.heal(Bukkit.getServer());
IcePassive.handleSkating();
//IceWall.progressAll();
// IceWall.progressAll();

RegenTempBlock.manage();
TempFallingBlock.manage();
Expand Down
6 changes: 3 additions & 3 deletions src/com/jedk1/jedcore/JCMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public static void registerCombos() {

/**
* Gets the points of a line between two points.
* @param start
* @param end
* @param startLoc
* @param endLoc
* @param points
* @return locations
*/
Expand Down Expand Up @@ -123,7 +123,7 @@ public static List<Location> getCirclePoints(Location location, int points, doub
* @return
*/
public static List<Location> getVerticalCirclePoints(Location location, int points, double size, float yawOffset) {
List<Location> locations = new ArrayList<Location>();
List<Location> locations = new ArrayList<>();
Location fakeLoc = location.clone();
fakeLoc.setPitch(0);
fakeLoc.setYaw(yawOffset);
Expand Down
58 changes: 52 additions & 6 deletions src/com/jedk1/jedcore/ability/airbending/AirBlade.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ public AirBlade(Player player) {

this.location = player.getEyeLocation().clone();
this.direction = player.getEyeLocation().getDirection().clone();
bPlayer.addCooldown(this);

start();
if (!isRemoved())
bPlayer.addCooldown(this);
}

public void setFields() {
Expand Down Expand Up @@ -200,16 +202,60 @@ public String getDescription() {
ConfigurationSection config = JedCoreConfig.getConfig(this.player);
return "* JedCore Addon *\n" + config.getString("Abilities.Air.AirBlade.Description");
}

@Override
public void load() {

public Vector getDirection() {
return direction;
}

@Override
public void stop() {
public void setDirection(Vector direction) {
this.direction = direction;
}

public double getTravelled() {
return travelled;
}

public void setTravelled(double travelled) {
this.travelled = travelled;
}

public double getGrowth() {
return growth;
}

public void setGrowth(double growth) {
this.growth = growth;
}

public double getRange() {
return range;
}

public void setRange(double range) {
this.range = range;
}

public double getDamage() {
return damage;
}

public void setDamage(double damage) {
this.damage = damage;
}

public double getEntityCollisionRadius() {
return entityCollisionRadius;
}

public void setEntityCollisionRadius(double entityCollisionRadius) {
this.entityCollisionRadius = entityCollisionRadius;
}

@Override
public void load() {}

@Override
public void stop() {}

@Override
public boolean isEnabled() {
Expand Down
147 changes: 128 additions & 19 deletions src/com/jedk1/jedcore/ability/airbending/AirBreath.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

public class AirBreath extends AirAbility implements AddonAbility {

private long time;
private boolean isAvatar;

@Attribute(Attribute.COOLDOWN)
Expand Down Expand Up @@ -63,7 +62,6 @@ public AirBreath(Player player) {
}

setFields();
time = System.currentTimeMillis();
isAvatar = bPlayer.isAvatarState();
if (isAvatar && avatarAmplify) {
range = avatarRange;
Expand Down Expand Up @@ -109,26 +107,21 @@ public void progress() {
remove();
return;
}
if (System.currentTimeMillis() < time + duration) {
if (System.currentTimeMillis() < getStartTime() + duration) {
playAirbendingSound(player.getLocation());
createBeam();
} else {
bPlayer.addCooldown(this);
remove();
return;
}
return;
}

private boolean isLocationSafe(Location loc) {
Block block = loc.getBlock();
if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBreath", loc)) {
return false;
}
if (!isTransparent(block)) {
return false;
}
return true;
return isTransparent(block);
}

private void createBeam() {
Expand All @@ -146,15 +139,15 @@ private void createBeam() {
if (!isLocationSafe(loc)) {
if (!isTransparent(loc.getBlock())) {
if (player.getLocation().getPitch() > 30) {
player.setVelocity(player.getLocation().getDirection().multiply(-launch));
GeneralMethods.setVelocity(this, player, player.getLocation().getDirection().multiply(-launch));
}
}
return;
}

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(loc, damageregion)) {
if (entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) {
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))){
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(entity.getName()))){
continue;
}
if (entity instanceof LivingEntity) {
Expand All @@ -175,7 +168,7 @@ private void createBeam() {
}

dir.multiply(knockback);
entity.setVelocity(dir);
GeneralMethods.setVelocity(this, entity, dir);
}
}

Expand Down Expand Up @@ -206,7 +199,7 @@ public long getCooldown() {

@Override
public Location getLocation() {
return null;
return player.getEyeLocation();
}

@Override
Expand Down Expand Up @@ -240,15 +233,131 @@ public String getDescription() {
return "* JedCore Addon *\n" + config.getString("Abilities.Air.AirBreath.Description");
}

@Override
public void load() {
return;
public long getDuration() {
return duration;
}

@Override
public void stop() {
return;
public void setDuration(long duration) {
this.duration = duration;
}

public int getParticles() {
return particles;
}

public void setParticles(int particles) {
this.particles = particles;
}

public boolean isCoolLava() {
return coolLava;
}

public void setCoolLava(boolean coolLava) {
this.coolLava = coolLava;
}

public boolean canExtinguishFire() {
return extinguishFire;
}

public void setExtinguishFire(boolean extinguishFire) {
this.extinguishFire = extinguishFire;
}

public boolean canExtinguishMobs() {
return extinguishMobs;
}

public void setExtinguishMobs(boolean extinguishMobs) {
this.extinguishMobs = extinguishMobs;
}

public boolean isDamageEnabled() {
return damageEnabled;
}

public void setDamageEnabled(boolean damageEnabled) {
this.damageEnabled = damageEnabled;
}

public double getPlayerDamage() {
return playerDamage;
}

public void setPlayerDamage(double playerDamage) {
this.playerDamage = playerDamage;
}

public double getMobDamage() {
return mobDamage;
}

public void setMobDamage(double mobDamage) {
this.mobDamage = mobDamage;
}

public double getKnockback() {
return knockback;
}

public void setKnockback(double knockback) {
this.knockback = knockback;
}

public int getRange() {
return range;
}

public void setRange(int range) {
this.range = range;
}

public double getLaunch() {
return launch;
}

public void setLaunch(double launch) {
this.launch = launch;
}

public boolean canRegenOxygen() {
return regenOxygen;
}

public void setRegenOxygen(boolean regenOxygen) {
this.regenOxygen = regenOxygen;
}

public boolean isAvatarAmplify() {
return avatarAmplify;
}

public void setAvatarAmplify(boolean avatarAmplify) {
this.avatarAmplify = avatarAmplify;
}

public int getAvatarRange() {
return avatarRange;
}

public void setAvatarRange(int avatarRange) {
this.avatarRange = avatarRange;
}

public double getAvatarKnockback() {
return avatarKnockback;
}

public void setAvatarKnockback(double avatarKnockback) {
this.avatarKnockback = avatarKnockback;
}

@Override
public void load() {}

@Override
public void stop() {}

@Override
public boolean isEnabled() {
Expand Down
Loading

0 comments on commit ada04f2

Please sign in to comment.