Forked from anonymous/WynncraftSkinChangerScript.java
Last active
August 29, 2015 14:23
-
-
Save codebucketdev/67154bdc53c580662cd6 to your computer and use it in GitHub Desktop.
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