Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.dpohvar.varscript.utils.minecraft;
- import net.minecraft.server.NBTTagCompound;
- import org.bukkit.craftbukkit.inventory.CraftItemStack;
- import org.bukkit.inventory.ItemStack;
- import java.nio.ByteBuffer;
- /**
- * Created by IntelliJ IDEA.
- * User: DPOH-VAR
- * Date: 10.08.12
- * Time: 22:35
- * To change this template use File | Settings | File Templates.
- */
- public class SkullEdit {
- public final ItemStack item;
- private NBTTagCompound tagData;
- public SkullEdit(ItemStack s){
- this.item = s;
- net.minecraft.server.ItemStack i = ((CraftItemStack) s).getHandle();
- if (i.tag == null) {
- tagData = new NBTTagCompound();
- i.tag = tagData;
- } else {
- tagData = i.tag;
- }
- }
- public String getOwner(){
- if (!tagData.hasKey("SkullOwner")) return null;
- return tagData.getString("SkullOwner");
- }
- public SkullEdit setOwner(String owner){
- if(owner==null)return removeOwner();
- tagData.setString("SkullOwner",owner);
- return this;
- }
- public SkullEdit removeOwner(){
- tagData.remove("SkullOwner");
- return this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement