Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 294a25f

Browse files
committed
most of 1.2.2
1 parent b2b77a0 commit 294a25f

17 files changed

Lines changed: 205 additions & 77 deletions

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>me.simplicitee</groupId>
44
<artifactId>projectaddons</artifactId>
5-
<version>1.2.1</version>
5+
<version>1.2.2</version>
66
<name>ProjectAddons</name>
77

88
<repositories>

src/me/simplicitee/project/addons/MainListener.java

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
import me.simplicitee.project.addons.ability.water.MistShards;
8686
import me.simplicitee.project.addons.ability.water.PlantArmor;
8787
import me.simplicitee.project.addons.ability.water.RazorLeaf;
88+
import me.simplicitee.project.addons.util.BendingPredicate;
8889

8990
public class MainListener implements Listener {
9091

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

721-
if (abil == null) {
722-
return false;
723-
} else if (bPlayer.getBoundAbility() == null) {
724-
return false;
725-
} else if (!bPlayer.getBoundAbilityName().equals(ability)) {
726-
return false;
727-
} else if (canbend && !bPlayer.canBend(abil)) {
728-
return false;
729-
} else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getLocation())) {
730-
return false;
731-
} else if (GeneralMethods.isRegionProtectedFromBuild(player, ability, player.getEyeLocation())) {
722+
if (canbend && !bPlayer.canBend(abil)) {
732723
return false;
733724
}
734725

735-
return true;
726+
return BendingPredicate.canBend(bPlayer, abil);
736727
}
737728
}

src/me/simplicitee/project/addons/ability/air/FlightPassive.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.bukkit.Location;
44
import org.bukkit.entity.Player;
55

6+
import com.projectkorra.projectkorra.Element;
67
import com.projectkorra.projectkorra.ability.AddonAbility;
78
import com.projectkorra.projectkorra.ability.FlightAbility;
89
import com.projectkorra.projectkorra.ability.PassiveAbility;
@@ -21,18 +22,26 @@ public FlightPassive(Player player) {
2122
speed = startSpeed = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Glide.StartSpeed");
2223
maxSpeed = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Glide.MaxSpeed");
2324
acceleration = (float) ProjectAddons.instance.getConfig().getDouble("Passives.Air.Flying.Acceleration");
25+
26+
flightHandler.createInstance(player, "FlightPassive");
2427
}
2528

2629
@Override
2730
public void progress() {
31+
if (!bPlayer.isElementToggled(Element.AIR)) {
32+
player.setAllowFlight(false);
33+
clear();
34+
return;
35+
}
36+
2837
if (player.getLocation().getBlock().isLiquid()) {
2938
clear();
3039
return;
3140
}
3241

3342
player.setAllowFlight(true);
3443

35-
if (active && toggled) {
44+
if (active && toggled) {
3645
player.setGliding(true);
3746

3847
if (player.isSneaking() && player.getFlySpeed() < maxSpeed) {
@@ -52,6 +61,13 @@ private void clear() {
5261
player.setFlying(false);
5362
player.setGliding(false);
5463
}
64+
65+
@Override
66+
public void remove() {
67+
super.remove();
68+
clear();
69+
flightHandler.removeInstance(player, "FlightPassive");
70+
}
5571

5672
@Override
5773
public boolean isSneakAbility() {
@@ -128,6 +144,7 @@ public void fly(boolean flying) {
128144
player.setCanPickupItems(pickup);
129145
active = false;
130146
}
147+
toggled = false;
131148
}
132149

133150
public boolean isActive() {
@@ -145,7 +162,7 @@ public boolean isEnabled() {
145162

146163
@Override
147164
public String getDescription() {
148-
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";
165+
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.";
149166
}
150167

151168
@Override

src/me/simplicitee/project/addons/ability/air/GaleGust.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public GaleGust(Player player) {
5252
current = GeneralMethods.getRightSide(player.getLocation().add(0, 1.2, 0), 0.55);
5353
}
5454

55-
this.direction = player.getEyeLocation().getDirection().normalize();
55+
this.direction = player.getEyeLocation().getDirection();
5656
this.points = new HashSet<>();
5757

5858
bPlayer.addCooldown(this);
@@ -72,7 +72,7 @@ public void progress() {
7272
}
7373

7474
if (player.isSneaking()) {
75-
direction.add(player.getEyeLocation().getDirection()).normalize();
75+
direction.add(player.getEyeLocation().getDirection()).normalize().multiply(knockback);
7676
}
7777

7878
current = current.add(direction);
@@ -82,7 +82,7 @@ public void progress() {
8282
return;
8383
}
8484

85-
points.add(new Point(current.clone().setDirection(direction)));
85+
points.add(new Point(current.clone().setDirection(direction.clone().normalize())));
8686

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

96-
e.setVelocity(direction.clone().multiply(knockback));
96+
e.setVelocity(direction);
9797
e.setFireTicks(0);
9898
}
9999

src/me/simplicitee/project/addons/ability/air/SonicWave.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public SonicWave(Player player) {
5353

5454
launch();
5555
start();
56+
bPlayer.addCooldown(this);
5657
}
5758

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

8586
for (Entity e : GeneralMethods.getEntitiesAroundPoint(loc, 0.8)) {
@@ -126,7 +127,6 @@ private void launch() {
126127
@Override
127128
public void remove() {
128129
super.remove();
129-
bPlayer.addCooldown(this);
130130
}
131131

132132
@Override

src/me/simplicitee/project/addons/ability/chi/NinjaStance.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.util.ArrayList;
44
import java.util.List;
55

6+
import javax.swing.event.DocumentEvent.ElementChange;
7+
68
import org.bukkit.Location;
79
import org.bukkit.Sound;
810
import org.bukkit.entity.Player;
@@ -13,8 +15,10 @@
1315
import com.projectkorra.projectkorra.ability.AddonAbility;
1416
import com.projectkorra.projectkorra.ability.ChiAbility;
1517
import com.projectkorra.projectkorra.attribute.Attribute;
18+
import com.projectkorra.projectkorra.util.ActionBar;
1619

1720
import me.simplicitee.project.addons.ProjectAddons;
21+
import net.md_5.bungee.api.ChatColor;
1822

1923
public class NinjaStance extends ChiAbility implements AddonAbility{
2024

@@ -92,16 +96,14 @@ public void progress() {
9296
stealthStarted = true;
9397
} else if (!player.isSneaking()) {
9498
stopStealth();
95-
} else if (stealthReady && player.isSneaking()) {
96-
Location play = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize());
97-
GeneralMethods.displayColoredParticle("#00ee00", play);
98-
} else {
99-
Location play = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().normalize());
100-
GeneralMethods.displayColoredParticle("#000000", play);
99+
return;
101100
}
101+
102+
GeneralMethods.displayColoredParticle(stealthReady && player.isSneaking() ? "00ee00" : "000000", player.getEyeLocation().add(player.getEyeLocation().getDirection()));
102103
} else {
103104
if (System.currentTimeMillis() >= stealthReadyStart + stealthDuration) {
104105
stopStealth();
106+
bPlayer.addCooldown("ninjastealth", stealthCooldown);
105107
} else {
106108
player.addPotionEffect(invis);
107109
}
@@ -144,7 +146,10 @@ public boolean isEnabled() {
144146

145147
public void beginStealth() {
146148
if (stealth) {
147-
player.sendMessage("Already cloaked!");
149+
ActionBar.sendActionBar(ChatColor.RED + "!> already cloaked <!", player);
150+
return;
151+
} else if (bPlayer.isOnCooldown("ninjastealth")) {
152+
ActionBar.sendActionBar(ChatColor.RED + "!> cooldown <!", player);
148153
return;
149154
}
150155
stealth = true;
@@ -155,7 +160,6 @@ public void stopStealth() {
155160
stealth = false;
156161
stealthReady = false;
157162
stealthStarted = false;
158-
bPlayer.addCooldown("ninjastealth", stealthCooldown);
159163
}
160164

161165
public boolean isStealthed() {

src/me/simplicitee/project/addons/ability/earth/Bulwark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public void clickFunction() {
175175
for (Block b : blocks) {
176176
BlockData data = b.getBlockData();
177177
revertBlock(b);
178-
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.5, 0.5), data.getMaterial(), data);
178+
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.75, 0.5), data.getMaterial(), data);
179179
fb.setDropItem(false);
180180
fb.setMetadata("bulwark", new FixedMetadataValue(ProjectAddons.instance, this));
181181
fb.setVelocity(player.getEyeLocation().getDirection().setY(0.195).normalize().multiply(throwSpeed));

src/me/simplicitee/project/addons/ability/earth/MagmaSlap.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.projectkorra.projectkorra.util.TempBlock;
2727

2828
import me.simplicitee.project.addons.ProjectAddons;
29+
import me.simplicitee.project.addons.util.SoundEffect;
2930

3031
public class MagmaSlap extends LavaAbility implements AddonAbility {
3132

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

4951
public MagmaSlap(Player player) {
5052
super(player);
@@ -75,6 +77,7 @@ private void setFields() {
7577
this.curr = start.clone();
7678
this.tempBlocks = new ArrayList<>();
7779
this.affected = new HashSet<>();
80+
this.effect = new SoundEffect(Sound.ENTITY_CREEPER_PRIMED, 0.9f, 1f);
7881
}
7982

8083
@Override
@@ -164,7 +167,7 @@ private void checkBlock(Block b) {
164167
}
165168
}
166169

167-
player.getWorld().playSound(fb.getLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.4f, 1f);
170+
effect.play(fb.getLocation());
168171
}
169172

170173
public void turnToTempBlock(Block b) {

src/me/simplicitee/project/addons/ability/earth/RockSlide.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void progress() {
123123
direction.setY(dHeight * 0.2);
124124

125125
player.setVelocity(direction);
126-
if (ThreadLocalRandom.current().nextInt(6) == 0) {
126+
if (ThreadLocalRandom.current().nextInt(20) == 0) {
127127
playEarthbendingSound(player.getLocation());
128128
}
129129

src/me/simplicitee/project/addons/ability/fire/ArcSpark.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import me.simplicitee.project.addons.ProjectAddons;
2121
import me.simplicitee.project.addons.Util;
22+
import me.simplicitee.project.addons.util.SoundEffect;
2223

2324
public class ArcSpark extends LightningAbility implements AddonAbility {
2425

@@ -36,6 +37,8 @@ public class ArcSpark extends LightningAbility implements AddonAbility {
3637
private long charge, chargedTill;
3738
private boolean shoot, charged, left;
3839
private List<String> attractive;
40+
41+
private SoundEffect charging;
3942

4043
public ArcSpark(Player player) {
4144
super(player);
@@ -51,6 +54,8 @@ public ArcSpark(Player player) {
5154
this.shoot = false;
5255
this.chargedTill = System.currentTimeMillis();
5356

57+
this.charging = new SoundEffect(Sound.ENTITY_CREEPER_PRIMED, 0.3f, 0.6f, 30);
58+
5459
start();
5560
}
5661

@@ -70,11 +75,11 @@ public void progress() {
7075
}
7176

7277
chargedTill = System.currentTimeMillis();
73-
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
78+
charging.play(player.getEyeLocation());
7479
} else if (charged && !shoot) {
7580
Util.playLightningParticles(player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.3)), 1, 0.001, 0.001, 0.001);
7681
chargedTill = System.currentTimeMillis();
77-
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
82+
charging.play(player.getEyeLocation());
7883
} else if (charged && shoot) {
7984
if (chargedTill + duration < System.currentTimeMillis()) {
8085
remove();
@@ -157,7 +162,7 @@ private boolean arc(Location loc) {
157162
}
158163

159164
Util.playLightningParticles(loc, 1, 0, 0, 0);
160-
if (Math.random() < 0.15) {
165+
if (Math.random() < 0.01) {
161166
playLightningbendingSound(loc);
162167
}
163168

0 commit comments

Comments
 (0)