BentoBoxWorld / Limits

Limits blocks and entities on islands - for BentoBox
Eclipse Public License 2.0
8 stars 17 forks source link

Numerous Entity interactions bypass /is limits #184

Open Alasdairbugs opened 2 months ago

Alasdairbugs commented 2 months ago

Expected behavior

/is limits should restrict entities spawning or persisting if the limit is maximised to a figure set in the config file.

Observed/Actual behavior

Multiple entities ignore this.

to name a few. Possibly additional entities

Steps/models to reproduce

The entities listed can bypass the limits in several ways

My thoughts are that not all possible ways of generating an entity are considered, so the limit for which a mob is counted for is not checked in some way.

therefore, zombie reinforcement spawning, or silverfish spawning from infested blocks or endermite generation, zombie pigman portal generation, etc., are perhaps not considered too (untested).

BentoBox version

22:30:31 INFO: Running PAPER 1.20.4.

22:30:31 INFO: BentoBox version: 2.2.0 22:30:31 INFO: Database: JSON 22:30:31 INFO: Loaded Game Worlds: 22:30:31 INFO: bskyblock_world (BSkyBlock): Overworld 22:30:31 INFO: Loaded Addons: 22:30:31 INFO: Bank 1.7.1 (ENABLED) 22:30:31 INFO: Biomes 2.1.1 (ENABLED) 22:30:31 INFO: BSkyBlock 1.17.1 (ENABLED) 22:30:31 INFO: Challenges 1.1.0-SNAPSHOT-LOCAL (ENABLED) 22:30:31 INFO: ControlPanel 1.13.1 (ENABLED) 22:30:31 INFO: DimensionalTrees 1.7.0 (ENABLED) 22:30:31 INFO: Likes 2.3.0 (ENABLED) 22:30:31 INFO: Limits 1.19.0 (ENABLED) 22:30:31 INFO: Visit 1.4.0 (ENABLED) 22:30:31 INFO: Warps 1.14.0 (ENABLED)

Plugin list

[22:29:58 INFO]: Server Plugins (50): [22:29:58 INFO]: Paper Plugins: [22:29:58 INFO]: - Minepacks [22:29:58 INFO]: Bukkit Plugins: [22:29:58 INFO]: - AdvancedRegionMarket, AltDetector, BentoBox, BentoBox-Bank, BentoBox-Biomes, BentoBox-BSkyBlock, BentoBox-Level, BentoBox-Warps, BlockLocker, ChestShop [22:29:58 INFO]: CoreProtect, CraftingStore, DecentHolograms, DiscordSRV, EpicRename, Essentials, EssentialsAntiBuild, EssentialsChat, EssentialsSpawn, ExcellentCrates [22:29:58 INFO]: ExecutableItems, HeadDatabase, ImageOnMap, InsaneAnnouncer, InvSeePlusPlus, InvSeePlusPlus_Clear, InvSeePlusPlus_Give, *isSlimeChunk, LuckPerms, MobsManager [22:29:58 INFO]: MossTweaks, NexEngine, PlaceholderAPI, Pladdon, PlayerParticles, ProtocolLib, PvPManager, SCore, SuperVanish, Vault [22:29:58 INFO]: ViaBackwards, ViaVersion, VillagerOverhaul, Votifier, VotifierPlus, VotingPlugin, Vulcan, WorldEdit, WorldGuard

Other

No response

tastybento commented 2 months ago

Hmm, in the code, the CreatureSpawnEvent should catch most, if not all of these:

Lightning strikes villagers, converting to witches which can bypass the limit.

Lightning strikes should be handled.

Natural mob spawns can also spawn additional witches despite the limit being reached in this way from observations.

Natural spawning is blocked if the entity is limited, so this should not happen.

villagers in immediate danger can spawn iron golems which seem to bypass limit if other golems are built in another section of the island, far away.

Village defense is a spawn reason and would be caught too.

pigs struck by lightning to zombie pigman can bypass the limit

This is a lightning strike event and caught too.

villagers can bypass limit by breeding from observations

This may be possible, but I would have to test.

Do you have evidence that these spawns actually occur? It's going to be extremely difficult to test things like lightning strikes.

Alasdairbugs commented 2 months ago

Make a lightning rod and place it near some entities that were spawned in, set the weather to storm for example.

Place 10 villagers and 15 beds, set the island villager limit to 12, and the villagers should over breed.

Build an iron golem, set the limit to 1, scare the villagers you made earlier with a zombie. (If not for them having spawned a golem already).

Otherwise I can get some evidence tomorrow I suppose.

tastybento commented 2 months ago

That's useful. All of those should be covered so I'd be interested to see if they happen.

Alasdairbugs commented 2 months ago

hi there, here is a video https://youtu.be/Un7C1f_TGk8

plugins and bbox version listed in original post.

tastybento commented 2 months ago

Very useful!!

Alasdairbugs commented 1 month ago

Hiya any update on this? im not sure if you've been able to reproduce any of these.

I'm fairly certain this is a bug with bentobox given that we've had it for so long, through multiple versions. I'd be willing to put a ~17 USD bounty onto this if I can verifiably see it fixed and working. Perhaps 5 for reproducing, 12 for fixing. Thanks.

tastybento commented 1 month ago

I'm running 1.21.0-SNAPSHOT. I added debug and tested and these are fixed:

[15:22:39 INFO]: LSPVickyToo issued server command: /lightning
[15:22:39 INFO]: Villager Villager['Villager'/493, uuid='7e8d1132-05e0-48cc-a1d9-1efcb85b4471', l='ServerLevel[acidisland_world]', x=28002.50, y=74.00, z=-8799.50, cpos=[1750, -550], tl=961, v=true] was struck by lightning LightningBolt['Lightning Bolt'/545, uuid='3a38e4fc-e8b6-48e4-8b59-487069cdbf01', l='ServerLevel[acidisland_world]', x=28002.00, y=73.00, z=-8800.00, cpos=[1750, -550], tl=1, v=true].
[15:22:39 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent WITCH
[15:22:39 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent result is (false = not allowed) : false
[15:22:39 INFO]: Villager Villager['Villager'/494, uuid='a959dfa7-8551-447b-98e8-fcf085527c64', l='ServerLevel[acidisland_world]', x=28004.50, y=74.00, z=-8799.50, cpos=[1750, -550], tl=920, v=true] was struck by lightning LightningBolt['Lightning Bolt'/545, uuid='3a38e4fc-e8b6-48e4-8b59-487069cdbf01', l='ServerLevel[acidisland_world]', x=28002.00, y=73.00, z=-8800.00, cpos=[1750, -550], tl=1, v=true].
[15:22:39 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent WITCH
[15:22:39 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent result is (false = not allowed) : false
[15:30:43 INFO]: LSPVickyToo issued server command: /lightning
[15:30:43 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent ZOMBIFIED_PIGLIN
[15:30:43 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent result is (false = not allowed) : false
[15:30:43 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent ZOMBIFIED_PIGLIN
[15:30:43 INFO]: [BentoBox] DEBUG: CreatureSpawnEvent result is (false = not allowed) : false

I am having trouble replicating the villager things because it's difficult to make the environment, but I'd like you to try and duplicate using this build (it has debug like above) and share, please. Limits-1.21.0-SNAPSHOT-LOCAL.jar.zip

Alasdairbugs commented 1 month ago

could not run this ver. on 1.20.4 - no errors came up, unsure what to do

tastybento commented 1 month ago

Did you unzip it?

Alasdairbugs commented 1 month ago

yep, a config was made and put into a data folder in the limits plugin folder, bentobox > addons > limits > data > config.yml

running bsb 1.17.1 on mc v1.20.4

rebooting does not create a folder, making it ourselves doesnt help. its not recognising /bsbadmin limits

Alasdairbugs commented 1 month ago

Figured it out, could not reproduce these fixes. I do however, see in the console that bbox notices and i get the same "[BentoBox] DEBUG: CreatureSpawnEvent result is (false = not allowed) : false" but to no avail, because the entities still persist over the limit without despawning.

just to be sure, i did a control: i bred 15 cows and none went over the limit, so the limits plugin was working where else intended. using version 1.20.4.

tastybento commented 1 month ago

What is happening here then is that the Limits addon is canceling the event, but some other plugin's listener is allowing it again. Here's a version with the event priority changed from LOW to HIGHEST that may solve the problem. If you want to find out which plugin is doing this, then use the previous version and add plugins until you find the one that starts to cause the problem. I'm not familiar with all your plugins so I'm not sure which it may be, but you can start with ones that affect creature spawning. Limits-1.21.0-SNAPSHOT-LOCAL.jar.zip