Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.cassiano.minerador;
- import java.lang.reflect.Field;
- import java.util.ArrayList;
- import java.util.Arrays;
- import java.util.List;
- import java.util.UUID;
- import org.apache.commons.codec.binary.Base64;
- import org.bukkit.Bukkit;
- import org.bukkit.DyeColor;
- import org.bukkit.Material;
- import org.bukkit.SkullType;
- import org.bukkit.block.Jukebox;
- import org.bukkit.block.banner.Pattern;
- import org.bukkit.block.banner.PatternType;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.BannerMeta;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.inventory.meta.SkullMeta;
- import org.bukkit.plugin.java.JavaPlugin;
- import com.mojang.authlib.GameProfile;
- import com.mojang.authlib.properties.Property;
- @SuppressWarnings("unused")
- public class Main extends JavaPlugin {
- public static Main plugin;
- @Override
- public void onEnable() {
- plugin = this;
- Bukkit.getPluginManager().registerEvents(new Evento(), this);
- getServer().getConsoleSender().sendMessage("§b[CassianoLoteria] §aCarregado com sucesso");
- }
- public static ItemStack bigorna()
- {
- ItemStack i = new ItemStack(Material.ANVIL, 1);
- ItemMeta m = i.getItemMeta();
- ArrayList<String> lore = new ArrayList<String>();
- lore.add("§aTestando o pl do cassiano!");
- m.setLore(lore);
- i.setItemMeta(m);
- return i; //Return the ItemStack 'i'
- }
- public static ItemStack pegarCabeca(String url) {
- ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
- if (url == null || url.isEmpty())
- return skull;
- SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
- GameProfile profile = new GameProfile(UUID.randomUUID(), null);
- byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", "http://textures.minecraft.net/texture/ddcc189633c789cb6d5e78d13a5043b26e7b40cdb7cfc4e23aa2279574967b4").getBytes());
- profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
- Field profileField = null;
- skullMeta.setDisplayName("§cMinerador ");
- skullMeta.setLore(Arrays.asList("", "§aClique com o botão §ldireito", "§ae pegue sua recompensa", ""));
- skull.setItemMeta(skullMeta);
- try {
- profileField = skullMeta.getClass().getDeclaredField("profile");
- } catch (NoSuchFieldException | SecurityException e) {
- e.printStackTrace();
- }
- profileField.setAccessible(true);
- try {
- profileField.set(skullMeta, profile);
- } catch (IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- }
- skull.setItemMeta(skullMeta);
- return skull;
- }
- @Override
- public void onDisable() {
- getServer().getConsoleSender().sendMessage("§b[CassianoLoteria] §cDescarregado com sucesso");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment