Filled AreaTrigger

Discussion in 'Plugin Requests' started by adi0115, May 3, 2019.

Thread Status:
Not open for further replies.
  1. Plugin category: Pvp/Fun

    Minecraft version: 1.8

    Suggested name: ItemTrigger

    What I want: I'm looking for a plugin where going to certain area or clicking on an item triggers a set of commands delayed by ticks. An item trigger, when a player clicks on a specific item with specific name that have been set in the config, it also triggeres a set of commands.

    This is an example of a config as it's easier to make an example than explain it:
    Code:
    ItemTrigger:
      TriggerItem: NETHER_STAR
       ItemName: '&cTrigger Item'
       Cooldown: 30 #the delay between the triggers in seconds
       CooldownMessage: You need to wait %cooldown% before triggering again! #message when the item trigger is in cooldown, %cooldown% placeholder displays the cooldown in seconds
      Commands: #the set of commands that will be executed by console when triggered, the numbers represet the delay in ticks when the commands will be executed after item is triggered
      - 5: time night
      - 20: time day
      - 21: give %player% diamond_sword 1
      - 22: smite %player%
       PlayersNearBy:  #players withing certain radius of the player who used item trigger, will recieve set of potion effect
       Area: 5 #how close do playes need to be withing to the player who used item trigger to be effected, in this case it's 5 blocks
       - 300: slowness #players withing the AREA will get this potion effect for 300 ticks
       - 120: mining_fatigue #players withing the AREA will get this potion effect for 120 ticks
    This is just an example config of what should be inside of the config.

    Ideas for commands: /areatrigger reload - reloads the config

    Ideas for permissions: areatrigger.reload - ability to reload the config, everyone can use the triggeres, OP should still have the cooldown and not be able to bypass the cooldown.

    When I'd like it by: Today/Tomorrow/Day After that, please don't rush :)
     
    Last edited: May 6, 2019
  2. Offline

    KarimAKL

    @adi0115 I'm a little confused about the AreaTrigger part, do you just want the specified commands executed after the specified time when a player walks on top of the specified block? (that was a lot of "specified", lol)
    Also, should the commands be executed as the console or as the player? Another thing, if the server shuts down while waiting for a command to be executed, do you want it to be executed when the server starts, if the time has gone by?
     
  3. I have removed the AreaTrigger part since I don't really need it anymore, more intrested in the ItemTrigger part, should be easier for you to understand now. I want the commands to be executed after the player clicks the item and as console which is why I would like a %player% placeholder to specify the player who clicked the item, and if the server shuts down, I would just prefer the commands not to be executed. I also overlooked two crucial parts, one is, would there be a possibility to prevent players from triggering the item at places such as spawn? For example pos1 pos2 cube system or using WGRegionEvents API to look for regions that have the word "spawn" in them? Another thing is, could there be another set for commands that are executed without delay when the player dies/leaves the server/goes to spawn? For example if there is /time night and /time day commands on delay and the player dies/leaves the server/goes to spawn after /time night is executed but before /time day is. The seperate set of commands can execute /time day for example.
     
  4. Offline

    KarimAKL

    @adi0115 When you say 'clicks the item', do you mean right (or left) click with the item in their hand?
     
  5. Offline

    KarimAKL

    @adi0115 Okay, do you still want the command to be '/areatrigger'? (and permission to be 'areatrigger.reload')
     
  6. It can be changed to /itemtrigger and itemtrigger.reload.
     
  7. Offline

    KarimAKL

    @adi0115 How do you want the effects to work? The players within the area will get potion effects, sure, but should the effects be delayed like the commands? How do you choose the amplifier? If the effects are delayed, how do you choose the duration? If everything is working, i should be finished with this plugin soon, i just need this information before i can test it.
     
  8. @KarimAKL I didn't think of that, maybe something like this?
    Code:
        - 'SLOWNESS : 350 : 2'
    First bit is self explanatory, the second number '350' is the duration and the third number is the amplifier? The potion effects should be executed after the item is right clicked and shouden't be delayed.
     
  9. Offline

    KarimAKL

    @adi0115 Okay, i'll do that then. :) Another thing, you said you wanted some commands to be executed when a player dies, leaves the server, or goes to spawn, but what do you mean by "goes to spawn"? Do you mean using a command or walking into the "spawn" area? How would it be detected?
     
  10. @KarimAKL When they teleport or walks into spawn by either a pos1 pos2 system with multiple regions support or using WGRegionEvents API to detect regions with the word "spawn" in the region name.

    EDIT: Forgot to ask, would it be possible to add suppoor multiple items triggers? So you can create multiple different ones? If it's not too late of course.
     
    Last edited: May 7, 2019
  11. Offline

    KarimAKL

    @adi0115 Could you send a link to the "WGRegionEvents API"? There are multiple with similar names.
     
  12. Offline

    KarimAKL

    Didn't see this before now.
    What about cooldown? Would that trigger for that item only or for all items?
     
  13. @KarimAKL The item only, so if there's item a and item b and players clicks on item a, the cooldown will activate on item a and not item b.
     
  14. Offline

    KarimAKL

    @adi0115 Try this: https://www.dropbox.com/s/76d972p0kd4had5/ItemTrigger.jar?dl=0
    Please let me know if you find any errors or i forgot something.
    List of item names: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html
    List of effect names: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.html
    Note: These links are for the newest version of minecraft, while this plugin is made for 1.8, some of the names might not work, if so, please let me know and i'll look at it.
     
  15. @KarimAKL Thanks a lot, works just the way I wanted, I haven't encountered any issues so far, but I'm unable to stop item trigger items being used at spawn, I'm not sure if I have to name the region something specific.
     
  16. Offline

    KarimAKL

    @adi0115 Ah, that's what i forgot, i meant to add that but forgot and then couldn't remember, i'll add it now.

    EDIT: Doesn't seem like the API you provided me with contains a method for getting region names. Do you have any other APIs i could use for that? Maybe WorldGuard itself? Though i haven't worked with WorldGuard before. (Please provide me with the WorldGuard version you are using as well)
     
    Last edited by a moderator: May 7, 2019
  17. @KarimAKL I'm using WorldGuard 6.2.2 which is the last WorldGuard version to support 1.8, versions after that only support 1.13 and up due to 1.13 material changes.
     
  18. Offline

    KarimAKL

    @adi0115 Should be done now, you can change the "No-Trigger" in the config to the word that the region should contain in order for it to not trigger in that region. (This shouldn't be case sensitive)
    You can download it here: https://www.dropbox.com/s/76d972p0kd4had5/ItemTrigger.jar?dl=0
    Had to get the latest WorldEdit version supporting 1.8 as well. (which seemed to be version 6.1.9)
     
    adi0115 likes this.
  19. @KarimAKL Thanks a lot, I will test it out as soon as I can, quick question, since in the config the items tab is called "Items", is there ability to create multiple items with different commands for each or one?
     
  20. Offline

    KarimAKL

    @adi0115 You can make multiple trigger items but they all trigger the same commands. If you want this changed i could look at it.
     
  21. @KarimAKL Yeah, if you could look into that, it would awesome.

    EDIT: After testing it, everything works perfectly fine, I haven't found a single bug so far.
     
    Last edited: May 8, 2019
  22. Offline

    KarimAKL

  23. @KarimAKL Thanks a lot, had a day to test it out, everything works fine but I have noticed one bug, the "Leave" and "Spawn" commands trigger everytime when any player leaves or goes to spawn and not the person who used item trigger and has commands queued.
     
  24. Offline

    KarimAKL

    @adi0115 Glad to know it works. :) About the leave and spawn commands, i thought it was supposed to always trigger, could you explain? I don't think i understood this:
    EDIT: The death one is the same way, please let me know if that should be changed as well.
     
    Last edited by a moderator: May 12, 2019
  25. @KarimAKL The idea behind the death, leave and spawn commands were to execute if a player used an item trigger and then left or went to spawn or died but there are still commands to be executed. I made a little storyboard to hopefully make it more clear, lets say this is what normally happens.
    Player uses an item trigger
    'time night' executed after 10 ticks
    'time day' executed after 500 ticks
    'give %player% diamond_sword 1' executed after 500 ticks along with 'time day'

    Incase a player leaves a server in middle of queded commands, this would happen instead:
    Player uses an item trigger
    'time night' executed after 10 ticks
    Player leaves the server, all un-executed commands are cancelled and commands from 'Leave' are executed which include 'time day'
    'time day' executed after 500 ticks (cancelled, player left before it could be executed)
    'give %player% diamond_sword 1' executed after 500 ticks along with 'time day (cancelled, player left before it could be executed'

    This just prevents a player using an item trigger that causes to become night and then leaves and the whole server has to wait 500 ticks until 'time day' is executed, instead if the players leaves, dies, or goes to spawn, 'time day' is executed and any un-executed commands are cancelled.

    I hope I explained it well, it's a bit hard to explain it.
     
  26. Offline

    KarimAKL

    Last edited by a moderator: May 13, 2019
    adi0115 likes this.
  27. @KarimAKL Works perfectly right now, haven't encountered any bugs, thank you very much for doing this :)
     
    KarimAKL likes this.
Thread Status:
Not open for further replies.

Share This Page