mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-05-30 13:46:24 +02:00
fix: cancel structure locate in classic plot worlds (#4653)
This commit is contained in:
parent
74a1a1f954
commit
629646ab06
@ -29,6 +29,7 @@ import com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent;
|
||||
import com.destroystokyo.paper.event.server.AsyncTabCompleteEvent;
|
||||
import com.google.inject.Inject;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.command.Command;
|
||||
import com.plotsquared.core.command.MainCommand;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
@ -38,6 +39,7 @@ import com.plotsquared.core.permissions.Permission;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
import com.plotsquared.core.plot.PlotArea;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.flag.FlagContainer;
|
||||
import com.plotsquared.core.plot.flag.implementations.BeaconEffectsFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.DoneFlag;
|
||||
@ -48,6 +50,7 @@ import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.util.PlotFlagUtil;
|
||||
import io.papermc.paper.event.entity.EntityMoveEvent;
|
||||
import io.papermc.paper.event.world.StructuresLocateEvent;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.tag.Tag;
|
||||
import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver;
|
||||
@ -458,6 +461,21 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't let the server die when populating cartographers (villager offering maps) in classic plot worlds
|
||||
* (as those don't generate POIs)
|
||||
*/
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
|
||||
public void onStructuresLocate(StructuresLocateEvent event) {
|
||||
if (!PlotSquared.get().getPlotAreaManager().hasPlotArea(event.getWorld().getName())) {
|
||||
return;
|
||||
}
|
||||
final PlotArea area = PlotSquared.get().getPlotAreaManager().getPlotAreaByString(event.getWorld().getName());
|
||||
if (area != null && area.getType() == PlotAreaType.NORMAL) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean getBooleanFlagValue(
|
||||
@NonNull FlagContainer container,
|
||||
@NonNull Class<? extends BooleanFlag<?>> flagClass,
|
||||
|
Loading…
x
Reference in New Issue
Block a user