mmoMinecraftDev / mmoCore

Required for mmoMinecraft plugins
http://forums.bukkit.org/threads/31054/
GNU General Public License v3.0
9 stars 3 forks source link

How do I set character chat colors #11

Closed Dockter closed 12 years ago

Dockter commented 12 years ago

Can you point me to the location in which I could find the location to modify certain people's chat colors (username) based on their group level set in group manager

Rycochet commented 12 years ago

Add a node to the mmoCore config file -

player_colors:
- group.admin=GOLD
- op=YELLOW
- some.other.permission=5
- yet.another=a

"op" is a special case, as is "default". The colours themselves either have to be the single digit colour code (lower case 0-9a-f) or the actual colour name from here - https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/ChatColor.java

Dockter commented 12 years ago

That didn't work.

I added this:

player_colors:

to mmoCore.yml, had zero affect.

Rycochet commented 12 years ago

Are you sure that you actually have a permission node "group.admin" that the player is a member of? It's not called something like "admin" ?

Dockter commented 12 years ago

Admin: default: false permissions:

This is the start of the Admin permission node, is it case sensative?

Rycochet commented 12 years ago

Probably - but there's definitely no "group." prefix - I tend to using all lower case for permissions just to be consistent ;-)

Dockter commented 12 years ago

So then mmo doesn't understand the Essentials Group manager permissions?

Rycochet commented 12 years ago

I'm not going to add support for half a dozen permissions plugins - so I only support built in SuperPerms (ie Bukkit Permissions) - all the permissions managers translate to that, but there's no group support, so you have to do things different ways.

Dockter commented 12 years ago

Is there a way to do a permanent override for specific usernames?

Dockter commented 12 years ago

Then do you mind if I modify it and use a custom version that can read Groupamanger permissions?

Rycochet commented 12 years ago

Feel free - it's why it's open source - if you want to push it back into the repo then feel free to send a pull request - I'm not against having it, purely against doing it ;-)

Dockter commented 12 years ago

Your code for mmoInfo is impressive, virtually impossible for me to follow at my stage of java knowledge.

I would have thought getting it to display Balance: (money) though iconomy would have been simple, HAHAHA

oceanor commented 12 years ago

http://dl.dropbox.com/u/25308568/mmoInfoGolds.jar

it's a very rude version, lightweight and NOT official.

it adds your money to the info bar using mmo.info.golds permission and {golds} as token. updates every two seconds when a player moves, i need to study java more to do better.

Dockter commented 12 years ago

Oceanor can I have the source code for that?

Is a Gem.

oceanor commented 12 years ago

i'm updating this plugin to update money value just one time and just when player's moneys changes.. then i'll post plugin to bukkitdev with source

Rycochet commented 12 years ago

Is it using Vault yet? Had a Register based version for quite a while, but it's impossible to build in Jenkins, so can't be properly maintained...

Dockter commented 12 years ago

Yes, its using Vault.

oceanor commented 12 years ago

oh well, if you want, here is the source code, and tomorrow i'll see what i can do.. i'm working on ocemanabar for now..

http://pastebin.com/s4ijMu8m

oceanor commented 12 years ago

remember it's a bad written and awful version, i had to count 20 ticks when player is moving to avoid too much useless money refresh.. i need to implement an update when money changes. The problem is I dont know if an event such that exists, neither in iconomy and or vault.. :)

Rycochet commented 12 years ago

I've setup the mmoInfoGold repo if you want to commit there - your pastebin is invalid btw :-P

oceanor commented 12 years ago

http://pastebin.com/SU7eKXPB oh god, what i've done! XD tomorrow i'll commit there! thanks!

Rycochet commented 12 years ago

mmoInfoGold now released, and I rewrote the code to be at most 1/tick, rather than 1/20th move - should stop things being too bad (no need for setDirty btw, it's automatic on change)...

Dockter commented 12 years ago

Tried using it, says mmoInfo was already loaded, I tried it without mmoinfo.jar and then a whole bunch of stuff failed.

oceanor commented 12 years ago

i'm trying this version now! i love to learn from examples instead of theories! ^^ tonight i'll read all changes :) :)

Rycochet commented 12 years ago

Sorry - changed everything except the plugin.yml - try again lol

oceanor commented 12 years ago

ps: we were speaking of mmochat, i've found a bug in it, simply the messages doesn't show in dynmap.. when channels were not working, this thing was working (awful english, late night and foreign language :P)

Rycochet commented 12 years ago

That's because it's probably watching the chat event - and mmoChat has got to totally replace that, unless I change the priority or something, it's not really something that can be fixed directly (as we provide personalised messages to every player, instead of a global message like most other chat plugins)

oceanor commented 12 years ago

uhm i cant understand how this new mmoinfo gold works.. when check returns to false? and how many checks it does in a second? 20? because i was using a version with 20 checks per second (and only onplayermove) and with 6 users online lag was like hell; disabling that version it all went ok (from 1.5/2s delay to 0)

Rycochet commented 12 years ago

onTick is called 20 times a second, I actually copied the code over from the Coords one - so it only changed when onPlayerMove was called... Just committed a change so it updates once a second - and it will only send an update to the player when the gold value actually changes...

Needs a formatting update, and options for setting what is shown...

Dockter commented 12 years ago

whats the new permissions / token for the yml?

I tried Rycochets version with mmo.info.golds and {golds} and it was ignored.

Rycochet commented 12 years ago

Lol - because it's mmoInfoGold, mmo.info.gold and {gold} - no "s" on the end :-P

oceanor commented 12 years ago

lol i'm hating mmoChat, the ChatAPI has a single, private, constructor and I can't create a plugin to bridge mmochat and dynmap, sending a standard message when a mmochat message is sent.. :(

trying with a reflection now :D

edit: my stupidity knows no bounds! I think i just need a customlistener to MMOChatEventAPI.. edit2: success! (noobish) +2 exp. you reached level 2 of 100! http://pastebin.com/rrygg3gi http://pastebin.com/2GFNiXxG

edit3: why with this plugin that bastard spam me 54 times every message? like this: http://pastebin.com/4mavJRXe :(

edit4: think i've understood, the message loops through mmochat listener and himself :P than i get kicked for spam..

Rycochet commented 12 years ago

You've got to remember that the mmoChat message is uniquely formatted to every player - so use a MONITOR listener, then just listen for the channels you want to forward on, and then push them into dynmap - you'd probably need a custom dynmap build, because there's no other way to do the chatting...

oceanor commented 12 years ago

lol sorry for using this page to ask, promise is last thing..

i've done a working version of the bridge, but is hacky as hell: http://pastebin.com/T9us1V7D commented rows are theorically much much better, but when someone write a message in chat, a NPE occurs:

java.lang.NullPointerException at me.oceanor.MMOChatDynmapBridge.MMOChatListener.onMMOChatEvent(MMOChatListener.java:24) at me.oceanor.MMOChatDynmapBridge.MMOChatListener.onCustomEvent(MMOChatListener.java:16)

Rycochet commented 12 years ago

Just had a look at the dynmap sources, and you should be able to do things a lot cleaner - and possibly get it as a Pull Request to them. Have a look at the HeroChat handler - around line 205: https://github.com/webbukkit/dynmap/blob/master/src/main/java/org/dynmap/herochat/HeroChatHandler.java#L205

It doesn't need any of the reflection stuff as we already provide the event, so I'd suggest using that instead.

Not sure where you're getting the NPE from, but can't see where that DynmapCommonAPI comes from either...