ShaneBeee / SkBee

SkBee is a Skript addon that aims to add more useful elements to Skript.
GNU General Public License v3.0
57 stars 20 forks source link

[BUG] BoundBorderListener mutates the "from" location in move events #488

Closed sovdeeth closed 1 year ago

sovdeeth commented 1 year ago

What happened?

The preventBoundMovement method sets the yaw and pitch of the from location to the yaw and pitch of the to location. Since from is not cloned, this affects the original from location in the event and pollutes downstream listeners. This isn't a very big issue as it would only affect other MONITOR listeners, but should still be addressed.

Steps to reproduce

on bound enter:
    send "test" 

on player move with priority MONITOR:
    broadcast "move"
    broadcast "%past event-location's yaw% -> %future event-location's yaw%"  
    broadcast "%past event-location's pitch% -> %future event-location's pitch%"

You'll notice as you move around, they always have the same pitch/yaw when SkBee is installed Without SkBee, the yaw/pitch is different.

Expected behavior

I expect the listener to not change the from or to locations (well it could technically change to and that'd be valid, but only if the player will actually end up at to.

SkBee Version

2.17.0

Server Version

Paper 1.20.1

SkBee Info

skbee info [12:43:31 INFO]: --- [SkBee Loading Info] --- [12:43:31 INFO]: - Other Elements successfully loaded [12:43:31 INFO]: - [NBTAPI] Found Spigot: v1_20_R1! Trying to find NMS support [12:43:31 INFO]: - [NBTAPI] NMS support 'MC1_20_R1' loaded! [12:43:31 INFO]: - NBT Elements successfully loaded [12:43:31 INFO]: - Text Component Elements successfully loaded [12:43:31 INFO]: - Advancement Elements successfully loaded [12:43:31 INFO]: - BossBar Elements successfully loaded [12:43:31 INFO]: - Bound Elements successfully loaded [12:43:31 INFO]: - Display Entity elements successfully loaded [12:43:31 INFO]: - Fishing elements successfully loaded [12:43:31 INFO]: - Game Event Elements successfully loaded [12:43:31 INFO]: - Particle Elements successfully loaded [12:43:31 INFO]: - RayTrace elements successfully loaded [12:43:31 INFO]: - Recipe Elements successfully loaded [12:43:31 INFO]: - Scoreboard Elements successfully loaded [12:43:31 INFO]: - Scoreboard Objective Elements successfully loaded [12:43:31 INFO]: - Statistic Elements successfully loaded [12:43:31 INFO]: - Structure Elements successfully loaded [12:43:31 INFO]: - Minecraft Tag elements successfully loaded [12:43:31 INFO]: - Team Elements successfully loaded [12:43:31 INFO]: - Villager Elements successfully loaded [12:43:31 INFO]: - Virtual Furnace Elements disabled via config [12:43:31 INFO]: - World Border Elements successfully loaded [12:43:31 INFO]: - World Creator Elements disabled via config [12:43:31 INFO]: - Plugin is up to date! [12:43:31 INFO]: --- [Server Info] --- [12:43:31 INFO]: Server Version: git-Paper-164 (MC: 1.20.1) [12:43:31 INFO]: Skript Version: 2.7.0-beta3 [12:43:31 INFO]: Skript Addons: [12:43:31 INFO]: - skript-reflect v2.3.1-for-skript-beta [12:43:31 INFO]: SkBee Version: 2.17.0 [12:43:31 INFO]: SkBee Website: https://github.com/ShaneBeee/SkBee

Additional Information

No response

Fusezion commented 1 year ago

At work for another 5 hours as for that line you commented on I can't see full code on mobile but it should still exist on another piece of code

sovdeeth commented 1 year ago

@ShaneBeee You may want to check out some of the vehicle event listeners in the boundborderlistener class, they also modify from without cloning, but I haven't tested with them

Fusezion commented 1 year ago

They all modify to and from as we set yaw and pitch to 0

ShaneBeee commented 1 year ago

@ShaneBeee You may want to check out some of the vehicle event listeners in the boundborderlistener class, they also modify from without cloning, but I haven't tested with them

ok I think I got them all. I cloned any location which has been modified