Staff message when a player joins the server

Discussion in 'Archived: Plugin Requests' started by GalaxyPrisonMc, Jun 19, 2014.

  1. Offline

    GalaxyPrisonMc

    Plugin category: admin tools

    Suggested name: player join message

    What I want: i want a plugin that when NEW players join whatever member of the staff is on it will automatically broadcast to the sevrer for the staff member
    [staff member's prefix] staff member name [staff member's suffix] : Welcome To The Server (new player's name) !!! Enjoy Your Stay

    it will also act like the staff member actually said it when they didn't
    the broadcast message should be configurable in the config along with the staff members in game names that will automatically announce for them also should support essentials color codes witch is "&" symbol.

    here a example : [​IMG]
    that was said less than a second of the player joining the server so obviously not him typing it him self ....

    Ideas for commands: No commands needed

    Ideas for permissions: No Permissions needed

    When I'd like it by: anytime just as soon as possible
     
  2. Offline

    Silveridian

    I'll look into it.
     
  3. Offline

    GalaxyPrisonMc

    if there is already a plugin like this someone please let me know
     
  4. Offline

    ZanderMan9

    He probably has the Macros mod which allows him to say things with key combos.
    This could work similarly to essentials' /sudo command perhaps?
     
  5. Offline

    GalaxyPrisonMc

    the owner of the server is a youtuber and in his video he clearly didn't type a command and when a player joined (while he was recording ) it automatically said it for him and along with all the other oped staff members ZanderMan9
     
  6. Offline

    ZanderMan9

    Hmm. Perhaps you can ask him about it if no one is willing to make this
     
  7. Offline

    GalaxyPrisonMc

    ZanderMan9 i already did he said it was custom and when i asked if maybe i could have it he said no, do you think you could make it...
     
  8. Offline

    ZanderMan9

    Let me tell you a little something about trying to code a bukkit plugin... No, on second thought, let me not release my frustrations here. I'm trying to get into making plugins, but it's been an... experience.
     
  9. Offline

    GalaxyPrisonMc

  10. Offline

    ZanderMan9

    Perhaps someone who has everything set up and some more experience could do this. There would need to be a permission for this, or a default to op, I know that much.
     
  11. Offline

    MCMatters

    ZanderMan9 Yeah i may code this

    ZanderMan9

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  12. Offline

    ZanderMan9

    Aha I see. Sorry :)
     
  13. Offline

    Geekxboy

    MCMatters
    I think using a permission would be better than a list in a config just so its easier to add players who will say the message
     
  14. Offline

    Flamedek

    GalaxyPrisonMc Here it is. It picks a random online staff member and sends the message for him.
    Staff members are defined with the permission "welcomemessage.staff", which defaults to ops.
    If there are no staff members online it will just do nothing.
    You can change the message in the config

    I didnt test it, but I'm pretty sure it should work
    Here you go..
    <Edit by Moderator: Redacted mediafire url>

    ZanderMan9 Here is the code, have a look. Hopefully you can learn something from it:

    Code:java
    1. public class Main extends JavaPlugin implements Listener {
    2.  
    3. public void onEnable() {
    4. getConfig().addDefault("message", "&eWelcome to the server <player>! Enjoy your stay =]");
    5. getConfig().options().copyDefaults(true);
    6. saveConfig();
    7. Bukkit.getServer().getPluginManager().registerEvents(this, this);
    8. }
    9.  
    10. @EventHandler
    11. public void onJoin(PlayerJoinEvent event) {
    12. Player newbie = event.getPlayer();
    13. if(newbie.hasPlayedBefore()) {return; }
    14.  
    15. List<Player> staff = new ArrayList<Player>();
    16. for(Player p : getServer().getOnlinePlayers()){
    17. if(p.hasPermission("welcomemessage.staff")) {
    18. staff.add(p);
    19. }
    20. }
    21. if(staff.isEmpty()) {return; }
    22.  
    23. int numberOfStaffMembers = staff.size();
    24. int random = (int) (Math.random() * numberOfStaffMembers + 1);
    25. Player staffMember = staff.get(random);
    26.  
    27. String message = ChatColor.translateAlternateColorCodes('&', getConfig().getString("message")).replaceAll("<player>", newbie.getName());
    28. staffMember.chat(message);
    29. }
    30.  
    31. }
     
    Last edited by a moderator: Nov 2, 2016
  15. Offline

    MCMatters

    Geekxboy ill do both features

    Never Mind

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  16. Offline

    GalaxyPrisonMc

    Flamedek do you think you could make it for anybody that has that permission to do it I'm only gonna give it toe
    And the other owner and a admin
     
  17. Offline

    timtower Administrator Administrator Moderator

    Based on the code, it should be doing that.
     
  18. Offline

    GalaxyPrisonMc

  19. Offline

    Flamedek

    timtower GalaxyPrisonMc
    Right now it should pick one staff member (random) and send it for that person. Just because I thought it would look way to fake if two people said the exact same thing at the same time.

    But I can add a second message to the config to choose from and send it for all online staff members if you want.
    And put a bit delay between them so its not as obviously fake
     
  20. Offline

    Silveridian

    I coded it, it's awaiting approval; tell me if it needs anything.
     
  21. Offline

    Flamedek

    GalaxyPrisonMc Looks like you have 2 to choose from now.
    Here is my new version. It will send a message for every online staff member with a random delay between 1 and 4 seconds.
    Also in the config you can now add as many messages as you want and it will pick a random one for every staff member. By default there are 2 messages but if you add like 10 the chanse that you will say the same thing is very small. To add more just follow the format of the others, just change the number 1 up.
    So for an extra message add at the bottom: 3: '&eYour message here <player>'

    I can't test this by myself properly so if you use it please let me know if there are problems, or not.
    <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 2, 2016
  22. Offline

    GalaxyPrisonMc

    Flamedek the second version works great thanks Il let you know if I find a bug or a glitch
     

Share This Page