Plugin category: Chat Related Suggested name: LevelChat What I want: I'd like this plugin to simply add a prefix in front of the player name in Chat, showing XP Level. For example, if someone is level 8, in chat it'd say: [Lvl 8] exampledude: Yay I'm level 8! Ideas for commands: None needed. Ideas for permissions: None needed. When I'd like it by: As soon as possible. Thanks in Advance!
[quote uid=90931043 name="hassansyyid" post=2434723]Plugin category: <font color="#555555">Chat Related</font> Suggested name: LevelChat What I want: I'd like this plugin to simply add a prefix in front of the player name in Chat, showing XP Level. For example, if someone is level 8, in chat it'd say: [Lvl 8] exampledude: Yay I'm level 8! Ideas for commands: None needed. Ideas for permissions: None needed. When I'd like it by: As soon as possible. Thanks in Advance![/quote] I got this one sec [quote uid=90931043 name="hassansyyid" post=2434723]Plugin category: <font color="#555555">Chat Related</font> Suggested name: LevelChat What I want: I'd like this plugin to simply add a prefix in front of the player name in Chat, showing XP Level. For example, if someone is level 8, in chat it'd say: [Lvl 8] exampledude: Yay I'm level 8! Ideas for commands: None needed. Ideas for permissions: None needed. When I'd like it by: As soon as possible. Thanks in Advance![/quote] <Edit by Moderator: Redacted mediafire url> EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Onlineids hassansyyid That's very complicated. Instead, use playerLevelChangeEvent and PlayerJoinEvent. Much easier, and much less expensive
[quote uid=90896908 name="DotDash" post=2434734]So just in chat? No where else?[/quote] Yup [quote uid=90875889 name="Onlineids" post=2434807]<Edit by Moderator: Redacted mediafire url> Hi thanks for the fast response! This didn't work correctly: When I used /gamemode it did show the level: Gamemode set to survival for [Level 190] HassanS6000 But in chat nothing happened: HassanS6000: This plugin didn't work fully Could you try fixing it please? Thanks so much already! EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Onlineids Even better. You used PlayerMoveEvent. That gets called exponentially for every player online. Just use PlayerLevelChangeEvent. btw, what would not using AsyncPlayerChatEvent have done for you? You make it sound like using it was bad
Finished, uploading now... Tell me if you want a different color. Download: https://www.dropbox.com/s/3t7k6w34mqdsulj/LevelPrefix.jar Source Code: http://pastebin.com/PAuAVrMW
Thanks! Thanks for the fast response! Everything is great.. however when a player chats now, the message isn't shown. For example, a player pushes "t" and writes something, the output is: [190] HassanS6000 As shown above, none of the message text is shown. Could you try figuring out what's wrong, and how you could possibly fix it? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
DotDash You forgot to get the player's message. e.getMessage(); Code:java @EventHandlerpublic void onChat(AsyncPlayerChatEvent e) {Player p = e.getPlayer();int plvl = p.getLevel();e.setFormat(ChatColor.DARK_PURPLE + "[" + plvl + "] " + ChatColor.RESET + p.getDisplayName() + ": " + e.getMessage());}} hassansyyid Well, so you don't have to wait here you go. https://www.dropbox.com/s/uome8fe1ifr6zu9/LevelChat.jar Full code goes to DotDash I just changed the color of the prefix to Green and I set the messages. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
DotDash e1kfws7 setFormat has 2 format values that the server will modify after the monitor eventpriority. No need to hardcode the playername or the message in it. %s twice, first one will be the displayname, second one the message.