PGMDev / PGM

The original PvP Game Manager for Minecraft
https://pgm.dev
GNU Affero General Public License v3.0
181 stars 89 forks source link

XML spawners only trigger once a player has moved an additional block after entering the player-region #1017

Open Cazadorian opened 2 years ago

Cazadorian commented 2 years ago

Currently XML spawners have a spawner-region and a player-region. If a player is within the player-region the spawner is supposed to spawn an item/splash potion within the spawn-region. Currently however PGM seemingly fails to detect players having entered the player-region until they move an additional block in any direction, even one out of the region. Three video examples of this behaviour are below and testing on both a localhost running the current latest PGM version and OCC's mapdev server result in the same behaviour.

Example 1, the player region in this example is a 1x1 rectangle, which makes Y level irrelevant to the player being inside. Despite that though jumping within it allows the spawner to activate as the player has moved a block vertically, and it stays activated once the player lands as they are still within the region.

Example 2, the player region in this example is a 3x3 cuboid around the central pressure plate. Walking from one block within the region to another block within the region causes the spawner to detect the player and then activate itself. Jumping also functions like example 1. Exiting the region causes the spawner to properly deactivate itself however.

Example 3, same as example 1 but with item spawners instead of splash potion spawners to demonstrate it occurs with both.

Pablete1234 commented 2 years ago

I answered to this on discord, but the TLDR is that spawners are using their own tracking of player which checks, on move event, if the region contains the player. This is broken in more ways than described here, like dying won't make you stop triggering the spawner.

The control point PlayerTracker should be reused in spawners because the functionality is the same: keeping a list of players in a region updated, and it already takes into account all the ways you may enter or leave a region (eg: dying makes you leave the region)