Fix Illumination, Tremorsense, and who (#1070)

## Fixes
* Fixes Illumination torch duplication when breaking the block below the Illumination
* Fixes Tremorsense activating on slabs
* Fixes WhoCommand not displaying Blue Fire as a perk if the user has it
This commit is contained in:
Vahagn Tovmasian 2020-07-19 21:28:17 -07:00 committed by GitHub
parent 8d7f116c49
commit fa9f454978
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 3 deletions

View file

@ -17,7 +17,6 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -232,6 +231,15 @@ public class PKListener implements Listener {
final String abil = bPlayer.getBoundAbilityName(); final String abil = bPlayer.getBoundAbilityName();
CoreAbility ability = null; CoreAbility ability = null;
if (Illumination.isIlluminationTorch(block.getRelative(BlockFace.UP))) {
TempBlock torch = TempBlock.get(block.getRelative(BlockFace.UP));
Player user = Illumination.getBlocks().get(torch);
Illumination illumination = CoreAbility.getAbility(user, Illumination.class);
if (illumination != null) {
illumination.remove();
}
}
if (bPlayer.isElementToggled(Element.WATER) && bPlayer.isToggled()) { if (bPlayer.isElementToggled(Element.WATER) && bPlayer.isToggled()) {
if (abil != null && abil.equalsIgnoreCase("Surge")) { if (abil != null && abil.equalsIgnoreCase("Surge")) {
ability = CoreAbility.getAbility(SurgeWall.class); ability = CoreAbility.getAbility(SurgeWall.class);
@ -398,7 +406,7 @@ public class PKListener implements Listener {
} }
try (MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) { try (MCTiming timing = TimingPhysicsIlluminationTorchCheck.startTiming()) {
if (Illumination.isIlluminationTorch(block)) { if (Illumination.isIlluminationTorch(block) || Illumination.isIlluminationTorch(block.getRelative(BlockFace.UP))) {
event.setCancelled(true); event.setCancelled(true);
return; return;
} }

View file

@ -281,6 +281,9 @@ public class WhoCommand extends PKCommand {
if (bPlayer.canLightningbend()) { if (bPlayer.canLightningbend()) {
sender.sendMessage(Element.LIGHTNING.getColor() + " Can Lightningbend"); sender.sendMessage(Element.LIGHTNING.getColor() + " Can Lightningbend");
} }
if (bPlayer.hasSubElement(Element.BLUE_FIRE)) {
sender.sendMessage(Element.BLUE_FIRE.getColor() + " Can use Blue Fire");
}
for (final SubElement se : Element.getAddonSubElements(Element.FIRE)) { for (final SubElement se : Element.getAddonSubElements(Element.FIRE)) {
if (bPlayer.canUseSubElement(se)) { if (bPlayer.canUseSubElement(se)) {
sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend()); sender.sendMessage(se.getColor() + " Can " + (!se.getType().equals(ElementType.NO_SUFFIX) ? "" : "use ") + se.getName() + se.getType().getBend());

View file

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.data.type.Slab;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.BendingPlayer;
@ -101,6 +102,10 @@ public class Tremorsense extends EarthAbility {
final boolean isBendable = this.isEarthbendable(standBlock); final boolean isBendable = this.isEarthbendable(standBlock);
if (standBlock.getBlockData() instanceof Slab) {
return;
}
if (isBendable && this.block == null) { if (isBendable && this.block == null) {
this.block = standBlock; this.block = standBlock;
this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE, (byte) 1); this.player.sendBlockChange(this.block.getLocation(), Material.GLOWSTONE, (byte) 1);

View file

@ -197,7 +197,7 @@ public class Illumination extends FireAbility {
public static boolean isIlluminationTorch(final Block block) { public static boolean isIlluminationTorch(final Block block) {
final TempBlock tempBlock = TempBlock.get(block); final TempBlock tempBlock = TempBlock.get(block);
if (tempBlock == null || block.getType() != Material.TORCH || !BLOCKS.containsKey(tempBlock)) { if (tempBlock == null || (block.getType() != Material.TORCH && block.getType() != Material.SOUL_TORCH) || !BLOCKS.containsKey(tempBlock)) {
return false; return false;
} }