How To Achieve Target Selector

XMLWordPrintable

    • Type: New Feature
    • Resolution: Invalid
    • Priority: Minor
    • None
    • Affects Version/s: None
    • 1.20.1
    • Yes

      If I have created a plugin that allows players to send message privatly, here are a part of codes:

      // in onCommand method:
      // strings[0] == A Player's Name
      // strings[1] == A Text want to tell to others privatly
      Bukkit.getPlayer(strings[0]).sendMessage(strings[1]);

      Then I have to execute the in-game commands:

      /privatespeak Steve Hello
      

      But, as a player, I want to change my target to a nearest player, and tell him to come to my home to get his prize, I will exactly write this:

      /privatespeak @p Come-to-my-home

      However, the Target Selector @p is not a player's name. Then the plugin will throw an error because nobody in the server named "@p".

      So how can I achieve this just like the original in-game commands /msg ?

      Or is it possible to reprint the command /msg using plugins?

            Assignee:
            Unassigned
            Reporter:
            X_huihui
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: