Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 27.29 KB | None | 0 0
  1. package me.paauum.holly.add.eventosecomandos;
  2.  
  3. import java.util.Arrays;
  4. import java.util.ArrayList;
  5.  
  6. import org.bukkit.Bukkit;
  7. import org.bukkit.Material;
  8. import org.bukkit.Sound;
  9. import org.bukkit.command.Command;
  10. import org.bukkit.command.CommandExecutor;
  11. import org.bukkit.command.CommandSender;
  12. import org.bukkit.enchantments.Enchantment;
  13. import org.bukkit.entity.Player;
  14. import org.bukkit.event.EventHandler;
  15. import org.bukkit.event.Listener;
  16. import org.bukkit.event.inventory.InventoryClickEvent;
  17. import org.bukkit.inventory.Inventory;
  18. import org.bukkit.inventory.InventoryHolder;
  19. import org.bukkit.inventory.ItemStack;
  20. import org.bukkit.inventory.meta.ItemMeta;
  21.  
  22. import api.CriarD;
  23. import api.JSONMessage;
  24. import api.JSONMessage.ClickAction;
  25. import api.JSONMessage.HoverAction;
  26. import me.paauum.CashAPI;
  27. import me.paauum.holly.eventos.BauEvento;
  28. import net.md_5.bungee.api.ChatColor;
  29.  
  30.  
  31.  
  32. public class Shop implements Listener, CommandExecutor {
  33.  
  34. @Override
  35. public boolean onCommand(CommandSender sender, Command cmd, String arg1, String[] args) {
  36.  
  37. if (!(sender instanceof Player)) {
  38. sender.sendMessage("§cApenas jogadores podem executar os comandos.");
  39. return false;
  40. }
  41. Player p = (Player) sender;
  42.  
  43. if (cmd.getName().equalsIgnoreCase("shop")) {
  44. ShopMenu(p);
  45. }
  46. return false;
  47. }
  48.  
  49. public void ShopMenu(Player p) {
  50. final Inventory inv = Bukkit.getServer().createInventory((InventoryHolder)p, 6 * 9, "SHOP");
  51.  
  52. final ItemStack cabeça = new ItemStack(CriarD.getNamedSkull(p.getName(), "§a"));
  53. final ItemMeta cabeçaMeta = cabeça.getItemMeta();
  54. cabeçaMeta.setDisplayName("§6Informações de §f" + p.getName());
  55. cabeçaMeta.setLore(Arrays.asList("§1",
  56. "§eSaldo atual em Cash: §f" + CashAPI.format(CashAPI.getCoins(p.getName())),
  57. "§2", "§e* §7Com Cash você poderá adquirir vários",
  58. "§7itens em nosso Shop.", "§4"));
  59. cabeça.setItemMeta(cabeçaMeta);
  60. inv.setItem(4, cabeça);
  61.  
  62. final ItemStack vidro = new ItemStack(CriarD.add(Material.STAINED_GLASS_PANE, 1, 15));
  63. final ItemMeta vidrom = vidro.getItemMeta();
  64. vidrom.addEnchant(Enchantment.DURABILITY, 1, false);
  65. vidrom.setDisplayName("§6Morg");
  66. vidro.setItemMeta(vidrom);
  67. inv.setItem(0, vidro);
  68. inv.setItem(1, vidro);
  69. inv.setItem(9, vidro);
  70. inv.setItem(8, vidro);
  71. inv.setItem(7, vidro);
  72. inv.setItem(9, vidro);
  73. inv.setItem(17, vidro);
  74. inv.setItem(36, vidro);
  75. inv.setItem(44, vidro);
  76. inv.setItem(46, vidro);
  77. inv.setItem(45, vidro);
  78. inv.setItem(52, vidro);
  79. inv.setItem(53, vidro);
  80.  
  81. final ItemStack info = new ItemStack(CriarD.add(Material.BOOK_AND_QUILL, "§eComo adquirir §6§lCASH§e?", new String[]
  82. { "§1", "§ePara adquirir §6§lCASH§e, basta ir em nossa", "§eloja: §fhttps://galaxynetwork.lojasquare.com.br §ee comprar.", "§2 "} ));
  83. final ItemMeta infom = info.getItemMeta();
  84. info.setItemMeta(infom);
  85. inv.setItem(49, info);
  86.  
  87. final ItemStack caixas = new ItemStack(Material.ENDER_CHEST);
  88. final ItemMeta caixasm = caixas.getItemMeta();
  89. caixasm.setDisplayName("§5§lCAIXAS MISTERIOSAS");
  90. ArrayList<String> lore = new ArrayList();
  91. lore.add("");
  92. lore.add("§eClique aqui apara adquirir caixas misteriosas");
  93. lore.add("§eutilizando seu saldo de §6§lCASH");
  94. lore.add("");
  95. lore.add("§eSeu saldo de cash atual: §f" + CashAPI.format(CashAPI.getCoins(p.getName())));
  96. caixasm.setLore(lore);
  97. caixas.setItemMeta(caixasm);
  98.  
  99. inv.setItem(20, caixas);
  100.  
  101. }
  102. public void ShopMEspeciais(Player p) {
  103. final Inventory inv8 = Bukkit.getServer().createInventory((InventoryHolder)p, 4 * 9, "SHOP - ESPECIAIS");
  104.  
  105. final ItemStack cabeça8 = new ItemStack(CriarD.getNamedSkull(p.getName(), "§a"));
  106. final ItemMeta cabeça8Meta = cabeça8.getItemMeta();
  107. cabeça8Meta.setDisplayName("§eInformações de §f" + p.getName());
  108. cabeça8Meta.setLore(Arrays.asList("§1",
  109. "§eSaldo atual em Cash: §f" + CashAPI.format(CashAPI.getCoins(p.getName())),
  110. "§4"));
  111. cabeça8.setItemMeta(cabeça8Meta);
  112. inv8.setItem(18, cabeça8);
  113.  
  114. final ItemStack voltar08 = new ItemStack(CriarD.add(Material.ARROW, "§cVoltar.", new String [] { "§1 ",
  115. "§7Clique para voltar.",
  116. "§1 "} ));
  117. final ItemMeta voltar08m = voltar08.getItemMeta();
  118. voltar08.setItemMeta(voltar08m);
  119. inv8.setItem(27, voltar08);
  120.  
  121. final ItemStack lancador = new ItemStack(CriarD.add(Material.FIREWORK, "§eLançador", new String [] { "§1", "§7 Utilize este item para obter",
  122. "§7um impulso para onde estiver olhando.",
  123. "§2", "§eCusto§f: 3 Cash", "§3", "§aClique para adquirir este produto."} ));
  124. final ItemMeta lancadorm = lancador.getItemMeta();
  125. lancador.setItemMeta(lancadorm);
  126. inv8.setItem(11, lancador);
  127.  
  128. final ItemStack voar = new ItemStack(CriarD.add(Material.FEATHER, "§eVoar", new String [] { "§1",
  129. "§7 Utilizando este item você poderá",
  130. "§7obter um vôo eternamente.",
  131. "§2", "§eCusto§f: 2 Cash", "§2", "§aClique para adquirir este produto."} ));
  132. final ItemMeta voarm = voar.getItemMeta();
  133. voar.setItemMeta(voarm);
  134. inv8.setItem(12, voar);
  135.  
  136. final ItemStack corchat = new ItemStack(CriarD.add(Material.SUGAR, "§eCor em chat's", new String [] { "§1",
  137. "§7 Utilize este item para obter acesso",
  138. "§7á uma escrita colorida em chat's.",
  139. "§2", "§eCusto§f: 2 Cash", "§2", "§aClique para adquirir este produto."} ));
  140. final ItemMeta corchatm = corchat.getItemMeta();
  141. corchat.setItemMeta(corchatm);
  142. inv8.setItem(13, corchat);
  143.  
  144. final ItemStack b = new ItemStack(CriarD.add(Material.CHEST, "§eBaú virtual.", new String [] { "§1",
  145. "§7 Use este item para obter um novo",
  146. "§eBaú virtual§7.",
  147. "§5", "§eCusto§f: 5 Cash", "§5", "§aClique para adquirir este produto."} ));
  148. final ItemMeta bm = b.getItemMeta();
  149. b.setItemMeta(bm);
  150. inv8.setItem(14, b);
  151.  
  152. p.openInventory(inv8);
  153. }
  154. public void CaixaMenu(Player p ) {
  155. final Inventory inv3 = Bukkit.getServer().createInventory((InventoryHolder)p, 4 * 9, "SHOP - CAIXAS MISTERIOSAS");
  156.  
  157. final ItemStack cabeça = new ItemStack(CriarD.getNamedSkull(p.getName(), "§a"));
  158. final ItemMeta cabeçaMeta = cabeça.getItemMeta();
  159. cabeçaMeta.setDisplayName("§6Informações de §f" + p.getName());
  160. cabeçaMeta.setLore(Arrays.asList("§1",
  161. "§eSaldo atual em Cash: §f" + CashAPI.format(CashAPI.getCoins(p.getName())),
  162. "§2", "§e* §7Com Cash você poderá adquirir vários",
  163. "§7itens em nosso Shop.", "§4"));
  164. cabeça.setItemMeta(cabeçaMeta);
  165. inv3.setItem(18, cabeça);
  166.  
  167. final ItemStack caixab = new ItemStack(Material.CHEST);
  168. final ItemMeta caixabm = caixab.getItemMeta();
  169. caixabm.setDisplayName("§eCaixa Básica");
  170. ArrayList<String> lore = new ArrayList();
  171. lore.add("");
  172. lore.add("§7Clique aqui para adquirir a Caixa Básica (1x)");
  173. lore.add("§7Custo: §6250 cash");
  174. lore.add("");
  175. caixabm.setLore(lore);
  176. caixab.setItemMeta(caixabm);
  177. inv3.setItem(11, caixab);
  178.  
  179.  
  180. final ItemStack caixar = new ItemStack(Material.ENDER_CHEST);
  181. final ItemMeta caixarm = caixar.getItemMeta();
  182. caixarm.setDisplayName("§5Caixa Rara");
  183. ArrayList<String> lore2 = new ArrayList();
  184. lore2.add("");
  185. lore2.add("§7Clique aqui para adquirir a Caixa Rara (1x)");
  186. lore2.add("§7Custo: §6350 cash");
  187. lore2.add("");
  188. caixarm.setLore(lore2);
  189. caixar.setItemMeta(caixarm);
  190. inv3.setItem(13, caixar);
  191.  
  192. final ItemStack caixaa = new ItemStack(Material.ENCHANTMENT_TABLE);
  193. final ItemMeta caixaam = caixaa.getItemMeta();
  194. caixaam.setDisplayName("§6Caixa Avançada");
  195. ArrayList<String> lore3 = new ArrayList();
  196. lore3.add("");
  197. lore3.add("§7Clique aqui para adquirir a Caixa Avançada (1x)");
  198. lore3.add("§7Custo: §6550 cash");
  199. lore3.add("");
  200. caixaam.setLore(lore3);
  201. caixaa.setItemMeta(caixaam);
  202. inv3.setItem(15, caixaa);
  203.  
  204. final ItemStack retornar = new ItemStack(Material.ARROW);
  205. final ItemMeta retornarm = retornar.getItemMeta();
  206. retornarm.setDisplayName("§cRetornar");
  207. retornarm.setLore(Arrays.asList("§1",
  208. "§7Clique aqui para retornar ao menu principal",
  209. ""));
  210. retornar.setItemMeta(retornarm);
  211. inv3.setItem(27, retornar);
  212.  
  213. p.openInventory(inv3);
  214. }
  215. @EventHandler
  216. public void onClickCaixas(final InventoryClickEvent e) {
  217. final Player p = (Player)e.getWhoClicked();
  218. if(e.getCurrentItem() == null) {
  219. return;
  220. }
  221. if(!e.getCurrentItem().hasItemMeta()) {
  222. return;
  223. }
  224. if(e.getInventory().getTitle().equalsIgnoreCase("SHOP - CAIXAS MISTERIOSAS")) {
  225. e.setCancelled(true);
  226.  
  227. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eCaixa Básica")) {
  228. if(CashAPI.getCoins(p.getName()).doubleValue() < 250.0) {
  229. p.sendMessage("§cVocê precisa de 250 de cash para adquirir este produto");
  230. return;
  231. }
  232. CashAPI.removeCoins(p.getName(), 250.0);
  233. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  234. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "givecaixa 01 1 " + p.getName());
  235. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  236. JSONMessage json = new JSONMessage();
  237. on.sendMessage("§f ");
  238. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  239. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  240. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  241. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  242.  
  243. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  244. ChatColor.YELLOW + " adquiriu uma ")
  245. .addText("§6§lCAIXA MISTERIOSA")
  246. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§fCaixa Básica x1§e'.")
  247. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  248. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  249. "Clique para acessar o §6§lSHOP").addText("§e.");
  250. json.sendJson(on);
  251.  
  252. on.sendMessage("§f ");
  253. }
  254. }
  255. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§5Caixa Rara")) {
  256. if(CashAPI.getCoins(p.getName()).doubleValue() < 350.0) {
  257. p.sendMessage("§cVocê precisa de 350 de cash para adquirir este produto");
  258. return;
  259. }
  260. CashAPI.removeCoins(p.getName(), 350.0);
  261. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  262. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "givecaixa 02 1 " + p.getName());
  263. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  264. JSONMessage json = new JSONMessage();
  265. on.sendMessage("§f ");
  266. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  267. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  268. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  269. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  270.  
  271. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  272. ChatColor.YELLOW + " adquiriu uma ")
  273. .addText("§6§lCAIXA MISTERIOSA")
  274. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§fCaixa Rara x1§e'.")
  275. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  276. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  277. "Clique para acessar o §6§lSHOP").addText("§e.");
  278. json.sendJson(on);
  279.  
  280. on.sendMessage("§f ");
  281. }
  282. }
  283. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Caixa Avançada")) {
  284. if(CashAPI.getCoins(p.getName()).doubleValue() < 550.0) {
  285. p.sendMessage("§cVocê precisa de 550 de cash para adquirir este produto");
  286. return;
  287. }
  288. CashAPI.removeCoins(p.getName(), 550.0);
  289. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  290. Bukkit.dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "givecaixa 03 1 " + p.getName());
  291. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  292. JSONMessage json = new JSONMessage();
  293. on.sendMessage("§f ");
  294. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  295. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  296. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  297. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  298.  
  299. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  300. ChatColor.YELLOW + " adquiriu uma ")
  301. .addText("§6§lCAIXA MISTERIOSA")
  302. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§fCaixa Avançada x1§e'.")
  303. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  304. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  305. "Clique para acessar o §6§lSHOP").addText("§e.");
  306. json.sendJson(on);
  307.  
  308. on.sendMessage("§f ");
  309. }
  310. }
  311. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cRetornar")) {
  312. p.playSound(p.getLocation(), Sound.VILLAGER_NO, 10.0f, 10.0f);
  313. ShopMenu(p);
  314. return;
  315. }
  316. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eInformações de §f" + p.getName())) {
  317. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  318. return;
  319. }
  320.  
  321.  
  322. }
  323. }
  324. @EventHandler
  325. public void onPlayerClickInventory6(final InventoryClickEvent e) {
  326. final Player p = (Player)e.getWhoClicked();
  327. if (e.getCurrentItem() == null) {
  328. return;
  329. }
  330. if (!e.getCurrentItem().hasItemMeta()) {
  331. return;
  332. }
  333. if (e.getInventory().getTitle().equalsIgnoreCase("SHOP - ESPECIAIS")) {
  334. e.setCancelled(true);
  335.  
  336. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eInformações de §f" + p.getName())) {
  337. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  338. return;
  339. }
  340. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§cVoltar.")) {
  341. p.playSound(p.getLocation(), Sound.VILLAGER_NO, 10.0f, 10.0f);
  342. ShopMenu(p);
  343. return;
  344. }
  345. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eLançador")) {
  346. {
  347. if (CashAPI.getCoins(p.getName()).doubleValue() < 3.0)
  348. {
  349. p.sendMessage("§cVocê precisa de 3 cash para adquirir este produto.");
  350. return;
  351. }
  352. CashAPI.removeCoins(p.getName(), 3.0);
  353. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  354. p.getInventory().addItem(EventosR.getItem());
  355. p.getInventory().addItem(EventosR.getItem());
  356. p.getInventory().addItem(EventosR.getItem());
  357. p.getInventory().addItem(EventosR.getItem());
  358. p.getInventory().addItem(EventosR.getItem());
  359. p.getInventory().addItem(EventosR.getItem());
  360. p.getInventory().addItem(EventosR.getItem());
  361. p.getInventory().addItem(EventosR.getItem());
  362. p.getInventory().addItem(EventosR.getItem());
  363. p.getInventory().addItem(EventosR.getItem());
  364. p.getInventory().addItem(EventosR.getItem());
  365. p.getInventory().addItem(EventosR.getItem());
  366. p.getInventory().addItem(EventosR.getItem());
  367. p.getInventory().addItem(EventosR.getItem());
  368. p.getInventory().addItem(EventosR.getItem());
  369. p.getInventory().addItem(EventosR.getItem());
  370. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  371. JSONMessage json = new JSONMessage();
  372. on.sendMessage("§f ");
  373. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  374. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  375. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  376. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  377.  
  378. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  379. ChatColor.YELLOW + " adquiriu um ")
  380. .addText("§e§lITEM ESPECIAL")
  381. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§6Lançador x1§e'.")
  382. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  383. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  384. "Clique para acessar o §6§lSHOP").addText("§e.");
  385. json.sendJson(on);
  386.  
  387. on.sendMessage("§f ");
  388. }
  389.  
  390. }
  391. }
  392. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eCor em chat's")) {
  393. {
  394. if (CashAPI.getCoins(p.getName()).doubleValue() < 2.0)
  395. {
  396. p.sendMessage("§cVocê precisa de 2 cash para adquirir este produto.");
  397. return;
  398. }
  399. CashAPI.removeCoins(p.getName(), 2.0);
  400. p.playSound(p.getLocation(), Sound.VILLAGER_YES, 10.0f, 10.0f);
  401. p.getInventory().addItem(EventosR.getCorChat());
  402. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  403. JSONMessage json = new JSONMessage();
  404. on.sendMessage("§f ");
  405. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  406. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  407. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  408. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  409.  
  410. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  411. ChatColor.YELLOW + " adquiriu um ")
  412. .addText("§e§lITEM ESPECIAL")
  413. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§6Cor em chat's x1§e'.")
  414. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  415. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  416. "Clique para acessar o §6§lSHOP").addText("§e.");
  417. json.sendJson(on);
  418.  
  419. on.sendMessage("§f ");
  420. }
  421. return;
  422. }
  423. }
  424. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eVoar")) {
  425. {
  426. if (CashAPI.getCoins(p.getName()).doubleValue() < 2.0)
  427. {
  428. p.sendMessage("§cVocê precisa de 2 cash para adquirir este produto.");
  429. return;
  430. }
  431. CashAPI.removeCoins(p.getName(), 2.0);
  432. p.playSound(p.getLocation(), Sound.VILLAGER_YES, 10.0f, 10.0f);
  433. p.getInventory().addItem(EventosR.getvoar());
  434. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  435. JSONMessage json = new JSONMessage();
  436. on.sendMessage("§f ");
  437. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  438. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  439. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  440. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  441.  
  442. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  443. ChatColor.YELLOW + " adquiriu um ")
  444. .addText("§e§lITEM ESPECIAL")
  445. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§6Voar x1§e'.")
  446. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  447. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  448. "Clique para acessar o §6§lSHOP").addText("§e.");
  449. json.sendJson(on);
  450.  
  451. on.sendMessage("§f ");
  452. }
  453. return;
  454. }
  455. }
  456. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eBaú virtual.")) {
  457. {
  458. if (CashAPI.getCoins(p.getName()).doubleValue() < 5.0)
  459. {
  460. p.sendMessage("§cVocê precisa de 5 cash para adquirir este produto.");
  461. return;
  462. }
  463. p.getInventory().addItem(BauEvento.getBau());
  464. CashAPI.removeCoins(p.getName(), 5.0);
  465. p.playSound(p.getLocation(), Sound.LEVEL_UP, 10.0f, 10.0f);
  466. for (Player on : Bukkit.getServer().getOnlinePlayers()) {
  467. JSONMessage json = new JSONMessage();
  468. on.sendMessage("§f ");
  469. on.playSound(on.getLocation(), Sound.EXPLODE, 1.0f, 15.0f);
  470. on.playSound(on.getLocation(), Sound.EXPLODE, 5.0f, 10.0f);
  471. on.playSound(on.getLocation(), Sound.EXPLODE, 10.0f, 5.0f);
  472. on.playSound(on.getLocation(), Sound.EXPLODE, 15.0f, 1.0f);
  473.  
  474. json.addText(ChatColor.RED + " [§c§l!§c] " + ChatColor.YELLOW + "O player " + p.getName() +
  475. ChatColor.YELLOW + " adquiriu um ")
  476. .addText("§e§lITEM ESPECIAL")
  477. .withHoverAction(HoverAction.SHOW_TEXT, "§eItem: '§6Baú virtual x1§e'.")
  478. .addText(ChatColor.YELLOW + " no ").addText("§6§lSHOP").withClickAction(ClickAction.RUN_COMMAND,
  479. "/shop").withHoverAction(HoverAction.SHOW_TEXT, ChatColor.YELLOW +
  480. "Clique para acessar o §6§lSHOP").addText("§e.");
  481. json.sendJson(on);
  482.  
  483. on.sendMessage("§f ");
  484. }
  485. return;
  486. }
  487. }
  488. }
  489. if (e.getInventory().getTitle().equalsIgnoreCase("SHOP")) {
  490. e.setCancelled(true);
  491.  
  492. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Informações de §f" + p.getName())) {
  493. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  494. return;
  495. }
  496. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§6Morg§fMC")) {
  497. p.playSound(p.getLocation(), Sound.CHICKEN_EGG_POP, 10.0f, 10.0f);
  498. return;
  499. }
  500. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§eComo adquirir §6§lCASH§e?")) {
  501. p.playSound(p.getLocation(), Sound.EXPLODE, 10.0f, 10.0f);
  502. return;
  503. }
  504. if (e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§e§lESPECIAIS")) {
  505. p.playSound(p.getLocation(), Sound.LEVEL_UP, 10.0f, 10.0f);
  506. ShopMEspeciais(p);
  507. return;
  508. }
  509. }
  510. if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("§5§lCAIXAS MISTERIOSAS")) {
  511. CaixaMenu(p);
  512. p.playSound(p.getLocation(), Sound.LEVEL_UP, 10.0f, 10.0f);
  513. return;
  514. }
  515. }
  516. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement