Merge pull request #7 from PhanaticD/wip-1.13

some more fixes
This commit is contained in:
Simplicitee 2019-01-18 23:46:45 -05:00 committed by GitHub
commit 9fb35ecc60
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 62 additions and 46 deletions

View file

@ -560,7 +560,7 @@ public class PKListener implements Listener {
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onEntityTeleportEvent(final EntityTeleportEvent event) { public void onEntityTeleportEvent(final EntityTeleportEvent event) {
final Entity entity = event.getEntity(); final Entity entity = event.getEntity();
if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || MetalClips.isControlled((LivingEntity) entity)) { if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || (entity instanceof LivingEntity && MetalClips.isControlled((LivingEntity) entity))) {
event.setCancelled(true); event.setCancelled(true);
} }
@ -1415,9 +1415,18 @@ public class PKListener implements Listener {
} }
} }
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) @EventHandler(priority = EventPriority.NORMAL)
public void onPlayerSwing(final PlayerAnimationEvent event) { public void onPlayerSwing(final PlayerInteractEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
if (event.getHand() != EquipmentSlot.HAND) {
return;
}
if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_AIR) {
return;
}
if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.isCancelled()){
return;
}
final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) { if (bPlayer == null) {
return; return;
@ -1663,9 +1672,10 @@ public class PKListener implements Listener {
return; return;
} }
} }
if (ConfigManager.getConfig().getBoolean("Abilities.Fire.FireJet.ShowGliding")) {
if (CoreAbility.getAbility(player, FireJet.class) != null) { if (CoreAbility.getAbility(player, FireJet.class) != null) {
event.setCancelled(true); event.setCancelled(true);
}
} }
} }

View file

@ -817,7 +817,7 @@ public class ConfigManager {
config.addDefault("Abilities.Air.AirBurst.AngleTheta", 10); config.addDefault("Abilities.Air.AirBurst.AngleTheta", 10);
config.addDefault("Abilities.Air.AirScooter.Enabled", true); config.addDefault("Abilities.Air.AirScooter.Enabled", true);
config.addDefault("Abilities.Air.AirScooter.ShowSitting", true); config.addDefault("Abilities.Air.AirScooter.ShowSitting", false);
config.addDefault("Abilities.Air.AirScooter.Speed", 0.675); config.addDefault("Abilities.Air.AirScooter.Speed", 0.675);
config.addDefault("Abilities.Air.AirScooter.Interval", 100); config.addDefault("Abilities.Air.AirScooter.Interval", 100);
config.addDefault("Abilities.Air.AirScooter.Radius", 1); config.addDefault("Abilities.Air.AirScooter.Radius", 1);
@ -1363,6 +1363,7 @@ public class ConfigManager {
config.addDefault("Abilities.Fire.FireJet.Speed", 0.8); config.addDefault("Abilities.Fire.FireJet.Speed", 0.8);
config.addDefault("Abilities.Fire.FireJet.Duration", 2000); config.addDefault("Abilities.Fire.FireJet.Duration", 2000);
config.addDefault("Abilities.Fire.FireJet.Cooldown", 7000); config.addDefault("Abilities.Fire.FireJet.Cooldown", 7000);
config.addDefault("Abilities.Fire.FireJet.ShowGliding", false);
config.addDefault("Abilities.Fire.FireManipulation.Enabled", false); config.addDefault("Abilities.Fire.FireManipulation.Enabled", false);

View file

@ -292,11 +292,15 @@ public class EarthGrab extends EarthAbility {
if (!isEarth(entity.getLocation().clone().subtract(0, 1, 0).getBlock()) && (this.bPlayer.canSandbend() && !isSand(entity.getLocation().clone().subtract(0, 1, 0).getBlock())) && entity.getLocation().clone().subtract(0, 1, 0).getBlock().getType() != Material.FARMLAND) { if (!isEarth(entity.getLocation().clone().subtract(0, 1, 0).getBlock()) && (this.bPlayer.canSandbend() && !isSand(entity.getLocation().clone().subtract(0, 1, 0).getBlock())) && entity.getLocation().clone().subtract(0, 1, 0).getBlock().getType() != Material.FARMLAND) {
continue; continue;
} }
if (entity instanceof Trident) {
if (entity instanceof Arrow) { continue;
final Location l = entity.getLocation(); } else if (entity instanceof Arrow) {
entity.remove(); Arrow arrow = (Arrow) entity;
entity = l.getWorld().dropItem(l, new ItemStack(Material.ARROW, 1)); if (arrow.getPickupStatus() == Arrow.PickupStatus.ALLOWED) {
final Location l = entity.getLocation();
entity.remove();
entity = l.getWorld().dropItem(l, new ItemStack(Material.ARROW, 1));
}
} else if (!(entity instanceof Item)) { } else if (!(entity instanceof Item)) {
continue; continue;
} }

View file

@ -1,14 +1,5 @@
package com.projectkorra.projectkorra.earthbending.passive; package com.projectkorra.projectkorra.earthbending.passive;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility; import com.projectkorra.projectkorra.ability.EarthAbility;
@ -18,6 +9,14 @@ import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.configuration.ConfigManager;
import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.util.TempBlock.RevertTask; import com.projectkorra.projectkorra.util.TempBlock.RevertTask;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.Set;
public class DensityShift extends EarthAbility implements PassiveAbility { public class DensityShift extends EarthAbility implements PassiveAbility {
private static final Set<TempBlock> SAND_BLOCKS = new HashSet<>(); private static final Set<TempBlock> SAND_BLOCKS = new HashSet<>();
@ -87,8 +86,10 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
public static void revertAllSand() { public static void revertAllSand() {
for (final TempBlock block : SAND_BLOCKS) { for (final TempBlock block : SAND_BLOCKS) {
block.setRevertTask(null);
block.revertBlock(); block.revertBlock();
} }
SAND_BLOCKS.clear();
} }
public static void removeAll() { public static void removeAll() {

View file

@ -28,6 +28,7 @@ public class FireJet extends FireAbility {
private double speed; private double speed;
private Random random; private Random random;
private Boolean previousGlidingState; private Boolean previousGlidingState;
private Boolean showGliding;
public FireJet(final Player player) { public FireJet(final Player player) {
super(player); super(player);
@ -49,6 +50,7 @@ public class FireJet extends FireAbility {
this.duration = getConfig().getLong("Abilities.Fire.FireJet.Duration"); this.duration = getConfig().getLong("Abilities.Fire.FireJet.Duration");
this.speed = getConfig().getDouble("Abilities.Fire.FireJet.Speed"); this.speed = getConfig().getDouble("Abilities.Fire.FireJet.Speed");
this.cooldown = getConfig().getLong("Abilities.Fire.FireJet.Cooldown"); this.cooldown = getConfig().getLong("Abilities.Fire.FireJet.Cooldown");
this.showGliding = getConfig().getBoolean("Abilities.Fire.FireJet.ShowGliding");
this.random = new Random(); this.random = new Random();
this.speed = this.getDayFactor(this.speed); this.speed = this.getDayFactor(this.speed);
@ -80,8 +82,10 @@ public class FireJet extends FireAbility {
this.time = System.currentTimeMillis(); this.time = System.currentTimeMillis();
this.start(); this.start();
previousGlidingState = player.isGliding(); if (showGliding) {
player.setGliding(true); previousGlidingState = player.isGliding();
player.setGliding(true);
}
this.bPlayer.addCooldown(this); this.bPlayer.addCooldown(this);
} }
} }
@ -118,7 +122,9 @@ public class FireJet extends FireAbility {
@Override @Override
public void remove() { public void remove() {
super.remove(); super.remove();
this.player.setGliding(previousGlidingState); if (showGliding) {
this.player.setGliding(previousGlidingState);
}
flightHandler.removeInstance(this.player, this.getName()); flightHandler.removeInstance(this.player, this.getName());
this.player.setFallDistance(0); this.player.setFallDistance(0);
} }

View file

@ -1,26 +1,5 @@
package com.projectkorra.projectkorra.firebending; package com.projectkorra.projectkorra.firebending;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ProjectKorra;
@ -36,6 +15,18 @@ import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.projectkorra.waterbending.combo.IceWave; import com.projectkorra.projectkorra.waterbending.combo.IceWave;
import com.projectkorra.projectkorra.waterbending.ice.PhaseChange; import com.projectkorra.projectkorra.waterbending.ice.PhaseChange;
import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear; import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import java.util.*;
public class HeatControl extends FireAbility { public class HeatControl extends FireAbility {
@ -43,7 +34,7 @@ public class HeatControl extends FireAbility {
COOK, EXTINGUISH, MELT, SOLIDIFY COOK, EXTINGUISH, MELT, SOLIDIFY
} }
private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON }; private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON, Material.KELP };
private HeatControlType heatControlType; private HeatControlType heatControlType;
@ -270,6 +261,9 @@ public class HeatControl extends FireAbility {
case SALMON: case SALMON:
cooked = new ItemStack(Material.COOKED_SALMON); cooked = new ItemStack(Material.COOKED_SALMON);
break; break;
case KELP:
cooked = new ItemStack(Material.DRIED_KELP);
break;
default: default:
break; break;
} }