mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
feat: add InteractionInteractFlag (#4538)
This commit is contained in:
@ -54,6 +54,7 @@ import com.plotsquared.core.plot.flag.implementations.EditSignFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.HangingBreakFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.HangingPlaceFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.HostileInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.InteractionInteractFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.ItemDropFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.KeepInventoryFlag;
|
||||
import com.plotsquared.core.plot.flag.implementations.LecternReadBookFlag;
|
||||
@ -1737,6 +1738,11 @@ public class PlayerEventListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityCategories.INTERACTION.contains(entityType) && flagContainer
|
||||
.getFlag(InteractionInteractFlag.class).getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (EntityCategories.VILLAGER.contains(entityType) && flagContainer
|
||||
.getFlag(VillagerInteractFlag.class).getValue()) {
|
||||
return;
|
||||
|
@ -75,6 +75,7 @@ import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Ghast;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Interaction;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
@ -432,6 +433,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
@Override
|
||||
public @NonNull Set<com.sk89q.worldedit.world.entity.EntityType> getTypesInCategory(final @NonNull String category) {
|
||||
final Collection<Class<?>> allowedInterfaces = new HashSet<>();
|
||||
final int[] version = PlotSquared.platform().serverVersion();
|
||||
switch (category) {
|
||||
case "animal" -> {
|
||||
allowedInterfaces.add(IronGolem.class);
|
||||
@ -439,7 +441,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
allowedInterfaces.add(Animals.class);
|
||||
allowedInterfaces.add(WaterMob.class);
|
||||
allowedInterfaces.add(Ambient.class);
|
||||
if (PlotSquared.platform().serverVersion()[1] >= 19) {
|
||||
if (version[1] >= 19) {
|
||||
allowedInterfaces.add(Allay.class);
|
||||
}
|
||||
}
|
||||
@ -470,6 +472,11 @@ public class BukkitUtil extends WorldUtil {
|
||||
allowedInterfaces.add(Firework.class);
|
||||
}
|
||||
case "player" -> allowedInterfaces.add(Player.class);
|
||||
case "interaction" -> {
|
||||
if ((version[1] > 19) || (version[1] == 19 && version[2] >= 4)) {
|
||||
allowedInterfaces.add(Interaction.class);
|
||||
}
|
||||
}
|
||||
default -> LOGGER.error("Unknown entity category requested: {}", category);
|
||||
}
|
||||
final Set<com.sk89q.worldedit.world.entity.EntityType> types = new HashSet<>();
|
||||
|
Reference in New Issue
Block a user