Clickable teleportation accept

Discussion in 'Plugin Requests' started by tripartite, Sep 26, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    tripartite

    Hello,
    I don't have the slightest when it comes to coding.
    That's the sentence i will start this off with.....
    So, i am looking for a plugin that will use the default /tpa command and send a message into the chat to the target that will allow them to click the text that will say 'Accept' or 'Deny' and it will complete the corresponding command (/tpaccept /tpdeny)
    I have tried to do it and have found no luck.
    The plugin should be able to be customised in a config to change the colour scheme / text of the message's sent during the process.
    Any help would be highly appreciated but only if its positive.
    Thanks,
    Adam

    edit - I'm not looking for a GUI just a simple message in chat that is clickable.
     
    Last edited: Sep 26, 2016
  2. Hmm. I might attempt to do this, although I've never worked with a chat click event. Give me time to look into it.
     
  3. Offline

    Rayzr522

    Chat click events are impossible without JSON messages, and those are hard to do. However, I made a class file for creating them very easily: https://github.com/Rayzr522/JSONMessage

    Also tomorrow I'll be adding the Reflection code that sends the messages to players. That's actually the hardest part :p

    But if you wait a short while I'll get that all finished up and you could use that for the plugin. Just thought I'd try to help :D

    Install instructions are all in the repository, it's just drag n' drop pretty much :)
     
  4. Offline

    Rayzr522

    Btw I finished up the class this morning, you can now use it to send JSON messages to players. Plenty of usage examples on the GitHub page.

    Enjoy!
     
  5. Sweet! I'll look into it once I'm done with school.
     
  6. Offline

    9UjtOAtcBA

    Just add the JSON tag "clickEvent":{"action":"run_command","value":"/tpaccept"} to the text displayed to the target player?

    I think this is doable in mycommand for vanilla servers, if one wants to make this from scratch:

    Code:
    tpa:
      command: /tpa
      type: run_console
      runcmd: 
      - /execute $player ~ ~ ~ /scoreboard players tag $player add $arg1
      - /execute $player ~ ~ ~ /scoreboard players set $player tpsession $gettotalexperience
      - /tellraw $arg1 {"text":"$player wishes to teleport to you. Click here to accept.","color":"gold","clickEvent":{"action":"run_command","value":"/tpaccept $player $loc_pitch$loc_yaw"}}
    tpaccept:
      command: /tpaccept
      type: run_console
      runcmd: 
      - /execute @a[name=$arg1,tag=$player,score_tpsession_min=$arg2,score_tpsession=$arg2] ~ ~ ~ /tp $locX $locY $locZ
      - /tellraw @a[name=$arg1,score_tpsession_min=$arg2,score_tpsession=$arg2]{"text":"$player accepted your teleport request.","color":"gold"}
      - /execute @a[name=$arg1,tag=$player,score_tpsession_min=$arg2,score_tpsession=$arg2] ~ ~ ~ /scoreboard players tag $arg1 remove $player
      - /execute @a[name=$arg1,score_tpsession_min=$arg2,score_tpsession=$arg2] ~ ~ ~ /scoreboard players set $arg1 tpsession -1
    
    You could hook all kinds of things into that, as well... Prevent ignored players from sending tpa's, only teleport players to the surface, or only teleport them to the approximate area of the target. Maybe allow players to automatically accept or deny requests, or force both players to be in the same faction/town/kingdom/whatever.

    No reason not to get creative.
     
  7. Offline

    Rayzr522

  8. Offline

    saigonheat

    Sorry. I'm afraid somethings come up. But you're welcome to take over.

    Sent from my SM-G530T using Tapatalk
     
  9. @Rayzr522
    Sorry, for some reason TapaTalk posts with that account. That was me that made that post
     
  10. Offline

    Rayzr522

    It's fine :p

    @tripartite: my team can do this for you. Do you want this is a separate teleport system, or just like an extension of Essential's system that'll send a message in chat allowing them to accept or deny?

    We can do it either way.
     
  11. Offline

    tripartite

    @Rayzr522 Thank you big time for the offer! i am looking for an extension of Ultimate Core, The essentials style plugin my server uses :) And as you stated, simply just a message in chat and maybe an option in the config to have a hologram style message pop up on your screen in large such as those 'Welcome to x server' messages you sometimes get that is clickable with accept and deny.
    Thanks a lot!
    Adam
     
  12. Offline

    I Al Istannen

    @Rayzr522 @tripartite
    The coolest way would be intercepting outgoing chat packets and searching with an regex. If it matches, replace it with a custom Json message, using the regex groups to preserve eventual tags or names send too.

    What about that @9UjtOAtcBA?
     
  13. Offline

    Rayzr522

    Overcomplicated much? Would be fun though ;)
     
Thread Status:
Not open for further replies.

Share This Page