|
17 | 17 |
|
18 | 18 | import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
19 | 19 | import com.sk89q.worldedit.math.BlockVector3;
|
20 |
| -import com.sk89q.worldguard.WorldGuard; |
21 | 20 | import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
22 | 21 | import com.sk89q.worldguard.bukkit.event.block.PlaceBlockEvent;
|
23 | 22 | import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
24 | 23 | import com.sk89q.worldguard.protection.flags.Flags;
|
25 |
| -import com.sk89q.worldguard.protection.flags.StateFlag; |
26 | 24 | import com.sk89q.worldguard.protection.managers.RegionManager;
|
27 | 25 | import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
28 |
| -import com.sk89q.worldguard.protection.regions.RegionContainer; |
| 26 | +import dev.espi.protectionstones.event.PSBreakProtectBlockEvent; |
29 | 27 | import dev.espi.protectionstones.event.PSCreateEvent;
|
30 | 28 | import dev.espi.protectionstones.event.PSRemoveEvent;
|
31 | 29 | import dev.espi.protectionstones.utils.RecipeUtil;
|
|
41 | 39 | import org.bukkit.block.Furnace;
|
42 | 40 | import org.bukkit.command.CommandSender;
|
43 | 41 | import org.bukkit.enchantments.Enchantment;
|
44 |
| -import org.bukkit.entity.EntityType; |
45 | 42 | import org.bukkit.entity.Player;
|
46 | 43 | import org.bukkit.event.Event;
|
47 | 44 | import org.bukkit.event.EventHandler;
|
|
56 | 53 | import org.bukkit.event.player.PlayerJoinEvent;
|
57 | 54 | import org.bukkit.event.player.PlayerTeleportEvent;
|
58 | 55 | import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
59 |
| -import org.bukkit.inventory.GrindstoneInventory; |
60 | 56 | import org.bukkit.inventory.ItemStack;
|
61 | 57 |
|
62 | 58 | import java.util.List;
|
@@ -172,6 +168,12 @@ private boolean playerBreakProtection(Player p, PSRegion r) {
|
172 | 168 | return false;
|
173 | 169 | }
|
174 | 170 |
|
| 171 | + // Call PSBreakEvent |
| 172 | + PSBreakProtectBlockEvent event = new PSBreakProtectBlockEvent(r , p); |
| 173 | + Bukkit.getPluginManager().callEvent(event); |
| 174 | + // don't give ps block to player if the event is cancelled |
| 175 | + if (event.isCancelled()) return false; |
| 176 | + |
175 | 177 | // return protection stone if no drop option is off
|
176 | 178 | if (blockOptions != null && !blockOptions.noDrop) {
|
177 | 179 | if (!p.getInventory().addItem(blockOptions.createItem()).isEmpty()) {
|
|
0 commit comments