Created
December 29, 2014 21:48
-
-
Save anonymous/7cc307278ec83059863f to your computer and use it in GitHub Desktop.
Wynncraft skin changing script for the people who want to know
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How use it?