[Class] Change the skin of a player without changing the name, yes it's possible! [NO SPOUT]

Discussion in 'Resources' started by bigteddy98, May 28, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Plugers11

    bigteddy98
    No i'm not on spigot
    I'm on craftbukkit
    latest version
    emm

    1.7.9 R03
     
  2. Offline

    Comphenix

    Are you sure changeDisplay() is actually executed? Try adding a print statement with a specific message after that line, and see if you get that message in the console.

    By the way, are you running in offline mode?
     
  3. Offline

    Plugers11

  4. Offline

    Comphenix

    It doesn't support offline servers, unfortunately. That can be rectified, but it would be against the forum policy to post that here.

    Then it's probably not executed properly. Add a bunch of calls to System.out.println(String) and see if things gets executed.

    Also, it doesn't look like the class Kom is actually registered as an executor, at least from the code you've posted. You must do that in order for it to be executed.
     
  5. Offline

    BenRush

    it is possible to make skin by url?
     
  6. It's actually possible to do it by url, if you add a url --> image converter in the method.
    Nope, as it gets the skin by the UUID.
    And also for some reason it doesn't work for me. I tried version 1.3 and 1.2, and it still doesn't work. I might try 1.1. Tried it, doesn't work neither.
     
  7. Offline

    defineci00

  8. Offline

    FightManiac

    I know other people will see the new skin if i'll change it, but will it change for me?
     
  9. Offline

    Comphenix

    In order to do that, you'd have your actual player avatar invisible, and then spawn a new player entity with the correct skin and name, while synchronizing its position and actions.

    Unfortunately, this is not ideal for players with a relatively high ping, as the displayed action or movement is now subject to the intrinsic latency between the server and the client.

    Interesting. Could you add ProtocolLib to your server and type the following command:
    Code:
    /packet add play server named_entity_spawn
    Then you should be able to see what is transmitted to the clients.

    By the way, are they using Minecraft 1.7.9?
     
  10. Offline

    defineci00

    I fixed it, wrong imports. And sorry ,my fault. I wish you continued success. :)
     
  11. Offline

    RamonSGomes

    bigteddy98

    Hey, I'm using version 1.3 of your resource (yes, I'm using CB 1.7.9 and it's online mode server), but when I use a command to change a player's skin and name, every online player gets DC and when they try to re-login they got this message: "Internal Exception: net.minecraft.util.io.netty.handler.codec.EncoderException: java.lang.RuntimeException: An internal error occured." And there's no error on the console.

    That's really strange, cause it was working before and I don't really remember changing any thing related to this on my plugin.

    Can you help me?
     
  12. Offline

    RamonSGomes

    Someone could help me?
     
  13. Offline

    Deleted user

    bigteddy98
    Still works?

    Also, is this backwards?

    Code:
    else {
      profile.getProperties().put(name, new Property(value, name));
    }
    
     
  14. RamonSGomes
    This solved my problem.
     
  15. Offline

    podpage

  16. Offline

    Skyost

    [​IMG]
     
    bobacadodl and LCastr0 like this.
  17. Offline

    shohouku

    I'm getting an error when I try to change my skin on PlayerJoinEvent. I'm not using a scheduler btw.


    Code:java
    1. [18:10:55 ERROR]: Could not pass event PlayerJoinEvent to Spawn v0.1
    2. org.bukkit.event.EventException
    3. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    4. va:294) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    5. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    6. a:62) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    7. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    8. ava:501) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    9. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    10. ava:486) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    11. at net.minecraft.server.v1_7_R4.PlayerList.c(PlayerList.java:251) [craft
    12. bukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    13. at net.minecraft.server.v1_7_R4.PlayerList.a(PlayerList.java:138) [craft
    14. bukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    15. at net.minecraft.server.v1_7_R4.LoginListener.c(LoginListener.java:76) [
    16. craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    17. at net.minecraft.server.v1_7_R4.LoginListener.a(LoginListener.java:42) [
    18. craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    19. at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:160
    20. ) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    21. at net.minecraft.server.v1_7_R4.ServerConnection.c(SourceFile:134) [craf
    22. tbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    23. at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:6
    24. 67) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    25. at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:2
    26. 58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    27. at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:5
    28. 58) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    29. at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java
    30. :469) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    31. at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:6
    32. 28) [craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    33. Caused by: java.lang.IllegalArgumentException: Cannot find entity trackers for C
    34. raftPlayer{name=TeamPenis}.
    35. at com.comphenix.protocol.injector.EntityUtilities.getEntityTrackers(Ent
    36. ityUtilities.java:136) ~[?:?]
    37. at com.comphenix.protocol.injector.PacketFilterManager.getEntityTrackers
    38. (PacketFilterManager.java:923) ~[?:?]
    39. at plugin.PlayerDisplayModifier.refreshPlayer(PlayerDisplayModifier.java
    40. :195) ~[?:?]
    41. at plugin.PlayerDisplayModifier.refreshPlayer(PlayerDisplayModifier.java
    42. :189) ~[?:?]
    43. at plugin.PlayerDisplayModifier.changeDisplay(PlayerDisplayModifier.java
    44. :157) ~[?:?]
    45. at plugin.spawning.onJoin(spawning.java:291) ~[?:?]
    46. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0
    47. _51]
    48. at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0
    49. _51]
    50. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1
    51. .7.0_51]
    52. at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_51]
    53. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    54. va:292) ~[craftbukkit.jar:git-Bukkit-1.7.9-R0.2-16-g37c7969-b3105jnks]
    55. ... 14 more
     
  18. Offline

    MiniDigger

    nice name you have there ^^
    But to your question, seems like ProtocolLib can't find an tracker for you. Looks like an protocollib problem. (Is it working correctly?)
     
    Skyost likes this.
  19. Offline

    Skyost

    MiniDigger It happens to me too. Maybe schedule it and run it 3 seconds later ?
     
  20. Offline

    MiniDigger

    Skyost likes this.
  21. Offline

    Tice

    I seem to be getting an issue here:
    Code:java
    1. WrappedGameProfile result = new WrappedGameProfile(
    2. extractUUID(original.getName()),
    3. displayName != null ? displayName : original.getName()
    4. );

    Apparently, UUID cannot be applied to String. I don't know, am I being a complete noob here? My IntellIj is refusing to build with this error, so, I need a fix, please!
     
  22. Offline

    bennie3211

    toString()?
     
  23. Offline

    bigteddy98

    UPDATE
    As you might have noticed, these classes have a few bugs.

    As you might know Mojang has put a maximum of 1 UUID request per minute on their UUID database. Because your server itself sends a request on-login, you won't be able to change the skin within the first minute after login. After you have done 1 request, I highly advise you to cache the result, because you won't be able to resend a request within a minute.

    I am working on a new, better working version, which should be able handle these problems. I hope I have given you enough information about the problems with these classes now,

    BigTeddy98,
    Sander.
     
    rbrick and Skyost like this.
  24. Offline

    ChipDev

    Oooohhh :eek:
     
  25. Offline

    xMalwarez

    Don't work for me.
    Code:java
    1. public void onEnable()
    2. {
    3. PlayerDisplayModifier factory;
    4. factory = new PlayerDisplayModifier(this);
    5. factory.changeDisplay("xMalware", "Dinnerbone", "Any name here");
    6. }
     
  26. Offline

    wiedzmin137

    Hello. I have error with JSON cache getting. http://pastebin.com/cGsjp0YJ

    Code:java
    1. JSONObject json = (JSONObject) new JSONParser().parse(profileCache.get(skinOwner));
     
  27. Offline

    xJeremyCx

    bigteddy98
    Hello. For some reason I am getting NullPointerException when using your class? I am using v1.3 and I get that error at
    protocolManager.getAsynchronousManager().registerAsyncHandler(
    this line. I am using the latest version of CraftBukkit(1_7_R4) with latest version of ProtocolLib.
     
  28. Offline

    steffansk1997

    I just get a bunch of errors when using this, someone who can help me?
    Show Spoiler
    Show Spoiler
    05.11 08:48:38 [Server] INFO ... 14 more
    05.11 08:48:38 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:298) ~[spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67]
    05.11 08:48:38 [Server] INFO at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    05.11 08:48:38 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67]
    05.11 08:48:38 [Server] INFO at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67]
    05.11 08:48:38 [Server] INFO at me.steffansk1997.AthosEngine.AthosEngine.onJoin(AthosEngine.java:397) ~[?:?]
    05.11 08:48:38 [Server] INFO at me.steffansk1997.AthosEngine.AthosEngine.setTag(AthosEngine.java:402) ~[?:?]
    05.11 08:48:38 [Server] INFO at me.steffansk1997.AthosEngine.PlayerDisplayModifier.changeDisplay(PlayerDisplayModifier.java:149) ~[?:?]
    05.11 08:48:38 [Server] INFO at me.steffansk1997.AthosEngine.PlayerDisplayModifier.refreshPlayer(PlayerDisplayModifier.java:192) ~[?:?]
    05.11 08:48:38 [Server] INFO at com.comphenix.protocol.injector.PacketFilterManager.getEntityTrackers(PacketFilterManager.java:923) ~[?:?]
    05.11 08:48:38 [Server] INFO at com.comphenix.protocol.injector.EntityUtilities.getEntityTrackers(EntityUtilities.java:136) ~[?:?]
    05.11 08:48:38 [Server] INFO Caused by: java.lang.IllegalArgumentException: Cannot find entity trackers for CraftPlayer{name=steffansk1997}.
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:289) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:734) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.ServerConnection.c(ServerConnection.java:81) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.NetworkManager.a(NetworkManager.java:189) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.LoginListener.a(LoginListener.java:44) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.LoginListener.c(LoginListener.java:119) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerList.a(PlayerList.java:152) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at net.minecraft.server.v1_7_R4.PlayerList.c(PlayerList.java:265) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:494) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:509) [spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[spigot.jar:git-Spigot-1.7.9-R0.2-207-g03373bb]
    05.11 08:48:38 [Server] INFO org.bukkit.event.EventException
    05.11 08:48:38 [Server] ERROR Could not pass event PlayerJoinEvent to AthosEngine v1.3.1

    Solved using a delay on the onjoin function

    new problem
    05.11 14:41:02 [Server] INFO Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Server returned HTTP response code: 429 for URL: https://sessionserver.mojang.com/session/minecraft/profile/e60c1a1322184c46a4d6d48bed1b2fb0
    That's the error I get, I use protocollib 3.4
    Code:java
    1. @EventHandler
    2. public void onJoin(PlayerJoinEvent event){
    3. Player player = event.getPlayer();
    4. mm.setChannel(player, "RP");
    5. setTag(player, mm.getChannel(player), mm.getRace(player), mm.getName(player));
    6. }
    7. public void setTag(Player player, String Channel, String race, String name){
    8. factory = new PlayerDisplayModifier(this);
    9. if(Channel.equalsIgnoreCase("RP")){
    10. if(name.length() <= 16){
    11. factory.changeDisplay(player, player.getName(), name);
    12. NametagAPI.updateNametagHard(player.getName(), getRaceColour(race) + "", "");
    13. }else if(name.length() > 16 && name.length() <= 30){
    14. NametagAPI.updateNametagHard(player.getName(), getRaceColour(race) + name.substring(0, name.length() - 17), "");
    15. factory.changeDisplay(player, player.getName(), name.substring(name.length() - 16));
    16. }else if(name.length() <= 46 && name.length() > 30){
    17. NametagAPI.updateNametagHard(player.getName(), getRaceColour(race) + name.substring(0, 13), name.substring(30));
    18. factory.changeDisplay(player, player.getName(), name.substring(14, 29));
    19. }else{
    20. NametagAPI.updateNametagHard(player.getName(), getRaceColour(race) + name.substring(0, 13), name.substring(30, 45));
    21. factory.changeDisplay(player, player.getName(), name.substring(14, 29));
    22. }
    23. }else{
    24. NametagAPI.updateNametagHard(player.getName(), "[" + ChatColor.GRAY, ChatColor.WHITE + "]");
    25. factory.changeDisplay(player, player.getName(), player.getName());
    26. }
    27. }

    That's my function, can someone tell me what I am doing wrong here?
     
  29. Offline

    MiniDigger

    steffansk1997 the session server blocked your connection because you have connected to much in a to little time. (HTTP code 429)
     
  30. Offline

    timtower Administrator Administrator Moderator

    Locked per request.
     
Thread Status:
Not open for further replies.

Share This Page