[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

    LCastr0

    Oh cr**. I forgot to change in the console settings. Sorry :$
     
  2. Offline

    bigteddy98

    haha np hope it works now
     
    LCastr0 likes this.
  3. Offline

    LCastr0

    Playing a bit with deadmau5 :3
    [​IMG]

    #Edit
    Playing with Dinnerbone XD
    [​IMG]
    (I forgot to do F1...)
     
  4. Offline

    bigteddy98

    Haha that is awesome!

    Awesome! the fact that it's upside down makes it even more funny to work with :p

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  5. Offline

    KingFaris11

    I'm using v1.3 - I'll try 1.2.
     
  6. Offline

    BungeeTheCookie

    bigteddy98
    Using latest CraftBukkit. Still getting error at getOfflinePlayer().getUniqueID().
     
  7. Offline

    Jalau

    Does this work with Citizens? Or any idea how to make it work with cititzens?
     
  8. Offline

    bigteddy98

    That is very crazy, can you do this check for me?

    Import EntityCreeper and check if the 1.7_R3 import is the ONLY option.

    Also be sure you haven't multiple CB versions in your build path.
     
  9. Offline

    BungeeTheCookie

    Damn it, it was having CraftBukkit 1.6.4 in my build path. :mad:
    Edit: Re-added it, and its fixed! Thanks
     
  10. Offline

    bigteddy98

    okay that's great, if you still can't get it working feel free to ask ;)
     
  11. Offline

    Jalau

    Any idea?
    Code:
    java.lang.NoSuchMethodError: com.google.common.cache.CacheBuilder.maximumSize(J)Lcom/google/common/cache/CacheBuilder;
        at me.jalau.mysticrunes.PlayerDisplayModifier.<clinit>(PlayerDisplayModifier.java:60) ~[?:?]
        at me.jalau.mysticrunes.MysticRunes.onEnable(MysticRunes.java:313) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:250) ~[craftbukkit.jar:git-Bukkit-unknown]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:324) [craftbukkit.jar:git-Bukkit-unknown]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:404) [craftbukkit.jar:git-Bukkit-unknown]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.loadPlugin(CraftServer.java:448) [craftbukkit.jar:git-Bukkit-unknown]
        at org.bukkit.craftbukkit.v1_7_R3.CraftServer.enablePlugins(CraftServer.java:382) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.MinecraftServer.n(MinecraftServer.java:352) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.MinecraftServer.g(MinecraftServer.java:326) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.MinecraftServer.a(MinecraftServer.java:282) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.DedicatedServer.init(DedicatedServer.java:182) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.MinecraftServer.run(MinecraftServer.java:436) [craftbukkit.jar:git-Bukkit-unknown]
        at net.minecraft.server.v1_7_R3.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Bukkit-unknown]
    Also it's saying:
    The method get(String, Callable<? extends String>) in the type Cache<String,String> is not applicable for the arguments (String)
    at
    new JSONParser().parse(profileCache.get(skinOwner));
     
  12. Offline

    bigteddy98

    Which version are you using?
     
  13. Offline

    Jalau

    1.7.9
     
  14. Offline

    bigteddy98

    I ment the version of the class, 1.1, 1.2 or 1.3?
     
  15. Offline

    Jalau

  16. Offline

    bigteddy98

    That is Comphenix 's version, might be a problem in all versions but I think Comphenix could help you the best with this.
     
  17. Offline

    Gater12

    Amazing work!
     
  18. Offline

    bigteddy98

    Thanks my friend!
     
  19. Offline

    Jalau

    bigteddy98
    Can you add Citizens Support or does this work with citizens?
     
  20. Offline

    Comphenix

    Looks like you're using a more recent version of Guava than in CraftBukkit. Are you running a custom CraftBukkit fork, perhaps?

    Now, I've experienced this exact problem myself in ProtocolLib, which I solved by writing SafeCacheBuilder. Unfortunately, that returns a Map<String, String> instead of a wrapped Cache (I didn't need more than that), so it won't help you in this instance.

    Instead, you have a couple of options:
    • Disable caching altogether. Replace profileCache.get(skinOwner) with getProfileJson(skinOwner), and remove profileCache from the declaration altogether. The problem here is that you will request a GameProfile from Mojang's server for every modified player, for each player that is observing it.

      So - if player A, B and C have changed skin, and they're all within visible range of each other, then the Minecraft server will send two spawn entity packets to each player with the avatar of the other players (can occur multiple times too). If you don't cache game profiles, you'd actually fetch it for each spawn packet, or 3 * 2 = 6 times. This can really cause performance problems, and is not very nice on Mojang's server.

      It gets even worse if you have 50 modified players within range. That means 50 * 49 =2450 individual profile fetches, which you would really start to notice (Mojang certainly would). Thus, I can't recommend downgrading to version 1.2 either.
    • Write a simple cache using a synchronized LinkedHashMap that is wired up to remove the last accessed element (most stale) when the capacity of the map has exceeded 500 elements. This won't invalidate entries that are older than 4 hours, but that's better than adversely hitting the profile server ...
    • Consider if you must use a custom CraftBukkit fork that doesn't care about backwards compatibility. Or perhaps this fork has a flag to revert to Guava 11?
    Leaving aside changing the code, I'd try asking in the forum/IRC channel dedicated to your particular CraftBukkit fork.
     
    Jalau likes this.
  21. Offline

    KingFaris11

    Okay, so I'm using v1.2 (yours Teddy) and it works for most skins, but not some players I know. I tried Dewbious and it didn't work, nor did Terricks. It changes my skin to steve for a a split second, and then goes back to my normal skin. With Comphenix version (v1.3) it just doesn't work for most players, and doesn't work for online players.

    May I send you my SkinChanger full source code (both of you in one inbox) so you can look at the "changeskin" command? I commented out using Comphenix one to test v1.2, but it is still there. Also, "changename" works (Comphenix).
     
  22. Offline

    bigteddy98

    Sure, I have no idea why you're expecting these problems.
     
  23. Offline

    NerdsWBNerds

    This is sorcery
     
    KingFaris11 likes this.
  24. Offline

    silthus

    Is there a way to make this work for NPCs, too?
     
  25. Offline

    HelGod

    Yeah is there a way to make this work for NPCs?
     
  26. Offline

    Ultimate_n00b

    <3 updated my personal npc code with this. IS AMAZING. Notch is Jeb. Jeb is Notch. Dinnerbone is an item frame.
     
  27. Offline

    bigteddy98

    you could check out the resource made by lenis0012 for that.
     
  28. Offline

    LordVakar

    This is so cool xD
    I made a disguise plugin with this and I think I could implement this into a minigame too
     
  29. Offline

    Plugers11

    bigteddy98
    Main:

    Code:java
    1. public class Main extends JavaPlugin{
    2.  
    3. public static Main main;
    4.  
    5. public PlayerDisplayModifier factory;
    6.  
    7. public static Main getIn(){
    8. return main;
    9. }
    10.  
    11. public void onEnable(){
    12. main = this;
    13. zaladuj();
    14. }
    15.  
    16. public void onDisable(){
    17. zapCon();
    18. }
    19.  
    20. public void zapCon(){
    21. Config.save("hasla.yml");
    22. }
    23.  
    24. public void zaladuj(){
    25. zarejestrujConfig();
    26. zaladujKomendy();
    27. zalCon();
    28. zapCon();
    29. PluginManager pm = Bukkit.getPluginManager();
    30.  
    31. pm.registerEvents(new Glod(), this);
    32. pm.registerEvents(new Move(), this);
    33. pm.registerEvents(new Komenda(), this);
    34. pm.registerEvents(new Smierc(), this);
    35. pm.registerEvents(new FoodLevel(), this);
    36. pm.registerEvents(new Budowanie(), this);
    37. pm.registerEvents(new Niszczenie(), this);
    38. pm.registerEvents(new InteractLog(), this);
    39.  
    40. factory = new PlayerDisplayModifier(this);
    41. }
    42.  
    43. }
    44.  

    Command:

    Code:java
    1. public class Kom implements CommandExecutor{
    2.  
    3.  
    4. @Override
    5. public boolean onCommand(CommandSender s, Command c, String cc, String[] args) {
    6. if(s instanceof Player){
    7. if(c.getName().equalsIgnoreCase("pvp")){
    8. if(args.length == 2){
    9. Player p = (Player) s;
    10. if(args[0].equalsIgnoreCase("skin")){
    11.  
    12. Main.getIn().factory.changeDisplay(p, "skkf", "MrFajaPL");
    13. }
    14. }
    15. }
    16. }
    17. return false;
    18. }
    19.  
    20.  
    21.  
    22. }



    And not setting skin and name

    bigteddy98
    No errors
    Of course 1.7.9
    So ?

    bigteddy98
    You know how to do this ? :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 8, 2016
  30. Offline

    bigteddy98

    Which build? And I hope you're not running Spigot?
     
Thread Status:
Not open for further replies.

Share This Page