elBukkit / MagicPlugin

A Bukkit plugin for spells, wands and other magic
http://mine.elmakers.com
MIT License
246 stars 147 forks source link

BetonQuest location objective with brooms #1273

Open Naghell opened 1 year ago

Naghell commented 1 year ago

I'm having problems with "broom". BetonQuest has a target called "location" to detect when a player approaches a radius. What happens is that this event doesn't detect the player flying on the broom, and I already checked that it's not a problem of the plugin as such. How can I fix it? Airscooter has the same bug.

BetonQuest version: 2.0.0-DEV-722
Server version: git-Paper-196 (MC: 1.20.1)
Hooked into: Citizens (2.0.32-SNAPSHOT (build 3205)), DecentHolograms (2.8.4), EffectLib (9.0), FastAsyncWorldEdit (2.8.1-SNAPSHOT-575;aae9249), LuckPerms (5.4.104), MMOCore (1.12.1-SNAPSHOT), MMOItems (6.9.5-SNAPSHOT), Magic (10.8.11-cb6aa41), MythicLib (1.6.2-SNAPSHOT), MythicMobs (5.4.0-${CI_COMMIT_SHORT_SHA}), PlaceholderAPI (2.11.4-DEV-176), ProtocolLib (5.1.1-SNAPSHOT-669), Vault (1.7.3-b${env.TRAVIS_BUILD_NUMBER}), WorldGuard (7.0.9+5934e49)
NathanWolf commented 1 year ago

How have you checked that it's not a problem with Beton? It sounds like they're not detecting a player riding on something. Can you try using a vanilla horse?

Naghell commented 1 year ago

Yep, I tested with a horse and don't have problem

NathanWolf commented 1 year ago

Well I'm not sure what else to try. Broomsticks are just the player mounted on an armor stand- I'm not doing anything to hide them or anything I can think of that would prevent BetonQuest from seeing them move.

Naghell commented 1 year ago

I opened a thread in BetonQuest discord about this problem, there's the answers

image

Naghell commented 1 year ago

And this is the "broom" spell:

estrellafugaz280:
  icon: diamond_axe:168
  icon_disabled: diamond_axe:168
  hidden: true
  icon_url: http://textures.minecraft.net/texture/7f4f1b4c6661ab552b21df8ed841a221296512de46c86e8dee891efbd2fba6
  category: specialty
  upgrade_required_path: year1
  upgrade_required_casts: 20
  world_border_restricted: true
  cast_on_no_target: false
  cancellable: false
  show_undoable: false
  undoable: false
  reactivate: true
  active_spells_restricted: broom,flight,peregrinaje
  actions:
    reactivate:
      - class: MountArmorStand
        find_wand: true
    cast:
      - class: ChangeContext
        target_offset: 0,1,0
        ignore_result: true
        actions:
          - class: Volume
            radius: 1
            actions:
              - class: CheckBlock
                allowed: passthrough
                fail:
                  - class: Message
                    ignore_result: true
                    message_type: action_bar
                    message_key: nospace
                  - class: CastResult
                    result: no_target
                    end_result: true
                  - class: Stop
      - class: Cancel
        spell: broom
      - class: MountArmorStand
  effects:
      cast:
      -  class: EffectSingle
         sound: entity_enderdragon_flap
         sound_volume: 1.1
      -  class: EffectSingle
         effectlib:
           class: TraceEffect
           iterations: 30
           particle: spell
      crash:
      -  class: EffectSingle
         location: origin
         entity_effect: hurt
         particle: explosion_large
      -  class: EffectSingle
         location: origin
         effectlib:
           class: SmokeEffect
           iterations: 12
      land:
      -  sound: block_stone_step
         sound_pitch: 0.7
      -  class: EffectRing
         particle: block_crack
         source_location: feet
         period: 4
         particle_count: 80
         radius: 4
         particle_offset_x: 0.9
         particle_offset_z: 0.9
         particle_offset_y: 0.1
  parameters:
      target: self
      mount_name: Estrella Fugaz 280
      mount_wand: true
      replacement_item: broomstick_handle
      start_speed: 1.5
      min_speed: 1.5
      max_deceleration: 0.04
      bypass_confusion: false
      liftoff_duration: 600
      liftoff_thrust: 1
      fall_protection: 8000
      duration: 3600000
      duration_warning: 100
      cooldown: 100
      crash_distance: 0.9
      crash_effects:
        confusion: 10,3
      warning_effects:
        confusion: 1
      cancel_on_no_permission: true
      cancel_on_world_change: true
      sound: magic.flying
      sound_interval: 500
      sound_max_volume: 0.25
      sound_min_volume: 0.05
      sound_max_pitch: 2
      sound_min_pitch: 0.5
      armor_stand_pitch: 0.3
      controllable: true
      strafe_controllable: 1
      jump_controllable: 1
      exemption_duration: 5000
      armor_stand_marker: false
      steer_speed: 0.1
      max_speed: 1.5
      max_acceleration: 0.05
NathanWolf commented 1 year ago

Ah, hm. It is possible that Spigot doesn't fire player move events while on a broom.

Brooms work by putting the player on an armor stand and applying velocity to the armor stand.

I don't know what the criteria is for Spigot to send a PME, but it's probably based on player input rather than the player's entity moving.

Unfortunately I don't know what I can really do about that. I don't think I'd want Magic to send fake move events. I don't know if there is a newer/better way to make flying vehicles, either.

Naghell commented 1 year ago

There's a way to confirm that? For what it's worth, while riding a broom and using /whois, I can see the coordinates change. But I don't know how feasible that is.

NathanWolf commented 1 year ago

The way to confirm it would be to write a plugin that listens to the PlayerMoveEvent and logs when it sees you move. Then get on a broom and see the events stop.

That's a lot of work to confirm, though. I think it's probably safe to assume PME doesn't fire while on a broom, but I don't know what to do about that.

Naghell commented 1 year ago

I made an event with ConditionalEvents that detects PlayerMoveEvent, indeed it does not execute it when I am riding a broom. In a horse, the event is PME.