i looking for a plugin that plugin is nick for youtubers that any youtuber can do command only /nick on and in the plugin folder will be nick.txt and i have to but in nick.txt nicks that will taken by youtuber by random like dsa5 das4 fas1 fas2 fas3 when youtuber type /nick on the plugin take a random names from that names and taked it to the youtuber premissions ; premissions.nickyt for ; 1.8.x when the youtuber type the command /nick on message wiill appers to him in the chat ; your name was oldname and now he is (the new random name) ! and if he type /nick off his nick come back to the old and message in the chat your name has been returned ! if any one try to type the command without premissions the message is only youtubers have permissions to do that ! and the nick will be random every time he do /nick on and they cant be 2 players with the same nick and the youtuber cant change his nick as he want if he type /nick {nick the youtuber want } he get a message you cant select your nick just /nick on ! i wish i didn't forget any thing but the important thing is all messages from commands i can change him from the plugin file and thanks all ;d
but it have a another things i didnt wont like a custom nick and custom skins and and and i need basic and easy plugin
(Slightly offtopic) Well this is a nice idea, but honestly I wouldn't know how to change someone's name efficiently. I am aware of methods setDisplayName() and setListName() etc., but that's not quite enough. Also, there is a problem with reflection or packet altering as during those versions packets and field names were changed, so that wouldn't be quite universal solution. Anyone more experienced knows how to universally implement name changing method so it's compatible among large scale of versions? (I've decompiled some CB APIs to take a look into it, so probably a solution would be for every version implement different method, but that's a lot of work + I'm not sure of all the changes that were made by devs back then) Code: private synchronized static <T> void changePlayerName(T player, String name) { // TODO: insert universal implementation }
I've never really known what the built in setDisplayName() and setListName() do anyway... Why do you say they wouldn't work?
Well so far as I have figured out, the setListName() only affects the [Tab] list of players and setDisplayName() only sets kind of nickname in chat or something like that. None of those methods seem to do anything with actual name (like changing player's name Tag etc.)
@katheryn I think I managed to make the plugin compatible for all versions from 1.8.0 above. Here is your plugin. I didn't test it much for permissions and configurations and for larger amount of players, so if it's faulty, let me know! Also, don't use names over 16 characters long. + There is color support. For anyone interested about the name changing: I did use reflection, but invoked methods to avoid using: - version based locations (server, craftbukkit) - weird-named fields that might got renamed Code: private synchronized void changeName(String newname, Player player) { player.setDisplayName(newname); player.setPlayerListName(newname); try{ Method getHandle = player.getClass().getMethod("getHandle"); Object handleResult = getHandle.invoke(player); Method getProfile = getHandle.invoke(player).getClass().getMethod("getProfile"); GameProfile profile = (GameProfile) getProfile.invoke(handleResult); Field f = profile.getClass().getDeclaredField("name"); f.setAccessible(true); Field modifiers = Field.class.getDeclaredField("modifiers"); modifiers.setAccessible(true); modifiers.setInt(f, (~Modifier.FINAL) & f.getModifiers()); f.set(profile, newname); for(Player p : getServer().getOnlinePlayers()){ p.hidePlayer(player); } Thread.sleep(100); // sloppy for(Player p : getServer().getOnlinePlayers()){ p.showPlayer(player); } }catch(Exception e){ e.printStackTrace(); } }