Skip to content

Commit

Permalink
most of 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Simplicitee committed May 24, 2021
1 parent b2b77a0 commit 294a25f
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 77 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.simplicitee</groupId>
<artifactId>projectaddons</artifactId>
<version>1.2.1</version>
<version>1.2.2</version>
<name>ProjectAddons</name>

<repositories>
Expand Down
15 changes: 3 additions & 12 deletions src/me/simplicitee/project/addons/MainListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
import me.simplicitee.project.addons.ability.water.MistShards;
import me.simplicitee.project.addons.ability.water.PlantArmor;
import me.simplicitee.project.addons.ability.water.RazorLeaf;
import me.simplicitee.project.addons.util.BendingPredicate;

public class MainListener implements Listener {

Expand Down Expand Up @@ -718,20 +719,10 @@ private boolean canBend(Player player, String ability, boolean canbend) {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
CoreAbility abil = CoreAbility.getAbility(ability);

if (abil == null) {
return false;
} else if (bPlayer.getBoundAbility() == null) {
return false;
} else if (!bPlayer.getBoundAbilityName().equals(ability)) {
return false;
} else if (canbend && !bPlayer.canBend(abil)) {
return false;
} else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getLocation())) {
return false;
} else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getEyeLocation())) {
if (canbend && !bPlayer.canBend(abil)) {
return false;
}

return true;
return BendingPredicate.canBend(bPlayer, abil);
}
}
21 changes: 19 additions & 2 deletions src/me/simplicitee/project/addons/ability/air/FlightPassive.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.bukkit.Location;
import org.bukkit.entity.Player;

import com.projectkorra.projectkorra.Element;
import com.projectkorra.projectkorra.ability.AddonAbility;
import com.projectkorra.projectkorra.ability.FlightAbility;
import com.projectkorra.projectkorra.ability.PassiveAbility;
Expand All @@ -21,18 +22,26 @@ public FlightPassive(Player player) {
speed = startSpeed = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Glide.StartSpeed");
maxSpeed = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Glide.MaxSpeed");
acceleration = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Acceleration");

flightHandler.createInstance(player, "FlightPassive");
}

@Override
public void progress() {
if (!bPlayer.isElementToggled(Element.AIR)) {
player.setAllowFlight(false);
clear();
return;
}

if (player.getLocation().getBlock().isLiquid()) {
clear();
return;
}

player.setAllowFlight(true);

if (active && toggled) {
if (active && toggled) {
player.setGliding(true);

if (player.isSneaking() && player.getFlySpeed() < maxSpeed) {
Expand All @@ -52,6 +61,13 @@ private void clear() {
player.setFlying(false);
player.setGliding(false);
}

@Override
public void remove() {
super.remove();
clear();
flightHandler.removeInstance(player, "FlightPassive");
}

@Override
public boolean isSneakAbility() {
Expand Down Expand Up @@ -128,6 +144,7 @@ public void fly(boolean flying) {
player.setCanPickupItems(pickup);
active = false;
}
toggled = false;
}

public boolean isActive() {
Expand All @@ -145,7 +162,7 @@ public boolean isEnabled() {

@Override
public String getDescription() {
return "A very rare ability for airbenders is being able to fly freely, without the need of any glider. The only airbenders known to have this ability were Guru Laghima and Zaheer";
return "A very rare ability for airbenders is being able to fly freely, without the need of any glider. The only airbenders known to have this ability were Guru Laghima and Zaheer.";
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/me/simplicitee/project/addons/ability/air/GaleGust.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public GaleGust(Player player) {
current = GeneralMethods.getRightSide(player.getLocation().add(0, 1.2, 0), 0.55);
}

this.direction = player.getEyeLocation().getDirection().normalize();
this.direction = player.getEyeLocation().getDirection();
this.points = new HashSet<>();

bPlayer.addCooldown(this);
Expand All @@ -72,7 +72,7 @@ public void progress() {
}

if (player.isSneaking()) {
direction.add(player.getEyeLocation().getDirection()).normalize();
direction.add(player.getEyeLocation().getDirection()).normalize().multiply(knockback);
}

current = current.add(direction);
Expand All @@ -82,7 +82,7 @@ public void progress() {
return;
}

points.add(new Point(current.clone().setDirection(direction)));
points.add(new Point(current.clone().setDirection(direction.clone().normalize())));

for (Entity e : GeneralMethods.getEntitiesAroundPoint(current, radius)) {
if (e.getEntityId() == player.getEntityId()) {
Expand All @@ -93,7 +93,7 @@ public void progress() {
DamageHandler.damageEntity(e, damage, this);
}

e.setVelocity(direction.clone().multiply(knockback));
e.setVelocity(direction);
e.setFireTicks(0);
}

Expand Down
6 changes: 3 additions & 3 deletions src/me/simplicitee/project/addons/ability/air/SonicWave.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public SonicWave(Player player) {

launch();
start();
bPlayer.addCooldown(this);
}

@Override
Expand All @@ -77,9 +78,9 @@ public void progress() {
for (Player p : player.getWorld().getPlayers()) {
BendingPlayer bp = BendingPlayer.getBendingPlayer(p);
if (bp != null && bp.hasElement(ProjectAddons.instance.getSoundElement())) {
p.spawnParticle(Particle.SPELL_MOB_AMBIENT, loc, 1, 0, 0, 0);
p.playNote(loc, Instrument.FLUTE, Note.sharp(2, Tone.F));
p.spawnParticle(Particle.SPELL_MOB_AMBIENT, loc, 1, 0, 0, 0);
}
p.playNote(loc, Instrument.FLUTE, Note.sharp(2, Tone.F));
}

for (Entity e : GeneralMethods.getEntitiesAroundPoint(loc, 0.8)) {
Expand Down Expand Up @@ -126,7 +127,6 @@ private void launch() {
@Override
public void remove() {
super.remove();
bPlayer.addCooldown(this);
}

@Override
Expand Down
20 changes: 12 additions & 8 deletions src/me/simplicitee/project/addons/ability/chi/NinjaStance.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import java.util.ArrayList;
import java.util.List;

import javax.swing.event.DocumentEvent.ElementChange;

import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
Expand All @@ -13,8 +15,10 @@
import com.projectkorra.projectkorra.ability.AddonAbility;
import com.projectkorra.projectkorra.ability.ChiAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.util.ActionBar;

import me.simplicitee.project.addons.ProjectAddons;
import net.md_5.bungee.api.ChatColor;

public class NinjaStance extends ChiAbility implements AddonAbility{

Expand Down Expand Up @@ -92,16 +96,14 @@ public void progress() {
stealthStarted = true;
} else if (!player.isSneaking()) {
stopStealth();
} else if (stealthReady && player.isSneaking()) {
Location play = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize());
GeneralMethods.displayColoredParticle("#00ee00", play);
} else {
Location play = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize());
GeneralMethods.displayColoredParticle("#000000", play);
return;
}

GeneralMethods.displayColoredParticle(stealthReady && player.isSneaking() ? "00ee00" : "000000", player.getEyeLocation().add(player.getEyeLocation().getDirection()));
} else {
if (System.currentTimeMillis() >= stealthReadyStart + stealthDuration) {
stopStealth();
bPlayer.addCooldown("ninjastealth", stealthCooldown);
} else {
player.addPotionEffect(invis);
}
Expand Down Expand Up @@ -144,7 +146,10 @@ public boolean isEnabled() {

public void beginStealth() {
if (stealth) {
player.sendMessage("Already cloaked!");
ActionBar.sendActionBar(ChatColor.RED + "!> already cloaked <!", player);
return;
} else if (bPlayer.isOnCooldown("ninjastealth")) {
ActionBar.sendActionBar(ChatColor.RED + "!> cooldown <!", player);
return;
}
stealth = true;
Expand All @@ -155,7 +160,6 @@ public void stopStealth() {
stealth = false;
stealthReady = false;
stealthStarted = false;
bPlayer.addCooldown("ninjastealth", stealthCooldown);
}

public boolean isStealthed() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void clickFunction() {
for (Block b : blocks) {
BlockData data = b.getBlockData();
revertBlock(b);
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.5, 0.5), data.getMaterial(), data);
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.75, 0.5), data.getMaterial(), data);
fb.setDropItem(false);
fb.setMetadata("bulwark", new FixedMetadataValue(ProjectAddons.instance, this));
fb.setVelocity(player.getEyeLocation().getDirection().setY(0.195).normalize().multiply(throwSpeed));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.projectkorra.projectkorra.util.TempBlock;

import me.simplicitee.project.addons.ProjectAddons;
import me.simplicitee.project.addons.util.SoundEffect;

public class MagmaSlap extends LavaAbility implements AddonAbility {

Expand All @@ -45,6 +46,7 @@ public class MagmaSlap extends LavaAbility implements AddonAbility {
private Location start, curr;
private List<TempBlock> tempBlocks;
private Set<Block> affected;
private SoundEffect effect;

public MagmaSlap(Player player) {
super(player);
Expand Down Expand Up @@ -75,6 +77,7 @@ private void setFields() {
this.curr = start.clone();
this.tempBlocks = new ArrayList<>();
this.affected = new HashSet<>();
this.effect = new SoundEffect(Sound.ENTITY_CREEPER_PRIMED, 0.9f, 1f);
}

@Override
Expand Down Expand Up @@ -164,7 +167,7 @@ private void checkBlock(Block b) {
}
}

player.getWorld().playSound(fb.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.4f, 1f);
effect.play(fb.getLocation());
}

public void turnToTempBlock(Block b) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void progress() {
direction.setY(dHeight * 0.2);

player.setVelocity(direction);
if (ThreadLocalRandom.current().nextInt(6) == 0) {
if (ThreadLocalRandom.current().nextInt(20) == 0) {
playEarthbendingSound(player.getLocation());
}

Expand Down
11 changes: 8 additions & 3 deletions src/me/simplicitee/project/addons/ability/fire/ArcSpark.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import me.simplicitee.project.addons.ProjectAddons;
import me.simplicitee.project.addons.Util;
import me.simplicitee.project.addons.util.SoundEffect;

public class ArcSpark extends LightningAbility implements AddonAbility {

Expand All @@ -36,6 +37,8 @@ public class ArcSpark extends LightningAbility implements AddonAbility {
private long charge, chargedTill;
private boolean shoot, charged, left;
private List<String> attractive;

private SoundEffect charging;

public ArcSpark(Player player) {
super(player);
Expand All @@ -51,6 +54,8 @@ public ArcSpark(Player player) {
this.shoot = false;
this.chargedTill = System.currentTimeMillis();

this.charging = new SoundEffect(Sound.ENTITY_CREEPER_PRIMED, 0.3f, 0.6f, 30);

start();
}

Expand All @@ -70,11 +75,11 @@ public void progress() {
}

chargedTill = System.currentTimeMillis();
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
charging.play(player.getEyeLocation());
} else if (charged && !shoot) {
Util.playLightningParticles(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.3)), 1, 0.001, 0.001, 0.001);
chargedTill = System.currentTimeMillis();
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
charging.play(player.getEyeLocation());
} else if (charged && shoot) {
if (chargedTill + duration < System.currentTimeMillis()) {
remove();
Expand Down Expand Up @@ -157,7 +162,7 @@ private boolean arc(Location loc) {
}

Util.playLightningParticles(loc, 1, 0, 0, 0);
if (Math.random() < 0.15) {
if (Math.random() < 0.01) {
playLightningbendingSound(loc);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,10 @@ private boolean advance() {
return false;
}

Util.playLightningParticles(loc, 5, 0.1, 0.1, 0.1);
playLightningbendingSound(loc);
Util.playLightningParticles(loc, 1, 0.1, 0.1, 0.1);
if (Math.random() > 0.01) {
playLightningbendingSound(loc);
}

for (Entity e : GeneralMethods.getEntitiesAroundPoint(loc, 0.62)) {
if (e instanceof LivingEntity && e.getEntityId() != player.getEntityId()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import me.simplicitee.project.addons.ProjectAddons;
import me.simplicitee.project.addons.util.HexColor;
import me.simplicitee.project.addons.util.SoundEffect;

public class CombustBeam extends CombustionAbility implements AddonAbility {

Expand Down Expand Up @@ -50,6 +51,7 @@ public class CombustBeam extends CombustionAbility implements AddonAbility {
private boolean charging, charged;
private Location curr;
private Vector direction;
private SoundEffect sound;

private ParticleEffect[] flames = { ParticleEffect.FLAME, ParticleEffect.SOUL_FIRE_FLAME };

Expand All @@ -74,6 +76,7 @@ public CombustBeam(Player player) {
this.charged = false;
this.rotation = 0;
this.counter = 0;
this.sound = new SoundEffect(Sound.ENTITY_WITHER_AMBIENT, 0.01f, 0.6f, 30);

start();
}
Expand Down Expand Up @@ -106,7 +109,7 @@ public void progress() {
return;
}

player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_WITHER_AMBIENT, 0.01f, 0.6f);
sound.play(player.getEyeLocation());

if (getStartTime() + maxChargeTime <= System.currentTimeMillis()) {
this.chargeTime = maxChargeTime;
Expand Down Expand Up @@ -183,7 +186,7 @@ public void progress() {

rotation += 10;

if (counter % 6 == 0) {
if (counter % 10 == 0) {
ParticleEffect.EXPLOSION_LARGE.display(curr, 1);
playCombustionSound(curr);
}
Expand Down
Loading

0 comments on commit 294a25f

Please sign in to comment.