Ajneb97 / ConditionalEvents

MIT License
22 stars 12 forks source link

[Feature Request] Client side cancel_event #44

Closed Tanerx closed 8 months ago

Tanerx commented 8 months ago

Hello. I'm trying to cancel event to all players except 1 player. I did a lot of test and read everything in the wiki but can't found any solution. What ever i do event is cancel to all players. It is possible to add client side cancel event ?

This is what I'm tested:

  ItemSpawnEvent:
    type: custom
    custom_event_data:
      event: org.bukkit.event.entity.ItemSpawnEvent
    actions:
      default:
      - "to_player: Taner: cancel_event: true"
Ajneb97 commented 8 months ago

If you want to cancel an event to one player, then you need to add conditions, and cancel the event when the conditions are accomplished.

Tanerx commented 8 months ago

If you want to cancel an event to one player, then you need to add conditions, and cancel the event when the conditions are accomplished.

When the condition are meet, cancel event action still cancel event from the server. I'm trying to stop sending event packets to some player(s). I don't want to cancel the event from server. I just want to cancel event from client side. Example config below still cancel the event from all players in the server.

  ItemSpawnEvent:
    type: custom
    custom_event_data:
      event: org.bukkit.event.entity.ItemSpawnEvent
      variables_to_capture:
      - '%itemtype%;getEntity().getItemStack().getType()'
    conditions:
    - '%itemtype% equals WOODEN_SWORD'
    actions:
      default:
      - "to_player: Taner: cancel_event: true"
[11:11:20 INFO]: [ItemSpawnEvent,start] Checking for: 'WOODEN_SWORD' equals 'WOODEN_SWORD' | Result: APPROVED
[11:11:20 INFO]: [ItemSpawnEvent] Executing actions from action group: default
[11:11:20 INFO]: [ItemSpawnEvent,action] Executing action: (TO_PLAYER Taner) [CANCEL_EVENT] true

This WOODEN_SWORD is removed from the server. I don't want to remove from server. I want to hide from player Taner in this example.

Ajneb97 commented 8 months ago

The plugin doesn't work with packets so that's not possible.