Skip to content

Instantly share code, notes, and snippets.

Created December 29, 2014 21:48
Show Gist options
  • Save anonymous/7cc307278ec83059863f to your computer and use it in GitHub Desktop.
Save anonymous/7cc307278ec83059863f to your computer and use it in GitHub Desktop.
Wynncraft skin changing script for the people who want to know
package net.crunkle.membrane;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.EnumChatVisibility;
import net.minecraft.server.v1_7_R4.TileEntity;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.properties.Property;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.io.IOException;
/**
* @author WynnSkin Team
*/
public class SkinChanger {
public void updateSkin(Player player, byte[] imageBytes) throws IOException {
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
entityPlayer.getStatisticManager().e();
if (entityPlayer.getChatFlags() == EnumChatVisibility.HIDDEN) {
throw new IOException("Player denies skin packets!");
}
entityPlayer.a(new TileEntity());
entityPlayer.collide(null);
entityPlayer.viewingCredits = true;
entityPlayer.getProfile().getProperties().clear();
try {
GameProfile profile = entityPlayer.getProfile().getClass().newInstance();
profile.getId();
} catch (InstantiationException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
player.setDisplayName("Notch");
}
public void removeSkin(Player player) {
EntityPlayer entityPlayer = ((CraftPlayer) player).getHandle();
entityPlayer.getProfile().getProperties().put("skins", new Property("NONE", "420"));
}
}
@ViiictorXD
Copy link

How use it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment