Skip to content

Commit

Permalink
Plugin Cleanup + JedCore Ability Death Messages (#8)
Browse files Browse the repository at this point in the history
* Plugin Cleanup

- Added Aztl to the JedCore dev list command
- Removed pointless imports
- Replaced a lot of deprecated methods with the non deprecated versions
- Fixed Airbreath not extinguishing soul fire
- Fixed bending board not support the easy hex color format
- Fixed some signs not being supported in sign checking (warped, crimson, mangrove, bamboo, hanging)
- Optimized a few minor things

* Updated metal list in MagnetShield

* Fixed firebreath message

- Fixed rainbow FireBreath message being null when no one has used it in the server before

* Added death messages for all JedCore abilities

- Added JedCore death messages for all abilities
- Fixed Backstab not dealing "bending" damage
- Had to rename ElementSphere sub abilities due to them not working with the death message

* Fixed LavaFlux

- Fixed LavaFlux making perm stone and duplicating earth block items
- Fixed LavaFlux destroying plants
  • Loading branch information
StrangeOne101 committed Dec 22, 2022
1 parent d544c12 commit 2fe7528
Show file tree
Hide file tree
Showing 53 changed files with 301 additions and 236 deletions.
12 changes: 6 additions & 6 deletions src/com/jedk1/jedcore/JCMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.jedk1.jedcore.util.*;
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.region.RegionProtection;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
Expand Down Expand Up @@ -226,22 +227,21 @@ else if(noClip)

private static byte full = 0x0;

@SuppressWarnings("deprecation")
public static void extinguishBlocks(Player player, String ability, int range, int radius, boolean fire, boolean lava){
for (Block block : GeneralMethods.getBlocksAroundPoint(player.getTargetBlock((HashSet<Material>) null, (int) range).getLocation(), 2)) {

Material mat = block.getType();
if(mat != Material.FIRE && mat != Material.LAVA)
if(mat != Material.FIRE && mat != Material.LAVA && mat != Material.SOUL_FIRE)
continue;
if (GeneralMethods.isRegionProtectedFromBuild(player, ability, block.getLocation()))
if (RegionProtection.isRegionProtected(player, block.getLocation(), ability))
continue;
if (block.getType() == Material.FIRE && fire) {
if ((mat == Material.FIRE || mat == Material.SOUL_FIRE) && fire) {
block.setType(Material.AIR);
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
} else if (lava && block.getType() == Material.LAVA && isLiquidSource(block)) {
} else if (lava && mat == Material.LAVA && isLiquidSource(block)) {
block.setType(Material.OBSIDIAN);
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
} else if (block.getType() == Material.LAVA && lava) {
} else if (mat == Material.LAVA && lava) {
if (block.getData() == full) {
block.setType(Material.OBSIDIAN);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/com/jedk1/jedcore/ability/airbending/AirBlade.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import com.jedk1.jedcore.collision.CollisionDetector;
import com.jedk1.jedcore.collision.Sphere;
import com.jedk1.jedcore.configuration.JedCoreConfig;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AddonAbility;
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;

import org.bukkit.Location;
Expand Down Expand Up @@ -91,7 +91,7 @@ private void progressBlade() {
return;
}

if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlade", player.getLocation())) {
if (RegionProtection.isRegionProtected(player, player.getLocation(), this)) {
remove();
return;
}
Expand Down
5 changes: 3 additions & 2 deletions src/com/jedk1/jedcore/ability/airbending/AirBreath.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;

Expand Down Expand Up @@ -118,7 +119,7 @@ public void progress() {

private boolean isLocationSafe(Location loc) {
Block block = loc.getBlock();
if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBreath", loc)) {
if (RegionProtection.isRegionProtected(player, loc, this)) {
return false;
}
return isTransparent(block);
Expand Down Expand Up @@ -147,7 +148,7 @@ private void createBeam() {

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(entity.getName()))){
if (RegionProtection.isRegionProtected(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(entity.getName()))){
continue;
}
if (entity instanceof LivingEntity) {
Expand Down
3 changes: 2 additions & 1 deletion src/com/jedk1/jedcore/ability/airbending/AirPunch.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.projectkorra.projectkorra.ability.AirAbility;
import com.projectkorra.projectkorra.ability.util.Collision;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;

import org.bukkit.Location;
Expand Down Expand Up @@ -117,7 +118,7 @@ private void progressShots() {
break;
}
loc = loc.add(loc.getDirection().clone().multiply(1));
if (GeneralMethods.isSolid(loc.getBlock()) || isWater(loc.getBlock()) || GeneralMethods.isRegionProtectedFromBuild(player, "AirPunch", loc)) {
if (GeneralMethods.isSolid(loc.getBlock()) || isWater(loc.getBlock()) || RegionProtection.isRegionProtected(player, loc, this)) {
cancel = true;
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/com/jedk1/jedcore/ability/airbending/combo/AirSlam.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.ClickType;

import org.bukkit.Location;
Expand Down Expand Up @@ -44,7 +45,7 @@ public AirSlam(Player player) {

Entity target = GeneralMethods.getTargetedEntity(player, range, new ArrayList<>());
if (!(target instanceof LivingEntity)
|| GeneralMethods.isRegionProtectedFromBuild(this, target.getLocation())
|| RegionProtection.isRegionProtected(this, target.getLocation())
|| ((target instanceof Player) && Commands.invincible.contains(target.getName())))
return;
this.target = (LivingEntity) target;
Expand Down
3 changes: 2 additions & 1 deletion src/com/jedk1/jedcore/ability/avatar/SpiritBeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.projectkorra.projectkorra.ability.AddonAbility;
import com.projectkorra.projectkorra.ability.AvatarAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;

Expand Down Expand Up @@ -101,7 +102,7 @@ private void createBeam() {
for (double i = 0; i < range; i += 0.5) {
location = location.add(direction.multiply(0.5).normalize());

if (GeneralMethods.isRegionProtectedFromBuild(player, "SpiritBeam", location)) {
if (RegionProtection.isRegionProtected(player, location, this)) {
return;
}

Expand Down
9 changes: 5 additions & 4 deletions src/com/jedk1/jedcore/ability/avatar/elementsphere/ESAir.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.projectkorra.projectkorra.ability.AvatarAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;

import org.bukkit.Location;
Expand Down Expand Up @@ -46,7 +47,7 @@ public ESAir(Player player) {
return;
}
setFields();
if (GeneralMethods.isRegionProtectedFromBuild(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
if (RegionProtection.isRegionProtected(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
return;
}
location = player.getEyeLocation().clone().add(player.getEyeLocation().getDirection().multiply(1));
Expand Down Expand Up @@ -86,7 +87,7 @@ private void advanceAttack() {
if (travelled >= range)
return;
location = location.add(location.getDirection().clone().multiply(1));
if (GeneralMethods.isRegionProtectedFromBuild(this, location)) {
if (RegionProtection.isRegionProtected(this, location)) {
travelled = range;
return;
}
Expand All @@ -99,7 +100,7 @@ private void advanceAttack() {
AirAbility.playAirbendingSound(location);

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !RegionProtection.isRegionProtected(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
DamageHandler.damageEntity(entity, damage, this);
GeneralMethods.setVelocity(this, entity, location.getDirection().multiply(knockback));
travelled = range;
Expand All @@ -120,7 +121,7 @@ public Location getLocation() {

@Override
public String getName() {
return "ElementSphere Air";
return "ElementSphereAir";
}

@Override
Expand Down
11 changes: 6 additions & 5 deletions src/com/jedk1/jedcore/ability/avatar/elementsphere/ESEarth.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.projectkorra.projectkorra.ability.ElementalAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;

Expand Down Expand Up @@ -54,7 +55,7 @@ public ESEarth(Player player) {
if (bPlayer.isOnCooldown("ESEarth")) {
return;
}
if (GeneralMethods.isRegionProtectedFromBuild(this, player.getTargetBlock(getTransparentMaterialSet(), 40).getLocation())) {
if (RegionProtection.isRegionProtected(this, player.getTargetBlock(getTransparentMaterialSet(), 40).getLocation())) {
return;
}
setFields();
Expand Down Expand Up @@ -86,15 +87,15 @@ public void progress() {
remove();
return;
}
if (GeneralMethods.isRegionProtectedFromBuild(this, tfb.getLocation())){
if (RegionProtection.isRegionProtected(this, tfb.getLocation())){
remove();
return;
}

EarthAbility.playEarthbendingSound(tfb.getLocation());

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(tfb.getLocation(), 2.5)) {
if (entity instanceof LivingEntity && !(entity instanceof ArmorStand) && entity.getEntityId() != player.getEntityId() && !GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
if (entity instanceof LivingEntity && !(entity instanceof ArmorStand) && entity.getEntityId() != player.getEntityId() && !RegionProtection.isRegionProtected(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
//explodeEarth(fb);
DamageHandler.damageEntity(entity, damage, this);
}
Expand All @@ -114,7 +115,7 @@ public static void explodeEarth(TempFallingBlock tempfallingblock) {
// TempBlock.revertBlock(l.getBlock(), Material.AIR);
// TempBlock.removeBlock(l.getBlock());
//}
if (isBreakable(l.getBlock()) && !GeneralMethods.isRegionProtectedFromBuild(player, "ElementSphere", l) && EarthAbility.isEarthbendable(player, l.getBlock())) {
if (isBreakable(l.getBlock()) && !RegionProtection.isRegionProtected(player, l, "ElementSphere") && EarthAbility.isEarthbendable(player, l.getBlock())) {
ParticleEffect.SMOKE_LARGE.display(l, 0, 0, 0, 0.1F, 2);
//new RegenTempBlock(l.getBlock(), Material.AIR, (byte) 0, (long) rand.nextInt((int) es.revertDelay - (int) (es.revertDelay - 1000)) + (es.revertDelay - 1000));
new RegenTempBlock(l.getBlock(), Material.AIR, Material.AIR.createBlockData(), (long) rand.nextInt((int) es.revertDelay - (int) (es.revertDelay - 1000)) + (es.revertDelay - 1000), false);
Expand Down Expand Up @@ -148,7 +149,7 @@ public Location getLocation() {

@Override
public String getName() {
return "ElementSphere Earth";
return "ElementSphereEarth";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;

Expand Down Expand Up @@ -55,7 +56,7 @@ public ESFire(Player player) {
if (bPlayer.isOnCooldown("ESFire")) {
return;
}
if (GeneralMethods.isRegionProtectedFromBuild(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
if (RegionProtection.isRegionProtected(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
return;
}
setFields();
Expand Down Expand Up @@ -112,7 +113,7 @@ private void advanceAttack() {
direction = GeneralMethods.getDirection(player.getLocation(), GeneralMethods.getTargetedLocation(player, range, Material.WATER)).normalize();

location = location.add(direction.clone().multiply(1));
if (GeneralMethods.isRegionProtectedFromBuild(this, location)) {
if (RegionProtection.isRegionProtected(this, location)) {
travelled = range;
return;
}
Expand All @@ -129,7 +130,7 @@ private void advanceAttack() {
placeFire();

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !RegionProtection.isRegionProtected(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
DamageHandler.damageEntity(entity, damage, this);
entity.setFireTicks(Math.round(burnTime / 50F));
travelled = range;
Expand Down Expand Up @@ -157,7 +158,7 @@ public Location getLocation() {

@Override
public String getName() {
return "ElementSphere Fire";
return "ElementSphereFire";
}

@Override
Expand Down
11 changes: 6 additions & 5 deletions src/com/jedk1/jedcore/ability/avatar/elementsphere/ESStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.projectkorra.projectkorra.ability.AvatarAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.ParticleEffect;

Expand Down Expand Up @@ -74,7 +75,7 @@ public ESStream(Player player) {
return;
}

if (GeneralMethods.isRegionProtectedFromBuild(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
if (RegionProtection.isRegionProtected(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
return;
}

Expand Down Expand Up @@ -123,7 +124,7 @@ public void progress() {
return;
}

if (GeneralMethods.isRegionProtectedFromBuild(player, "ElementSphere", stream)) {
if (RegionProtection.isRegionProtected(player, stream, this)) {
remove();
return;
}
Expand All @@ -149,15 +150,15 @@ public void progress() {
List<BlockState> blocks = new ArrayList<>();
for (Location loc : GeneralMethods.getCircle(stream, (int) radius, 0, false, true, 0)) {
if (JCMethods.isUnbreakable(loc.getBlock())) continue;
if (GeneralMethods.isRegionProtectedFromBuild(this, loc)) continue;
if (RegionProtection.isRegionProtected(this, loc)) continue;
blocks.add(loc.getBlock().getState());
new RegenTempBlock(loc.getBlock(), Material.AIR, Material.AIR.createBlockData(), regen, false);
}
for (Entity e : GeneralMethods.getEntitiesAroundPoint(stream, radius)) {
if (e instanceof Player && e == player) {
continue;
}
if (GeneralMethods.isRegionProtectedFromBuild(this, e.getLocation()) || ((e instanceof Player) && Commands.invincible.contains(((Player) e).getName()))){
if (RegionProtection.isRegionProtected(this, e.getLocation()) || ((e instanceof Player) && Commands.invincible.contains(((Player) e).getName()))){
continue;
}
GeneralMethods.setVelocity(this, e, dir.normalize().multiply(knockback));
Expand Down Expand Up @@ -240,7 +241,7 @@ public Location getLocation() {

@Override
public String getName() {
return "ElementSphere Stream";
return "ElementSphereStream";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.projectkorra.projectkorra.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.DamageHandler;

import org.bukkit.Location;
Expand Down Expand Up @@ -48,7 +49,7 @@ public ESWater(Player player) {
if (bPlayer.isOnCooldown("ESWater")) {
return;
}
if (GeneralMethods.isRegionProtectedFromBuild(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
if (RegionProtection.isRegionProtected(this, player.getTargetBlock(getTransparentMaterialSet(), (int) range).getLocation())) {
return;
}
setFields();
Expand Down Expand Up @@ -91,7 +92,7 @@ private void advanceAttack() {
if (!player.isDead())
direction = GeneralMethods.getDirection(player.getLocation(), GeneralMethods.getTargetedLocation(player, range, Material.WATER)).normalize();
location = location.add(direction.clone().multiply(1));
if(GeneralMethods.isRegionProtectedFromBuild(this, location)){
if(RegionProtection.isRegionProtected(this, location)){
travelled = range;
return;
}
Expand All @@ -104,7 +105,7 @@ private void advanceAttack() {
new RegenTempBlock(location.getBlock(), Material.WATER, Material.WATER.createBlockData(bd -> ((Levelled) bd).setLevel(0)), 100L);

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand) && !RegionProtection.isRegionProtected(this, entity.getLocation()) && !((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
DamageHandler.damageEntity(entity, damage, this);
travelled = range;
}
Expand All @@ -124,7 +125,7 @@ public Location getLocation() {

@Override
public String getName() {
return "ElementSphere Water";
return "ElementSphereWater";
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager;
import com.projectkorra.projectkorra.ability.util.MultiAbilityManager.MultiAbilityInfoSub;
import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.region.RegionProtection;
import com.projectkorra.projectkorra.util.ParticleEffect;

import org.bukkit.ChatColor;
Expand Down Expand Up @@ -178,7 +179,7 @@ public void progress() {
}

for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, 2.5)) {
if (!GeneralMethods.isRegionProtectedFromBuild(player, "ElementSphere", entity.getLocation())) {
if (!RegionProtection.isRegionProtected(player, entity.getLocation(), this)) {
if (entity instanceof LivingEntity && entity.getEntityId() != player.getEntityId() && !(entity instanceof ArmorStand)) {
entity.setVelocity(entity.getLocation().toVector().subtract(player.getLocation().toVector()).multiply(1));
}
Expand Down
Loading

0 comments on commit 2fe7528

Please sign in to comment.