From 7c424ce538ecdef7088eda62bcd4f2a024ebe69d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 21 Dec 2020 21:34:58 +0000 Subject: [PATCH 1/9] Update dependency com.konghq:unirest-java to v3.11.07 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3811bef9..a29555c6e 100644 --- a/pom.xml +++ b/pom.xml @@ -348,7 +348,7 @@ com.konghq unirest-java - 3.11.06 + 3.11.07 compile From cb6efba88860f0728a6d7846a8dd0aa84ed4323e Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Tue, 22 Dec 2020 18:21:49 +0100 Subject: [PATCH 2/9] [CI skip] Updated issues template --- .github/ISSUE_TEMPLATE/bug-report.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index dfb5a3ad2..2948bee8b 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -19,7 +19,9 @@ assignees: '' - +1. +2. +3. ## :bulb: Expected behavior (REQUIRED) @@ -34,7 +36,7 @@ assignees: '' ## :open_file_folder: /error-reports/ Folder - + @@ -46,7 +48,7 @@ assignees: '' - - Server Software (Spigot/Paper): - - Minecraft Version: - - Slimefun Version: - - CS-CoreLib Version: + - Server Software: + - Minecraft Version: + - Slimefun Version: + - CS-CoreLib Version: From a1384360b637f83af5117e84da225bfa404029d3 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 22 Dec 2020 19:18:33 +0000 Subject: [PATCH 3/9] Update dependency com.konghq:unirest-java to v3.11.08 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a29555c6e..9b741cc3c 100644 --- a/pom.xml +++ b/pom.xml @@ -348,7 +348,7 @@ com.konghq unirest-java - 3.11.07 + 3.11.08 compile From 2872cf8a2e832267f6a7f1deed1c580940af790b Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Wed, 23 Dec 2020 14:17:35 +0000 Subject: [PATCH 4/9] Fixed #2647 --- .../slimefun4/implementation/items/armor/StomperBoots.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java index 8438d7950..1b934badb 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java @@ -47,7 +47,12 @@ public class StomperBoots extends SlimefunItem { p.setVelocity(new Vector(0, 0.7, 0)); for (Entity n : p.getNearbyEntities(4, 4, 4)) { - if (n instanceof LivingEntity && n.isValid() && !n.getUniqueId().equals(p.getUniqueId())) { + if (n instanceof LivingEntity + && n.isValid() + && !n.getUniqueId().equals(p.getUniqueId()) + && ((LivingEntity) n).isCollidable() + && n.hasGravity() + ) { Vector velocity = getShockwave(p.getLocation(), n.getLocation()); n.setVelocity(velocity); From 00c233dee59d1160e60513bea50439502eeb7818 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Wed, 23 Dec 2020 14:32:47 +0000 Subject: [PATCH 5/9] Move to a method --- .../items/armor/StomperBoots.java | 57 ++++++++++++------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java index 1b934badb..7266bd8e6 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java @@ -1,5 +1,7 @@ package io.github.thebusybiscuit.slimefun4.implementation.items.armor; +import javax.annotation.Nonnull; + import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; @@ -25,7 +27,7 @@ import me.mrCookieSlime.Slimefun.api.SlimefunItemStack; /** * The Boots of the Stomper are boots which damage nearby enemies whenever the {@link Player} * takes fall damage. - * + * * @author TheBusyBiscuit * */ @@ -37,54 +39,49 @@ public class StomperBoots extends SlimefunItem { /** * This will apply the "stomp" effect to the given {@link EntityDamageEvent}. - * + * * @param fallDamageEvent * The {@link EntityDamageEvent} in which the {@link Player} has taken fall damage */ public void stomp(EntityDamageEvent fallDamageEvent) { - Player p = (Player) fallDamageEvent.getEntity(); - p.getWorld().playSound(p.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 2F); - p.setVelocity(new Vector(0, 0.7, 0)); + Player player = (Player) fallDamageEvent.getEntity(); + player.getWorld().playSound(player.getLocation(), Sound.ENTITY_ZOMBIE_BREAK_WOODEN_DOOR, 1F, 2F); + player.setVelocity(new Vector(0, 0.7, 0)); - for (Entity n : p.getNearbyEntities(4, 4, 4)) { - if (n instanceof LivingEntity - && n.isValid() - && !n.getUniqueId().equals(p.getUniqueId()) - && ((LivingEntity) n).isCollidable() - && n.hasGravity() - ) { - Vector velocity = getShockwave(p.getLocation(), n.getLocation()); - n.setVelocity(velocity); + for (Entity entity : player.getNearbyEntities(4, 4, 4)) { + if (entity instanceof LivingEntity && canMoveEntity((LivingEntity) entity, player)) { + Vector velocity = getShockwave(player.getLocation(), entity.getLocation()); + entity.setVelocity(velocity); // Check if it's not a Player or if PvP is enabled - if (!(n instanceof Player) || (p.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(p, n.getLocation(), ProtectableAction.ATTACK_PLAYER))) { - EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(p, n, DamageCause.ENTITY_ATTACK, fallDamageEvent.getDamage() / 2); + if (!(entity instanceof Player) || (player.getWorld().getPVP() && SlimefunPlugin.getProtectionManager().hasPermission(player, entity.getLocation(), ProtectableAction.ATTACK_PLAYER))) { + EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(player, entity, DamageCause.ENTITY_ATTACK, fallDamageEvent.getDamage() / 2); Bukkit.getPluginManager().callEvent(event); if (!event.isCancelled()) { - ((LivingEntity) n).damage(event.getDamage()); + ((LivingEntity) entity).damage(event.getDamage()); } } } } for (BlockFace face : BlockFace.values()) { - Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); - p.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); + Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); + player.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); } } /** * This gives us the "shockwave" {@link Vector} for a given target. - * + * * @param origin * The {@link Location} of our {@link Player} * @param target * The {@link Location} of the {@link Entity} we are pushing away - * + * * @return A {@link Vector} to determine the velocity for our {@link Entity} */ - private Vector getShockwave(Location origin, Location target) { + private Vector getShockwave(@Nonnull Location origin, @Nonnull Location target) { // As the distance approaches zero we might slip into a "division by zero" when normalizing if (origin.distanceSquared(target) < 0.05) { return new Vector(0, 1, 0); @@ -94,4 +91,20 @@ public class StomperBoots extends SlimefunItem { } } + /** + * Checks if the stomper boots can move an entity and is not the player who is using the boots. + *
For developers: If you're spawning an immovable NPC, you should be denying + * collision with {@code LivingEntity#setCollidable(false)} or + * gravity with {@code LivingEntity#setGravity(false)}. + * + * @param entity + * The {@link LivingEntity} to check. + * @param player + * The {@link Player} using the {@link StomperBoots}. + * @return If the entity can move. + */ + private boolean canMoveEntity(@Nonnull LivingEntity entity, @Nonnull Player player) { + return entity.isValid() && !entity.getUniqueId().equals(player.getUniqueId()) + && entity.isCollidable() && entity.hasGravity(); + } } From 6cf2051e604499c78e8f40c0be1bea463f8b4331 Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Wed, 23 Dec 2020 14:56:51 +0000 Subject: [PATCH 6/9] Panda smells --- .../slimefun4/implementation/items/armor/StomperBoots.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java index 7266bd8e6..47637a8da 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java @@ -66,8 +66,8 @@ public class StomperBoots extends SlimefunItem { } for (BlockFace face : BlockFace.values()) { - Block b = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); - player.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType()); + Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getRelative(face); + player.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType()); } } From 9c31c746dd61da13303ad08fc41559fa22a4cebe Mon Sep 17 00:00:00 2001 From: Daniel Walsh Date: Wed, 23 Dec 2020 22:16:45 +0000 Subject: [PATCH 7/9] Requested changes --- .../implementation/items/armor/StomperBoots.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java index 47637a8da..da217cf57 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/armor/StomperBoots.java @@ -49,7 +49,7 @@ public class StomperBoots extends SlimefunItem { player.setVelocity(new Vector(0, 0.7, 0)); for (Entity entity : player.getNearbyEntities(4, 4, 4)) { - if (entity instanceof LivingEntity && canMoveEntity((LivingEntity) entity, player)) { + if (entity instanceof LivingEntity && canPush(player, (LivingEntity) entity)) { Vector velocity = getShockwave(player.getLocation(), entity.getLocation()); entity.setVelocity(velocity); @@ -93,9 +93,10 @@ public class StomperBoots extends SlimefunItem { /** * Checks if the stomper boots can move an entity and is not the player who is using the boots. - *
For developers: If you're spawning an immovable NPC, you should be denying - * collision with {@code LivingEntity#setCollidable(false)} or - * gravity with {@code LivingEntity#setGravity(false)}. + *

+ * For developers: If you're spawning an immovable NPC, you should be denying + * collision with {@link LivingEntity#setCollidable(boolean)} or + * gravity with {@link LivingEntity#setGravity(boolean)}. * * @param entity * The {@link LivingEntity} to check. @@ -103,7 +104,7 @@ public class StomperBoots extends SlimefunItem { * The {@link Player} using the {@link StomperBoots}. * @return If the entity can move. */ - private boolean canMoveEntity(@Nonnull LivingEntity entity, @Nonnull Player player) { + protected boolean canPush(@Nonnull Player player, @Nonnull LivingEntity entity) { return entity.isValid() && !entity.getUniqueId().equals(player.getUniqueId()) && entity.isCollidable() && entity.hasGravity(); } From a0bd1a6056e98ede9a248c8ae1a9e6117daa667d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 24 Dec 2020 00:29:40 +0000 Subject: [PATCH 8/9] Update dependency com.konghq:unirest-java to v3.11.09 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9b741cc3c..93ce3821e 100644 --- a/pom.xml +++ b/pom.xml @@ -348,7 +348,7 @@ com.konghq unirest-java - 3.11.08 + 3.11.09 compile From 43af06f8883fad2a92c088a0f035111ba9a08437 Mon Sep 17 00:00:00 2001 From: TheBusyBiscuit Date: Thu, 24 Dec 2020 02:27:41 +0100 Subject: [PATCH 9/9] [CI skip] Updated changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f2d0d4418..60212f5b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ * Fixed #2575 * Fixed ghost blocks to some extent (ghost blocks will now drop and be replaced) * Fixed #2636 (hotfix) +* Fixed #2647 ## Release Candidate 18 (03 Dec 2020)