Skip to content

Commit

Permalink
Fixes barrier blocks not removing on protection range change (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
wellnesscookie committed Jan 10, 2021
1 parent 1903f9e commit f2a4713
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.bukkit.event.vehicle.VehicleMoveEvent;
import org.bukkit.util.Vector;

import world.bentobox.bentobox.api.events.island.IslandProtectionRangeChangeEvent;
import world.bentobox.bentobox.api.metadata.MetaDataValue;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
Expand Down Expand Up @@ -68,6 +69,13 @@ public void onVehicleMove(VehicleMoveEvent e) {
}
}

@EventHandler(priority = EventPriority.NORMAL)
public void onProtectionRangeChange(IslandProtectionRangeChangeEvent e) {

// Cleans up barrier blocks that were on old range
e.getIsland().getPlayersOnIsland().forEach(player -> hideBarrier(User.getInstance(player)));
}

/**
* Show the barrier to the player on an island
* @param player - player to show
Expand Down

0 comments on commit f2a4713

Please sign in to comment.