Skip to content

Commit

Permalink
Merge pull request #2477 from BentoBoxWorld/develop
Browse files Browse the repository at this point in the history
Release 2.5.1
  • Loading branch information
tastybento authored Aug 21, 2024
2 parents 3ee840f + 6cbbdad commit 5424cb9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<!-- Do not change unless you want different name for local builds. -->
<build.number>-LOCAL</build.number>
<!-- This allows to change between versions. -->
<build.version>2.5.0</build.version>
<build.version>2.5.1</build.version>
<sonar.organization>bentobox-world</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
<server.jars>${project.basedir}/lib</server.jars>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ public Location getProtectionCenter() {
* @since 1.16.0
*/
public void setProtectionCenter(Location location) throws IOException {
if (this.location.equals(location)) {
if (this.getProtectionCenter().equals(location)) {
return; // nothing to do
}
if (!this.inIslandSpace(location)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ private void checkClickedBlock(Event e, Player player, Block block)
case DRAGON_EGG -> this.checkIsland(e, player, loc, Flags.DRAGON_EGG);
case END_PORTAL_FRAME, RESPAWN_ANCHOR -> this.checkIsland(e, player, loc, Flags.PLACE_BLOCKS);
case GLOW_ITEM_FRAME, ITEM_FRAME -> this.checkIsland(e, player, loc, Flags.ITEM_FRAME);
case SWEET_BERRY_BUSH, CAVE_VINES -> this.checkIsland(e, player, loc, Flags.BREAK_BLOCKS);
case SWEET_BERRY_BUSH -> this.checkIsland(e, player, loc, Flags.HARVEST);
case CAVE_VINES -> this.checkIsland(e, player, loc, Flags.BREAK_BLOCKS);
case CAKE -> this.checkIsland(e, player, loc, Flags.CAKE);
case CHISELED_BOOKSHELF -> this.checkIsland(e, player, loc, Flags.BOOKSHELF);
case LAVA_CAULDRON ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.bukkit.Tag;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.CaveVinesPlant;
import org.bukkit.entity.AbstractArrow;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EnderCrystal;
import org.bukkit.entity.ItemFrame;
Expand All @@ -23,6 +22,7 @@

import com.google.common.base.Enums;

import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.flags.FlagListener;
import world.bentobox.bentobox.lists.Flags;

Expand All @@ -38,15 +38,21 @@ public void onBlockBreak(final BlockBreakEvent e) {
Player p = e.getPlayer();
Location l = e.getBlock().getLocation();
Material m = e.getBlock().getType();
BentoBox.getInstance().logDebug(m);
if (m.equals(Material.MELON) || m.equals(Material.PUMPKIN)) {
this.checkIsland(e, p, l, Flags.HARVEST);
} else {
// Crops
if (Tag.CROPS.isTagged(m)
if ((Tag.CROPS.isTagged(m)
&& !m.equals(Material.MELON_STEM)
&& !m.equals(Material.PUMPKIN_STEM)
&& !m.equals(Material.ATTACHED_MELON_STEM)
&& !m.equals(Material.ATTACHED_PUMPKIN_STEM)) {
&& !m.equals(Material.ATTACHED_PUMPKIN_STEM))
|| m == Material.COCOA
|| m == Material.SWEET_BERRY_BUSH
|| m == Material.BAMBOO
|| m == Material.NETHER_WART
) {
this.checkIsland(e, p, l, Flags.HARVEST);
} else {
checkIsland(e, p, l, Flags.BREAK_BLOCKS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ public void onUserTeleport(PlayerTeleportEvent e) {
|| e.getCause().equals(TeleportCause.SPECTATE)) {
return;
}
// Return if this is a small teleport
if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) &&
e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) {
return;
}
// Only process if flag is active
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) {
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));

if(e.getTo() != null) {
// Return if this is a small teleport
if (e.getTo().getWorld().equals(e.getPlayer().getWorld()) &&
e.getTo().distanceSquared(e.getPlayer().getLocation()) < getPlugin().getSettings().getClearRadius() * getPlugin().getSettings().getClearRadius()) {
return;
}

// Only process if flag is active
if (getIslands().locationIsOnIsland(e.getPlayer(), e.getTo()) && Flags.REMOVE_MOBS.isSetForWorld(e.getTo().getWorld())) {
Bukkit.getScheduler().runTask(getPlugin(), () -> getIslands().clearArea(e.getTo()));
}
}

}

@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
Expand Down

0 comments on commit 5424cb9

Please sign in to comment.