org.bukkit.material.SkullItem Maven / Gradle / Ivy
package org.bukkit.material;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import walkmc.extensions.ItemsKt;
public class SkullItem extends MaterialData {
private String url = "";
public SkullItem() {
super(Material.SKULL_ITEM);
}
public SkullItem(String url) {
super(Material.SKULL_ITEM);
this.url = url;
}
public SkullItem(int type) {
super(type);
}
public SkullItem(Material type) {
super(type);
}
public SkullItem(int type, byte data) {
super(type, data);
}
public SkullItem(Material type, byte data) {
super(type, data);
}
/**
* Gets the url of this skull, if this skull is a player skull.
*
* @return the url data of this skull
*/
public String getUrl() {
return url;
}
/**
* Sets the url of this skull, if this skull is a player skull.
*
* @param url the new url of this skull
*/
public void setUrl(String url) {
this.url = url;
}
@Override
public ItemStack toItemStack() {
return toItemStack(1);
}
@Override
public ItemStack toItemStack(int amount) {
return url.isEmpty() ? super.toItemStack(amount) : ItemsKt.newHead(url, amount);
}
@Override
public String toString() {
return super.toString() + " url " + url;
}
@Override
public SkullItem clone() {
return (SkullItem) super.clone();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy