Cassiano_14

Untitled

Oct 9th, 2018
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.81 KB | None | 0 0
  1. package me.cassiano.minerador;
  2.  
  3. import java.lang.reflect.Field;
  4. import java.util.ArrayList;
  5. import java.util.Arrays;
  6. import java.util.List;
  7. import java.util.UUID;
  8.  
  9. import org.apache.commons.codec.binary.Base64;
  10. import org.bukkit.Bukkit;
  11. import org.bukkit.DyeColor;
  12. import org.bukkit.Material;
  13. import org.bukkit.SkullType;
  14. import org.bukkit.block.Jukebox;
  15. import org.bukkit.block.banner.Pattern;
  16. import org.bukkit.block.banner.PatternType;
  17. import org.bukkit.inventory.ItemStack;
  18. import org.bukkit.inventory.meta.BannerMeta;
  19. import org.bukkit.inventory.meta.ItemMeta;
  20. import org.bukkit.inventory.meta.SkullMeta;
  21. import org.bukkit.plugin.java.JavaPlugin;
  22.  
  23. import com.mojang.authlib.GameProfile;
  24. import com.mojang.authlib.properties.Property;
  25.  
  26.  
  27.  
  28.  
  29. @SuppressWarnings("unused")
  30. public class Main extends JavaPlugin {
  31.  
  32. public static Main plugin;
  33.  
  34.  
  35. @Override
  36. public void onEnable() {
  37. plugin = this;
  38.  
  39. Bukkit.getPluginManager().registerEvents(new Evento(), this);
  40.  
  41. getServer().getConsoleSender().sendMessage("§b[CassianoLoteria] §aCarregado com sucesso");
  42. }
  43. public static ItemStack bigorna()
  44. {
  45. ItemStack i = new ItemStack(Material.ANVIL, 1);
  46. ItemMeta m = i.getItemMeta();
  47.  
  48. ArrayList<String> lore = new ArrayList<String>();
  49. lore.add("§aTestando o pl do cassiano!");
  50. m.setLore(lore);
  51. i.setItemMeta(m);
  52.  
  53. return i; //Return the ItemStack 'i'
  54. }
  55. public static ItemStack pegarCabeca(String url) {
  56.  
  57. ItemStack skull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
  58.  
  59. if (url == null || url.isEmpty())
  60.  
  61. return skull;
  62.  
  63. SkullMeta skullMeta = (SkullMeta) skull.getItemMeta();
  64.  
  65. GameProfile profile = new GameProfile(UUID.randomUUID(), null);
  66.  
  67. byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", "http://textures.minecraft.net/texture/ddcc189633c789cb6d5e78d13a5043b26e7b40cdb7cfc4e23aa2279574967b4").getBytes());
  68.  
  69. profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
  70.  
  71. Field profileField = null;
  72. skullMeta.setDisplayName("§cMinerador ");
  73. skullMeta.setLore(Arrays.asList("", "§aClique com o botão §ldireito", "§ae pegue sua recompensa", ""));
  74. skull.setItemMeta(skullMeta);
  75.  
  76. try {
  77.  
  78. profileField = skullMeta.getClass().getDeclaredField("profile");
  79.  
  80. } catch (NoSuchFieldException | SecurityException e) {
  81.  
  82. e.printStackTrace();
  83.  
  84. }
  85.  
  86. profileField.setAccessible(true);
  87.  
  88. try {
  89. profileField.set(skullMeta, profile);
  90.  
  91. } catch (IllegalArgumentException | IllegalAccessException e) {
  92.  
  93. e.printStackTrace();
  94.  
  95. }
  96.  
  97. skull.setItemMeta(skullMeta);
  98.  
  99. return skull;
  100.  
  101. }
  102.  
  103. @Override
  104. public void onDisable() {
  105. getServer().getConsoleSender().sendMessage("§b[CassianoLoteria] §cDescarregado com sucesso");
  106. }
  107.  
  108.  
  109. }
Advertisement
Add Comment
Please, Sign In to add comment