Chat Color Changing Plugin

Discussion in 'Archived: Plugin Requests' started by MacDev, Jun 28, 2014.

  1. Offline

    MacDev

    Hello.

    I have seen some servers use this plugin, but have not found it.

    It changes your chat color with the simple command /color

    For example you may do /color &a, and they now chat in that color, or they can change it and do /color &c, and they now chat in that color.

    If someone knows of this plugin, please post a link or download to it below.

    Details if someone is willing to code one like it:


    Name: ChatColor
    Commands:
    /color (displays the message: Usage: /color <color code> )
    /color <color code> : changes the color the players chat shows in to that color, so they can do /color &a and chat in light green until they change it.
    /color reset : resets their chat color to &f, white.
    /color <player> <color>: Changes the chat color of the specified player to the specified color code. Example: /color notch &a will make 'notch' chat in light green.

    Permissions:

    chatcolor.change - allows the user to change their chat color. default:eek:p
    chatcolor.reset - allows the user to reset their chat color. default: op
    chatcolor.others - allows the player to change other players chat color. default: op

    Thank you to anyone who could find a plugin similar to this or generously code one!
     
  2. Offline

    TheWolfBadger

    MacDev Done! <Edit by Moderator: Redacted mediafire url>
    EDIT:
    The permissions are chatcolor.change and chatcolor.others! To reset the chatcolor you just do /color &r :) Enjoy! - Jack
     
    Last edited by a moderator: Nov 2, 2016
    MacDev likes this.
  3. Offline

    MacDev

    TheWolfBadger

    Thank you so much for taking your time to make this! It works great!
     
    TheWolfBadger likes this.
  4. Offline

    TheWolfBadger

  5. TheWolfBadger
    I took a look at the source and I saw that it doesn't save the player's chat color. Perhaps MacDev would like something like that?
     
  6. Offline

    TheWolfBadger

    The Gaming Grunts Works the same. Apparently there is no way to actually make a ChatColor variable from a string even with translating alternate color codes. It still works none the less...
     
  7. Online

    timtower Administrator Administrator Moderator

    TheWolfBadger ChatColor is an enum, enums have names, names are strings, enums have a method valueOf, pretty much string->enum
     
  8. TheWolfBadger
    You could do something like this if you wanted:

    Code:java
    1. getConfig().set("some.path", "&4");


    Depends on how you want to do it. You could do it with MySQL if you wanted, for example

    PHP:
    UPDATE sometable SET color='&4' WHERE player='someplayer';
     
  9. Offline

    TheWolfBadger

    timtower How would you store it in a HashMap though?
     
  10. Online

    timtower Administrator Administrator Moderator

    TheWolfBadger this.getConfig().set(uuid.toString(),chatcolor.name())
     
  11. Offline

    TheWolfBadger

    timtower So how do you get ChatColor from a string? There is no method for it.
     
  12. Online

    timtower Administrator Administrator Moderator

  13. Offline

    TheWolfBadger

    timtower I'll try that out. Tell you how it goes.

    timtower The Gaming Grunts MacDev Ahh fixed! More efficient now!
    <Edit by Moderator: Redacted mediafire url>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
  14. Offline

    KenoVincent

    TheWolfBadger what causes these errors?

    Code:java
    1. org.bukkit.command.CommandException: Unhandled exception executing command 'color' in plugin ChatColour v1.0
    2. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    3. at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:180) ~[craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    4. at org.bukkit.craftbukkit.v1_7_R3.CraftServer.dispatchCommand(CraftServer.java:742) ~[craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    5. at net.minecraft.server.v1_7_R3.PlayerConnection.handleCommand(PlayerConnection.java:956) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    6. at net.minecraft.server.v1_7_R3.PlayerConnection.a(PlayerConnection.java:817) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    7. at net.minecraft.server.v1_7_R3.PacketPlayInChat.a(PacketPlayInChat.java:28) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    8. at net.minecraft.server.v1_7_R3.PacketPlayInChat.handle(PacketPlayInChat.java:47) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    9. at net.minecraft.server.v1_7_R3.NetworkManager.a(NetworkManager.java:157) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    10. at net.minecraft.server.v1_7_R3.ServerConnection.c(SourceFile:134) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    11. at net.minecraft.server.v1_7_R3.MinecraftServer.v(MinecraftServer.java:667) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    12. at net.minecraft.server.v1_7_R3.DedicatedServer.v(DedicatedServer.java:260) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    13. at net.minecraft.server.v1_7_R3.MinecraftServer.u(MinecraftServer.java:558) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    14. at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:469) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    15. at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    16. Caused by: java.lang.IllegalArgumentException: No enum constant org.bukkit.ChatColor.&5
    17. at java.lang.Enum.valueOf(Unknown Source) ~[?:1.7.0_60]
    18. at org.bukkit.ChatColor.valueOf(ChatColor.java:13) ~[craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    19. at com.core.wolfbadger.chat.colour.enjoy.Main.onCommand(Main.java:46) ~[?:?]
    20. at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[craft.jar:git-Bukkit-1.7.9-R0.2-10-ge6cd8c0-b3096jnks]
    21. ... 13 more
     
  15. Offline

    TheWolfBadger

    KenoVincent Try <Edit by Moderator: Redacted mediafire url>
     
    Last edited by a moderator: Nov 2, 2016
    KenoVincent likes this.
  16. Offline

    KenoVincent

    TheWolfBadger currently it does'nt creat errors anymore but when I tried to chat still no colors and the "&" are presented with the chat..
     
  17. Offline

    CGA1123

    TheWolfBadger
    Code:
    e.setMessage((String)this.cManager.get(p.getUniqueId()) + "" + e.getMessage());
    here you are just appending the message to the String you get from your map.
    you should do:
    Code:
    e.setMessage(ChatColor.translateAlternateColorCodes('&',(String)this.cManager.get(p.getUniqueId()) + "" + e.getMessage()));
    Also you are still not saving anything to the config.

    EDIT: Actually this is a bad idea, as it will allow players to use color codes within their messages, which is not what was wanted I think...
     
    KenoVincent likes this.
  18. Offline

    TheWolfBadger

    CGA1123 Oh actually it's bc I tried to change the hashmap to store color codes and it didn't work so I reverted, but I forgot to revert that code back to it's original... Sorry KenoVincent. I will fix when I am on my computer though :)!

    <Edit by Moderator: Redacted mediafire url>

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Nov 2, 2016
    MacDev, CGA1123 and KenoVincent like this.
  19. Offline

    KenoVincent

    MacDev and TheWolfBadger like this.

Share This Page