mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Introduce tile-drop flag (#4371)
* added tile-drops flag * added tile-drops flag * added tile-drop flag * updated description * relocated listener
This commit is contained in:
@ -19,6 +19,7 @@
|
||||
package com.plotsquared.bukkit.listener;
|
||||
|
||||
import com.destroystokyo.paper.event.block.BeaconEffectEvent;
|
||||
import com.destroystokyo.paper.event.block.BlockDestroyEvent;
|
||||
import com.destroystokyo.paper.event.entity.EntityPathfindEvent;
|
||||
import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent;
|
||||
import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent;
|
||||
@ -42,6 +43,7 @@ import com.plotsquared.core.plot.flag.implementations.BeaconEffectsFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.FishingFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ProjectilesFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.TileDropFlag;
|
||||
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.PlotFlagUtil;
|
||||
@ -84,6 +86,19 @@ public class PaperListener implements Listener {
|
||||
this.plotAreaManager = plotAreaManager;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onBlockDestroy(final BlockDestroyEvent event) {
|
||||
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot != null) {
|
||||
event.setWillDrop(plot.getFlag(TileDropFlag.class));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityPathfind(EntityPathfindEvent event) {
|
||||
if (!Settings.Paper_Components.ENTITY_PATHING) {
|
||||
|
@ -61,6 +61,7 @@ import com.plotsquared.core.plot.flag.implementations.MiscInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PlayerInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.PreventCreativeCopyFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.TamedInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.TileDropFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.UntrustedVisitFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.VehicleBreakFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.VehicleUseFlag;
|
||||
@ -107,6 +108,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||
import org.bukkit.event.entity.EntityPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityPotionEffectEvent;
|
||||
@ -236,6 +238,19 @@ public class PlayerEventListener implements Listener {
|
||||
this.plotListener = plotListener;
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
|
||||
public void onBlockBreak(final BlockBreakEvent event) {
|
||||
Location location = BukkitUtil.adapt(event.getBlock().getLocation());
|
||||
PlotArea area = location.getPlotArea();
|
||||
if (area == null) {
|
||||
return;
|
||||
}
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot != null) {
|
||||
event.setDropItems(plot.getFlag(TileDropFlag.class));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerDyeSign(PlayerInteractEvent event) {
|
||||
ItemStack itemStack = event.getItem();
|
||||
|
Reference in New Issue
Block a user