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

Commit 9474ca1

Browse files
committed
making things great again
1 parent c2122d4 commit 9474ca1

File tree

14 files changed

+117
-103
lines changed

14 files changed

+117
-103
lines changed

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.1.1</version>
5+
<version>1.2.0</version>
66
<name>ProjectAddons</name>
77

88
<repositories>

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

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ public class ProjectAddons extends JavaPlugin {
3030

3131
private Config config;
3232
private BoardManager boards;
33-
private CustomMethods methods;
3433
private MainListener listener;
3534
private Element soundElement;
3635

@@ -60,7 +59,6 @@ public ChatColor getColor() {
6059
}
6160

6261
this.getCommand("projectaddons").setExecutor(new ProjectCommand());
63-
this.methods = new CustomMethods(this);
6462
}
6563

6664
@Override
@@ -107,10 +105,6 @@ public BoardManager getBoardManager() {
107105
return boards;
108106
}
109107

110-
public CustomMethods getMethods() {
111-
return methods;
112-
}
113-
114108
private void setupConfig() {
115109
FileConfiguration c = config.get();
116110

@@ -378,6 +372,7 @@ private void setupConfig() {
378372
c.addDefault("Abilities.Water.RazorLeaf.Damage", 2);
379373
c.addDefault("Abilities.Water.RazorLeaf.Radius", 0.7);
380374
c.addDefault("Abilities.Water.RazorLeaf.Range", 24);
375+
c.addDefault("Abilities.Water.RazorLeaf.MaxRecalls", 3);
381376
c.addDefault("Abilities.Water.RazorLeaf.Particles", 300);
382377

383378
// PlantArmor
@@ -467,6 +462,7 @@ private void setupConfig() {
467462
c.addDefault("Abilities.Chi.NinjaStance.Cooldown", 0);
468463
c.addDefault("Abilities.Chi.NinjaStance.Stealth.Duration", 5000);
469464
c.addDefault("Abilities.Chi.NinjaStance.Stealth.ChargeTime", 2000);
465+
c.addDefault("Abilities.Chi.NinjaStance.Stealth.Cooldown", 8000);
470466
c.addDefault("Abilities.Chi.NinjaStance.SpeedAmplifier", 5);
471467
c.addDefault("Abilities.Chi.NinjaStance.JumpAmplifier", 5);
472468
c.addDefault("Abilities.Chi.NinjaStance.DamageModifier", 0.75);
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package me.simplicitee.project.addons;
2+
3+
import org.bukkit.Location;
4+
5+
import com.projectkorra.projectkorra.GeneralMethods;
6+
7+
public final class Util {
8+
9+
private Util() {}
10+
11+
private static String[] lightning = {"e6efef", "03d2d2", "33e6ff", "03d2d2", "03d2d2", "33e6ff", "03d2d2", "33e6ff", "33e6ff"};
12+
13+
public static void playLightningParticles(Location loc, int amount, double xOff, double yOff, double zOff) {
14+
int i = (int) Math.round(Math.random() * (lightning.length - 1));
15+
GeneralMethods.displayColoredParticle(lightning[i], loc, amount, xOff, yOff, zOff);
16+
}
17+
18+
public static double clamp(double min, double max, double value) {
19+
if (value < min) {
20+
return min;
21+
} else if (value > max) {
22+
return max;
23+
} else {
24+
return value;
25+
}
26+
}
27+
}

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

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
import com.projectkorra.projectkorra.ability.EarthAbility;
2323
import com.projectkorra.projectkorra.attribute.Attribute;
2424
import com.projectkorra.projectkorra.earthbending.Collapse;
25-
import com.projectkorra.projectkorra.earthbending.RaiseEarth;
2625
import com.projectkorra.projectkorra.util.DamageHandler;
26+
import com.projectkorra.projectkorra.util.TempBlock;
2727

2828
import me.simplicitee.project.addons.ProjectAddons;
2929

@@ -40,7 +40,7 @@ public class Bulwark extends EarthAbility implements AddonAbility {
4040
@Attribute(Attribute.HEIGHT)
4141
private int height;
4242

43-
private Set<Block> blocks;
43+
private Set<Block> blocks, moved, tops;
4444
private Set<FallingBlock> fbs;
4545
private Location start;
4646
private boolean launched = false, init = false;
@@ -54,8 +54,8 @@ public Bulwark(Player player) {
5454
return;
5555
}
5656

57-
start = player.getLocation().subtract(0, 1, 0);
58-
if (!isEarthbendable(start.getBlock())) {
57+
start = player.getLocation();
58+
if (!isEarthbendable(start.getBlock().getRelative(BlockFace.DOWN))) {
5959
return;
6060
}
6161

@@ -64,8 +64,23 @@ public Bulwark(Player player) {
6464
this.throwSpeed = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Bulwark.ThrowSpeed");
6565
this.height = ProjectAddons.instance.getConfig().getInt("Abilities.Earth.Bulwark.Height");
6666
this.blocks = new HashSet<>();
67+
this.moved = new HashSet<>();
68+
this.tops = new HashSet<>();
69+
this.fbs = new HashSet<>();
6770
this.launchTime = 0;
6871

72+
Location front = start.clone().add(start.getDirection().setY(0).normalize().multiply(2.5));
73+
Location copy = front.clone();
74+
Vector toLeft = GeneralMethods.getDirection(front, GeneralMethods.getLeftSide(start, 3)).normalize().multiply(0.5);
75+
Vector toRight = GeneralMethods.getDirection(front, GeneralMethods.getRightSide(start, 3)).normalize().multiply(0.5);
76+
77+
loadPillar(front);
78+
79+
for (int i = 0; i <= 5; ++i) {
80+
loadPillar(front.add(toLeft));
81+
loadPillar(copy.add(toRight));
82+
}
83+
6984
start();
7085
}
7186

@@ -76,37 +91,28 @@ private void loadPillar(Location loc) {
7691
return;
7792
}
7893

79-
blocks.add(top);
94+
tops.add(top);
8095
}
8196

8297
@Override
8398
public void progress() {
84-
if (!init) {
85-
Location front = start.clone().add(player.getLocation().getDirection().setY(0).normalize().multiply(2.5));
86-
Vector toLeft = GeneralMethods.getDirection(front, GeneralMethods.getLeftSide(start, 3)).normalize().multiply(0.5);
87-
Vector toRight = GeneralMethods.getDirection(front, GeneralMethods.getRightSide(start, 3)).normalize().multiply(0.5);
88-
89-
loadPillar(front);
90-
91-
for (double i = 0.5; i <= 3; i += 0.5) {
92-
loadPillar(front.add(toLeft).clone());
99+
if (!tops.isEmpty()) {
100+
for (Block block : tops) {
101+
if (moveEarth(block, UP, height)) {
102+
blocks.add(block);
103+
moved.add(block.getRelative(BlockFace.UP));
104+
}
93105
}
94106

95-
front.add(toLeft.normalize().multiply(-3));
96-
97-
for (double i = 0.5; i <= 3; i += 0.5) {
98-
loadPillar(front.add(toRight).clone());
99-
}
100-
init = true;
101-
}
102-
103-
if (step < 2) {
104-
for (Block block : blocks) {
105-
moveEarth(block, UP, height);
107+
tops.clear();
108+
if (++step < height) {
109+
tops.addAll(moved);
110+
} else {
111+
blocks.addAll(moved);
106112
}
107-
++step;
113+
moved.clear();
108114
} else if (!launched) {
109-
if (start.distance(player.getLocation().subtract(0, 1, 0)) > 1.5) {
115+
if (start.distance(player.getLocation()) > 1.5) {
110116
remove();
111117
return;
112118
}
@@ -151,9 +157,7 @@ public void progress() {
151157
@Override
152158
public void remove() {
153159
super.remove();
154-
for (Block block : blocks) {
155-
new Collapse(player, block.getLocation());
156-
}
160+
blocks.forEach((b) -> revertBlock(b));
157161
for (FallingBlock fb : fbs) {
158162
fb.remove();
159163
}
@@ -167,13 +171,10 @@ public void clickFunction() {
167171
return;
168172
}
169173

170-
fbs = new HashSet<>();
171-
172174
launched = true;
173175
for (Block b : blocks) {
174176
BlockData data = b.getBlockData();
175177
revertBlock(b);
176-
177178
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.5, 0.5), data.getMaterial(), data);
178179
fb.setDropItem(false);
179180
fb.setMetadata("bulwark", new FixedMetadataValue(ProjectAddons.instance, this));

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package me.simplicitee.project.addons.ability.earth;
22

33
import java.util.ArrayList;
4+
import java.util.HashSet;
45
import java.util.List;
6+
import java.util.Set;
57

68
import org.bukkit.Location;
79
import org.bukkit.Material;
@@ -42,6 +44,7 @@ public class MagmaSlap extends LavaAbility implements AddonAbility {
4244
private long next, last;
4345
private Location start, curr;
4446
private List<TempBlock> tempBlocks;
47+
private Set<Block> affected;
4548

4649
public MagmaSlap(Player player) {
4750
super(player);
@@ -71,6 +74,7 @@ private void setFields() {
7174
this.start.add(start.getDirection().multiply(offset));
7275
this.curr = start.clone();
7376
this.tempBlocks = new ArrayList<>();
77+
this.affected = new HashSet<>();
7478
}
7579

7680
@Override
@@ -135,20 +139,17 @@ public void progress() {
135139
}
136140

137141
private void checkBlock(Block b) {
138-
if (TempBlock.isTempBlock(b)) {
139-
return;
140-
}
141-
142142
b = GeneralMethods.getTopBlock(b.getLocation(), 2);
143143
if (b.isPassable() && !b.isLiquid()) {
144-
b.breakNaturally();
144+
tempBlocks.add(new TempBlock(b, Material.AIR));
145145
b = b.getRelative(BlockFace.DOWN);
146146
}
147147

148-
if (!isEarthbendable(b.getType(), true, true, true)) {
148+
if (affected.contains(b) || affected.contains(b.getRelative(BlockFace.UP)) || TempBlock.isTempBlock(b) || !isEarthbendable(b.getType(), true, true, true)) {
149149
return;
150150
}
151151

152+
affected.add(b);
152153
tempBlocks.add(new TempBlock(b, Material.AIR));
153154

154155
FallingBlock fb = GeneralMethods.spawnFallingBlock(b.getLocation().add(0.5, 0.7, 0.5), Material.MAGMA_BLOCK);

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.projectkorra.projectkorra.util.ParticleEffect;
2121

2222
import me.simplicitee.project.addons.ProjectAddons;
23+
import me.simplicitee.project.addons.Util;
2324

2425
public class ShrapnelShot extends MetalAbility implements AddonAbility {
2526

@@ -29,6 +30,7 @@ public class ShrapnelShot extends MetalAbility implements AddonAbility {
2930
private long cooldown;
3031

3132
private Item nugget;
33+
private double speed;
3234

3335
public ShrapnelShot(Player player) {
3436
super(player);
@@ -53,14 +55,16 @@ public ShrapnelShot(Player player) {
5355
is.setAmount(is.getAmount() - 1);
5456
player.getInventory().setItem(slot, is);
5557

58+
this.speed = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Speed");
59+
this.damage = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Damage");
60+
this.cooldown = ProjectAddons.instance.getConfig().getLong("Abilities.Earth.Shrapnel.Shot.Cooldown");
61+
5662
Location spawn = GeneralMethods.getRightSide(player.getLocation(), 0.12).add(0, 1.3, 0);
5763

5864
nugget = player.getWorld().dropItem(spawn, new ItemStack(m));
5965
nugget.setPickupDelay(10);
60-
nugget.setVelocity(player.getLocation().getDirection().add(new Vector(0, 0.105, 0)).normalize().multiply(ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Speed")));
66+
nugget.setVelocity(player.getLocation().getDirection().add(new Vector(0, 0.105, 0)).normalize().multiply(speed));
6167

62-
damage = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Damage");
63-
cooldown = ProjectAddons.instance.getConfig().getLong("Abilities.Earth.Shrapnel.Shot.Cooldown");
6468

6569
bPlayer.addCooldown("Shrapnel", cooldown);
6670
start();
@@ -87,15 +91,17 @@ public ShrapnelShot(Player player, Vector direction, double speed) {
8791
is.setAmount(is.getAmount() - 1);
8892
player.getInventory().setItem(slot, is);
8993

94+
this.speed = speed;
95+
this.damage = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Damage");
96+
this.cooldown = ProjectAddons.instance.getConfig().getLong("Abilities.Earth.Shrapnel.Shot.Cooldown");
97+
9098
Location spawn = GeneralMethods.getRightSide(player.getLocation(), 0.12).add(0, 1.3, 0);
9199

92100
nugget = player.getWorld().dropItem(spawn, new ItemStack(m));
93101
nugget.setMetadata("shrapnel", new FixedMetadataValue(ProjectKorra.plugin, 0));
94102
nugget.setPickupDelay(10);
95103
nugget.setVelocity(direction.add(new Vector(0, 0.105, 0)).normalize().multiply(speed));
96104

97-
damage = ProjectAddons.instance.getConfig().getDouble("Abilities.Earth.Shrapnel.Shot.Damage");
98-
cooldown = ProjectAddons.instance.getConfig().getLong("Abilities.Earth.Shrapnel.Shot.Cooldown");
99105

100106
start();
101107
}
@@ -144,7 +150,7 @@ public void progress() {
144150

145151
ParticleEffect.CRIT.display(nugget.getLocation(), 1);
146152
player.getWorld().playSound(nugget.getLocation(), Sound.ENTITY_ARROW_HIT, 0.2f, 1f);
147-
double dmg = damage * (ProjectAddons.instance.getMethods().clamp(0.5, 4, nugget.getVelocity().length()) / 4);
153+
double dmg = Util.clamp(0, damage, damage * (nugget.getVelocity().length() / speed));
148154

149155
for (Entity e : GeneralMethods.getEntitiesAroundPoint(nugget.getLocation(), 1.5)) {
150156
if (e instanceof LivingEntity && e.getEntityId() != player.getEntityId()) {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import com.projectkorra.projectkorra.util.DamageHandler;
1919

2020
import me.simplicitee.project.addons.ProjectAddons;
21+
import me.simplicitee.project.addons.Util;
2122

2223
public class ArcSpark extends LightningAbility implements AddonAbility {
2324

@@ -65,13 +66,13 @@ public void progress() {
6566
if (checkTime <= 0) {
6667
charged = true;
6768
} else {
68-
ProjectAddons.instance.getMethods().playLightningParticles(player.getLocation().add(0, 1, 0), 2, 0.36, 0.21, 0.36);
69+
Util.playLightningParticles(player.getLocation().add(0, 1, 0), 2, 0.36, 0.21, 0.36);
6970
}
7071

7172
chargedTill = System.currentTimeMillis();
7273
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
7374
} else if (charged && !shoot) {
74-
ProjectAddons.instance.getMethods().playLightningParticles(GeneralMethods.getMainHandLocation(player), 1, 0.001, 0.001, 0.001);
75+
Util.playLightningParticles(GeneralMethods.getMainHandLocation(player), 1, 0.001, 0.001, 0.001);
7576
chargedTill = System.currentTimeMillis();
7677
player.getWorld().playSound(player.getEyeLocation(), Sound.ENTITY_CREEPER_PRIMED, 0.05f, 0.5f);
7778
} else if (charged && shoot) {
@@ -240,7 +241,7 @@ public void run(ArcSpark a) {
240241
return;
241242
}
242243

243-
ProjectAddons.instance.getMethods().playLightningParticles(loc, 1, 0, 0, 0);
244+
Util.playLightningParticles(loc, 1, 0, 0, 0);
244245
if (Math.random() < 0.15) {
245246
playLightningbendingSound(loc);
246247
}

0 commit comments

Comments
 (0)