mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fine Tuning (#1075)
## Fixes * Fixes #1079 - Netherite weapons not being counted as weapons * Fixes #1034 - Abilities working through walls * Fixes #1057 - Bad wording for toggle command. * Fixes #1080 - IceSpike not working with a bottle source * Fixes #1086 - Torrent not working with a bottle source * Fix Illumination displacing water
This commit is contained in:
parent
0367c92279
commit
f39c7f7186
11 changed files with 124 additions and 93 deletions
|
@ -1797,7 +1797,45 @@ public class GeneralMethods {
|
|||
}
|
||||
|
||||
public static boolean isWeapon(final Material mat) {
|
||||
return mat != null && (mat == Material.WOODEN_AXE || mat == Material.WOODEN_PICKAXE || mat == Material.WOODEN_SHOVEL || mat == Material.WOODEN_SWORD || mat == Material.STONE_AXE || mat == Material.STONE_PICKAXE || mat == Material.STONE_SHOVEL || mat == Material.STONE_SWORD || mat == Material.IRON_AXE || mat == Material.IRON_PICKAXE || mat == Material.IRON_SWORD || mat == Material.IRON_SHOVEL || mat == Material.DIAMOND_AXE || mat == Material.DIAMOND_PICKAXE || mat == Material.DIAMOND_SWORD || mat == Material.DIAMOND_SHOVEL || mat == Material.GOLDEN_AXE || mat == Material.GOLDEN_HOE || mat == Material.GOLDEN_SWORD || mat == Material.GOLDEN_PICKAXE || mat == Material.GOLDEN_SHOVEL || mat == Material.TRIDENT);
|
||||
|
||||
switch(mat) {
|
||||
case BOW:
|
||||
case CROSSBOW:
|
||||
case DIAMOND_AXE:
|
||||
case DIAMOND_HOE:
|
||||
case DIAMOND_PICKAXE:
|
||||
case DIAMOND_SHOVEL:
|
||||
case DIAMOND_SWORD:
|
||||
case GOLDEN_AXE:
|
||||
case GOLDEN_HOE:
|
||||
case GOLDEN_PICKAXE:
|
||||
case GOLDEN_SHOVEL:
|
||||
case GOLDEN_SWORD:
|
||||
case IRON_AXE:
|
||||
case IRON_HOE:
|
||||
case IRON_PICKAXE:
|
||||
case IRON_SHOVEL:
|
||||
case IRON_SWORD:
|
||||
case NETHERITE_AXE:
|
||||
case NETHERITE_HOE:
|
||||
case NETHERITE_PICKAXE:
|
||||
case NETHERITE_SHOVEL:
|
||||
case NETHERITE_SWORD:
|
||||
case STONE_AXE:
|
||||
case STONE_HOE:
|
||||
case STONE_PICKAXE:
|
||||
case STONE_SHOVEL:
|
||||
case STONE_SWORD:
|
||||
case TRIDENT:
|
||||
case WOODEN_AXE:
|
||||
case WOODEN_HOE:
|
||||
case WOODEN_PICKAXE:
|
||||
case WOODEN_SHOVEL:
|
||||
case WOODEN_SWORD:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void loadBendingPlayer(final BendingPlayer pl) {
|
||||
|
|
|
@ -276,7 +276,7 @@ public abstract class WaterAbility extends ElementalAbility {
|
|||
|
||||
public static boolean isWaterbendable(final Player player, final String abilityName, final Block block) {
|
||||
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if (bPlayer == null || !isWaterbendable(block.getType()) || GeneralMethods.isRegionProtectedFromBuild(player, abilityName, block.getLocation())) {
|
||||
if (bPlayer == null || !isWaterbendable(block.getType())) {
|
||||
return false;
|
||||
}
|
||||
if (TempBlock.isTempBlock(block) && !isBendableWaterTempBlock(block)) {
|
||||
|
|
|
@ -253,7 +253,7 @@ public class AirSuction extends AirAbility {
|
|||
} else if (!bPlayer.canBendIgnoreCooldowns(this)) {
|
||||
remove();
|
||||
return;
|
||||
} else if (origin.distanceSquared(player.getEyeLocation()) > getSelectRange() * getSelectRange()) {
|
||||
} else if (origin.distanceSquared(player.getLocation()) > this.range * this.range) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -146,65 +146,75 @@ public class AirSwipe extends AirAbility {
|
|||
for (final Vector direction : this.streams.keySet()) {
|
||||
Location location = this.streams.get(direction);
|
||||
if (direction != null && location != null) {
|
||||
|
||||
|
||||
BlockIterator blocks = new BlockIterator(this.getLocation().getWorld(), location.toVector(), direction, 0, (int) Math.ceil(direction.clone().multiply(speed).length()));
|
||||
|
||||
while (blocks.hasNext()) {
|
||||
if(!blocks.next().isPassable()) {
|
||||
if(!checkLocation(blocks.next(), direction)) {
|
||||
this.streams.remove(direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.streams.containsKey(direction)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
location = location.clone().add(direction.clone().multiply(this.speed));
|
||||
this.streams.put(direction, location);
|
||||
|
||||
if (location.distanceSquared(this.origin) > this.range * this.range || GeneralMethods.isRegionProtectedFromBuild(this, location)) {
|
||||
this.streams.clear();
|
||||
} else {
|
||||
final Block block = location.getBlock();
|
||||
if (!ElementalAbility.isTransparent(this.player, block) || !block.isPassable()) {
|
||||
this.streams.remove(direction);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) {
|
||||
if (FireAbility.isFire(testblock.getType())) {
|
||||
testblock.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAir(block.getType())) {
|
||||
if (block.getType().equals(Material.SNOW)) {
|
||||
continue;
|
||||
} else if (isPlant(block.getType())) {
|
||||
block.breakNaturally();
|
||||
} else {
|
||||
this.streams.remove(direction);
|
||||
}
|
||||
if (isLava(block)) {
|
||||
if (LavaFlow.isLavaFlowBlock(block)) {
|
||||
LavaFlow.removeBlock(block); // TODO: Make more generic for future lava generating moves.
|
||||
} else if (block.getBlockData() instanceof Levelled && ((Levelled) block.getBlockData()).getLevel() == 0) {
|
||||
new TempBlock(block, Material.OBSIDIAN);
|
||||
} else {
|
||||
new TempBlock(block, Material.COBBLESTONE);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
playAirbendingParticles(location, this.particles, 0.2F, 0.2F, 0);
|
||||
if (this.random.nextInt(4) == 0) {
|
||||
playAirbendingSound(location);
|
||||
}
|
||||
this.affectPeople(location, direction);
|
||||
}
|
||||
playAirbendingParticles(location, this.particles, 0.2F, 0.2F, 0);
|
||||
if (this.random.nextInt(4) == 0) {
|
||||
playAirbendingSound(location);
|
||||
}
|
||||
this.affectPeople(location, direction);
|
||||
}
|
||||
}
|
||||
if (this.streams.isEmpty()) {
|
||||
this.remove();
|
||||
}
|
||||
}
|
||||
public boolean checkLocation(Block block, Vector direction) {
|
||||
if (GeneralMethods.checkDiagonalWall(block.getLocation(), direction) || !block.isPassable()) {
|
||||
return false;
|
||||
} else {
|
||||
if (block.getLocation().distanceSquared(this.origin) > this.range * this.range || GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
|
||||
this.streams.clear();
|
||||
} else {
|
||||
if (!ElementalAbility.isTransparent(this.player, block) || !block.isPassable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), this.radius)) {
|
||||
if (FireAbility.isFire(testblock.getType())) {
|
||||
testblock.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isAir(block.getType())) {
|
||||
if (block.getType().equals(Material.SNOW)) {
|
||||
return true;
|
||||
} else if (isPlant(block.getType())) {
|
||||
block.breakNaturally();
|
||||
return false;
|
||||
} else if (isLava(block)) {
|
||||
if (LavaFlow.isLavaFlowBlock(block)) {
|
||||
LavaFlow.removeBlock(block);
|
||||
return false;// TODO: Make more generic for future lava generating moves.
|
||||
} else if (block.getBlockData() instanceof Levelled && ((Levelled) block.getBlockData()).getLevel() == 0) {
|
||||
new TempBlock(block, Material.OBSIDIAN);
|
||||
return false;
|
||||
} else {
|
||||
new TempBlock(block, Material.COBBLESTONE);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private void affectPeople(final Location location, final Vector direction) {
|
||||
final List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, this.radius);
|
||||
final Vector fDirection = direction.clone();
|
||||
|
@ -244,7 +254,6 @@ public class AirSwipe extends AirAbility {
|
|||
AirSwipe.this.affectedEntities.add(entity);
|
||||
}
|
||||
breakBreathbendingHold(entity);
|
||||
AirSwipe.this.streams.remove(direction);
|
||||
} else if (entity.getEntityId() != AirSwipe.this.player.getEntityId() && !(entity instanceof LivingEntity)) {
|
||||
|
||||
GeneralMethods.setVelocity(entity, fDirection.multiply(AirSwipe.this.pushFactor));
|
||||
|
|
|
@ -116,7 +116,7 @@ public class Suffocate extends AirAbility {
|
|||
List<Entity> entities = new ArrayList<Entity>();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
final Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterials());
|
||||
entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
|
||||
entities = GeneralMethods.getEntitiesAroundPoint(location, .5);
|
||||
if (entities.contains(player)) {
|
||||
entities.remove(player);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ToggleCommand extends PKCommand {
|
|||
private final String toggledOffForAll, toggleOffSelf, toggleOnSelf, toggleOffAll, toggleOnAll, toggledOffSingleElement, toggledOnSingleElement, wrongElementOther, toggledOnOtherElementConfirm, toggledOffOtherElementConfirm, toggledOnOtherElement, toggledOffOtherElement, wrongElement, notFound;
|
||||
|
||||
public ToggleCommand() {
|
||||
super("toggle", "/bending toggle <All/Element/Player> [Player]", ConfigManager.languageConfig.get().getString("Commands.Toggle.Description"), new String[] { "toggle", "t" });
|
||||
super("toggle", "/bending toggle <All/Element> [Player]", ConfigManager.languageConfig.get().getString("Commands.Toggle.Description"), new String[] { "toggle", "t" });
|
||||
|
||||
final FileConfiguration c = ConfigManager.languageConfig.get();
|
||||
|
||||
|
|
|
@ -685,7 +685,7 @@ public class ConfigManager {
|
|||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage", 4.5);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Push", 1.0);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Range", 24);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Radius", 0.75);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Radius", 0.25);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.ChargeTime", 1000);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.Damage", 3);
|
||||
config.addDefault("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle", true);
|
||||
|
|
|
@ -159,7 +159,6 @@ public class FireBlast extends FireAbility {
|
|||
while (blocks.hasNext() && checkLocation(blocks.next()));
|
||||
|
||||
this.location.add(this.direction.clone().multiply(speedFactor));
|
||||
this.location = this.location.add(this.direction.clone().multiply(this.speedFactor));
|
||||
|
||||
if (this.random.nextInt(4) == 0) {
|
||||
playFirebendingSound(this.location);
|
||||
|
@ -167,11 +166,34 @@ public class FireBlast extends FireAbility {
|
|||
}
|
||||
|
||||
public boolean checkLocation(Block block) {
|
||||
if (GeneralMethods.checkDiagonalWall(block.getLocation(), this.direction) || !block.isPassable()) {
|
||||
if (!block.isPassable()) {
|
||||
if (block.getType() == Material.FURNACE && this.powerFurnace) {
|
||||
final Furnace furnace = (Furnace) block.getState();
|
||||
furnace.setBurnTime((short) 800);
|
||||
furnace.update();
|
||||
} else if (block.getType() == Material.SMOKER && this.powerFurnace) {
|
||||
final Smoker smoker = (Smoker) block.getState();
|
||||
smoker.setBurnTime((short) 800);
|
||||
smoker.update();
|
||||
} else if (block.getType() == Material.BLAST_FURNACE && this.powerFurnace) {
|
||||
final BlastFurnace blastF = (BlastFurnace) block.getState();
|
||||
blastF.setBurnTime((short) 800);
|
||||
blastF.update();
|
||||
} else if (block instanceof Campfire) {
|
||||
final Campfire campfire = (Campfire) block.getBlockData();
|
||||
if(!campfire.isLit()) {
|
||||
if(block.getType() != Material.SOUL_CAMPFIRE || bPlayer.canUseSubElement(SubElement.BLUE_FIRE)) {
|
||||
campfire.setLit(true);
|
||||
}
|
||||
}
|
||||
} else if (isIgnitable(block.getRelative(BlockFace.UP))) {
|
||||
if ((this.isFireBurst && this.fireBurstIgnite) || !this.isFireBurst) {
|
||||
this.ignite(this.location);
|
||||
}
|
||||
}
|
||||
this.remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private void affect(final Entity entity) {
|
||||
|
@ -219,36 +241,6 @@ public class FireBlast extends FireAbility {
|
|||
return;
|
||||
}
|
||||
|
||||
final Block block = this.location.getBlock();
|
||||
if (GeneralMethods.isSolid(block) || block.isLiquid()) {
|
||||
if (block.getType() == Material.FURNACE && this.powerFurnace) {
|
||||
final Furnace furnace = (Furnace) block.getState();
|
||||
furnace.setBurnTime((short) 800);
|
||||
furnace.update();
|
||||
} else if (block.getType() == Material.SMOKER && this.powerFurnace) {
|
||||
final Smoker smoker = (Smoker) block.getState();
|
||||
smoker.setBurnTime((short) 800);
|
||||
smoker.update();
|
||||
} else if (block.getType() == Material.BLAST_FURNACE && this.powerFurnace) {
|
||||
final BlastFurnace blastF = (BlastFurnace) block.getState();
|
||||
blastF.setBurnTime((short) 800);
|
||||
blastF.update();
|
||||
} else if (block instanceof Campfire) {
|
||||
final Campfire campfire = (Campfire) block.getBlockData();
|
||||
if(!campfire.isLit()) {
|
||||
if(block.getType() != Material.SOUL_CAMPFIRE || bPlayer.canUseSubElement(SubElement.BLUE_FIRE)) {
|
||||
campfire.setLit(true);
|
||||
}
|
||||
}
|
||||
} else if (isIgnitable(block.getRelative(BlockFace.UP))) {
|
||||
if ((this.isFireBurst && this.fireBurstIgnite) || !this.isFireBurst) {
|
||||
this.ignite(this.location);
|
||||
}
|
||||
}
|
||||
this.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.location.distanceSquared(this.origin) > this.range * this.range) {
|
||||
this.remove();
|
||||
return;
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.bukkit.entity.Player;
|
|||
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.Element.SubElement;
|
||||
import com.projectkorra.projectkorra.GeneralMethods;
|
||||
import com.projectkorra.projectkorra.ability.FireAbility;
|
||||
import com.projectkorra.projectkorra.attribute.Attribute;
|
||||
import com.projectkorra.projectkorra.util.TempBlock;
|
||||
|
@ -112,8 +111,7 @@ public class Illumination extends FireAbility {
|
|||
private void set() {
|
||||
final Block standingBlock = this.player.getLocation().getBlock();
|
||||
final Block standBlock = standingBlock.getRelative(BlockFace.DOWN);
|
||||
|
||||
if (!GeneralMethods.isSolid(standBlock)) {
|
||||
if (!isIgnitable(standingBlock)) {
|
||||
return;
|
||||
} else if (this.block != null && standingBlock.equals(this.block.getBlock())) {
|
||||
return;
|
||||
|
|
|
@ -171,10 +171,7 @@ public class Torrent extends WaterAbility {
|
|||
if (!this.bPlayer.canBendIgnoreCooldowns(this)) {
|
||||
this.remove();
|
||||
return;
|
||||
} else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.formed && !this.launching) {
|
||||
this.remove();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (System.currentTimeMillis() > this.time + this.interval) {
|
||||
this.time = System.currentTimeMillis();
|
||||
|
|
|
@ -157,11 +157,8 @@ public class IceSpikeBlast extends IceAbility {
|
|||
} else if (!this.bPlayer.getBoundAbilityName().equals(this.getName()) && this.prepared) {
|
||||
this.remove();
|
||||
return;
|
||||
} else if (!isWaterbendable(this.sourceBlock) && !this.progressing && !this.settingUp) {
|
||||
this.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (System.currentTimeMillis() < this.time + this.interval) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue