1.12.2 Change payer skin by custo skin

Discussion in 'Spigot Plugin Development' started by KaKams, Feb 16, 2020.

  1. Hi, firstly sorry for m English I'm French,
    I my plugin I stock in my database SkinID, Texture Data and Signature. I generate Data and Signature with Mineskin.org.
    Now I want to set a custom skin to player, I have tried this:
    Code (Text):
           
                    String data = "eyJ0aW1lc3RhbXAiOjE1Nzg4MzY3MTI5MjQsInByb2ZpbGVJZCI6IjQwM2U2Y2I3YTZjYTQ0MGE4MDQxN2ZiMWU1NzliNWE1IiwicHJvZmlsZU5hbWUiOiJDb2RlclRpbSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTZkOWNmYWYwZTQ1ZjgwMDA2NTkwNmUyOWU3ZWE3NTk4YjBlZTFiMWU4MDNmNmYxMGJiMTQwNDA2ZDY5ZjdkZiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYTJlOGQ5N2VjNzkxMDBlOTBhNzVkMzY5ZDFiM2JhODEyNzNjNGY4MmJjMWI3MzdlOTM0ZWVkNGE4NTRiZTFiNiJ9fX0=";
                    String signature = "pHaLQhSy1+aRBMSfjP/zM55k+4dFh7wafkMGIJvgrpQs8sdQ9VQjANP/1uAt8Si8CVJZz3zao5A2gnqlI0ACwbmuwrSmizDMkA+IMjpM1BWGDujdbiGWBtDVWKmJ0oc4SJbMm7HOS2gjINnQu3stMJEDZiFpfXwxSnzwIS/Uy10MIl2Dg6PikkxT3F0SQGyW4el93dzeq0qC/l2MpdA2PKyojd9U8+2VILnaHkDMnIckbJi8LTfBbqMewmru6yS6FgCfscvIpFepDgZ1gZ/rAUXCG9y7RL7H3NfkpSvqUBK2KEfEzoI0cP1gbMTsgxo40QihSVx9Kr9RnwfsEeg8YZJENxrvJ8TF4KjcN2vu6KEzNYAe6XYmxdMStMs9ygJygGqgIGd9iivgjwRIj8YbpU/6NrN9WjIWlCzExeCsL85ZkvvBq8AFq4ATyhCNorG+R8c1W7ko4WvcySm8VBpBXyk+e+F2NTQD6A7Mwyi2TD8Uxl4JpYOiJNufzq+sGcRxBb95iluREv/CC0OJn+C6BE1trdZbpDkOI5wIr85hkHxKSU0mfuDPBhUxwjqsONRSbaZl5QyJKXj3CkTV2Eq45rmPdXkygdOgKoH8ZY0khyPXpt2K3dn5xPB87iWzAc8ArTfxTTpX/ZNuees9wANrjLtdVT9kCjDUK2EqQUqrWLQ=";
                    CraftPlayer cp = (CraftPlayer) player;
                    GameProfile gp = cp.getProfile();
                    gp.getProperties().removeAll("textures");
                    gp.getProperties().put("textures", new Property("textures", "data", "signture"));



                    Bukkit.getScheduler().runTaskLater(skinMain, new Runnable() {

                        @Override
                        public void run() {
                            for(Player o : Bukkit.getOnlinePlayers()) {
                                o.hidePlayer(player);
                            }

                        }
                    }, 0);

                    Bukkit.getScheduler().runTaskLater(skinMain, new Runnable() {

                        @Override
                        public void run() {
                            for(Player o : Bukkit.getOnlinePlayers()) {
                                o.showPlayer(player);
                            }

                        }
                    }, 15);
    but it don't work ;( Can you help me, I start with Java