Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Listener;
- import org.bukkit.Bukkit;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- public class Schwerter implements Listener {
- @EventHandler
- public void onInteract(PlayerInteractEvent e){
- Player p = e.getPlayer();
- if(e.getClickedBlock().getType() == Material.DIAMOND_BLOCK){
- if(e.getAction() == Action.RIGHT_CLICK_BLOCK){
- p.sendMessage("§7Du hast das Inventar §bgeöffnet!");
- Inventory inv = Bukkit.createInventory(null, 27, "§bSchwerter");
- ItemStack Schwert = new ItemStack(Material.WOOD_SWORD);
- ItemMeta SM = Schwert.getItemMeta();
- SM.setDisplayName("§bHolzschwert");
- Schwert.setItemMeta(SM);
- inv.setItem(10, Schwert);
- ItemStack Schwert1 = new ItemStack(Material.GOLD_SWORD);
- ItemMeta SM1 = Schwert1.getItemMeta();
- SM1.setDisplayName("§bGoldschwert");
- Schwert1.setItemMeta(SM1);
- inv.setItem(12, Schwert1);
- ItemStack Schwert2 = new ItemStack(Material.IRON_SWORD);
- ItemMeta SMS1 = Schwert2.getItemMeta();
- SMS1.setDisplayName("§bEisenschwert");
- Schwert2.setItemMeta(SMS1);
- inv.setItem(14, Schwert2);
- ItemStack Schwert3 = new ItemStack(Material.DIAMOND_SWORD);
- ItemMeta SMS2 = Schwert3.getItemMeta();
- SMS2.setDisplayName("§bDiamantschwert");
- Schwert3.setItemMeta(SMS2);
- inv.setItem(16, Schwert3);
- ItemStack Glas = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM2 = Glas.getItemMeta();
- SM2.setDisplayName("§b");
- Glas.setItemMeta(SM2);
- inv.setItem(0, Glas);
- ItemStack Glas1 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM3 = Glas1.getItemMeta();
- SM3.setDisplayName("§b");
- Glas1.setItemMeta(SM3);
- inv.setItem(1, Glas1);
- ItemStack Glas2 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM4 = Glas2.getItemMeta();
- SM4.setDisplayName("§b");
- Glas2.setItemMeta(SM4);
- inv.setItem(2, Glas2);
- ItemStack Glas3 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM5 = Glas3.getItemMeta();
- SM5.setDisplayName("§b");
- Glas3.setItemMeta(SM5);
- inv.setItem(3, Glas3);
- ItemStack Glas4 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM6 = Glas4.getItemMeta();
- SM6.setDisplayName("§b");
- Glas4.setItemMeta(SM6);
- inv.setItem(4, Glas4);
- ItemStack Glas5 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM7 = Glas4.getItemMeta();
- SM7.setDisplayName("§b");
- Glas5.setItemMeta(SM7);
- inv.setItem(5, Glas5);
- ItemStack Glas6 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM8 = Glas6.getItemMeta();
- SM8.setDisplayName("§b");
- Glas6.setItemMeta(SM8);
- inv.setItem(6, Glas6);
- ItemStack Glas7 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM9 = Glas7.getItemMeta();
- SM9.setDisplayName("§b");
- Glas7.setItemMeta(SM9);
- inv.setItem(7, Glas7);
- ItemStack Glas8 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM10 = Glas8.getItemMeta();
- SM10.setDisplayName("§b");
- Glas8.setItemMeta(SM10);
- inv.setItem(8, Glas8);
- ItemStack Glas9 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM11 = Glas9.getItemMeta();
- SM11.setDisplayName("§b");
- Glas9.setItemMeta(SM11);
- inv.setItem(9, Glas9);
- ItemStack Glas10 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM12 = Glas10.getItemMeta();
- SM12.setDisplayName("§b");
- Glas10.setItemMeta(SM12);
- inv.setItem(11, Glas10);
- ItemStack Glas11 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM13 = Glas11.getItemMeta();
- SM13.setDisplayName("§b");
- Glas11.setItemMeta(SM13);
- inv.setItem(13, Glas11);
- ItemStack Glas12 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM14 = Glas12.getItemMeta();
- SM14.setDisplayName("§b");
- Glas12.setItemMeta(SM14);
- inv.setItem(15, Glas12);
- ItemStack Glas13 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM15 = Glas13.getItemMeta();
- SM15.setDisplayName("§b");
- Glas13.setItemMeta(SM15);
- inv.setItem(17, Glas13);
- ItemStack Glas14 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM16 = Glas14.getItemMeta();
- SM16.setDisplayName("§b");
- Glas14.setItemMeta(SM16);
- inv.setItem(18, Glas14);
- ItemStack Glas15 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM17 = Glas15.getItemMeta();
- SM17.setDisplayName("§b");
- Glas15.setItemMeta(SM17);
- inv.setItem(19, Glas15);
- ItemStack Glas16 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM18 = Glas16.getItemMeta();
- SM18.setDisplayName("§b");
- Glas16.setItemMeta(SM18);
- inv.setItem(20, Glas16);
- ItemStack Glas17 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM19 = Glas17.getItemMeta();
- SM19.setDisplayName("§b");
- Glas17.setItemMeta(SM19);
- inv.setItem(21, Glas17);
- ItemStack Glas18 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM20 = Glas18.getItemMeta();
- SM20.setDisplayName("§b");
- Glas18.setItemMeta(SM20);
- inv.setItem(22, Glas18);
- ItemStack Glas19 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM21 = Glas19.getItemMeta();
- SM21.setDisplayName("§b");
- Glas19.setItemMeta(SM21);
- inv.setItem(23, Glas19);
- ItemStack Glas20 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM22 = Glas20.getItemMeta();
- SM22.setDisplayName("§b");
- Glas20.setItemMeta(SM22);
- inv.setItem(24, Glas20);
- ItemStack Glas21 = new ItemStack(Material.STAINED_GLASS_PANE);
- ItemMeta SM23 = Glas21.getItemMeta();
- SM23.setDisplayName("§b");
- Glas21.setItemMeta(SM23);
- inv.setItem(25, Glas21);
- ItemStack Slime = new ItemStack(Material.SLIME_BALL);
- ItemMeta SMS = Slime.getItemMeta();
- SMS.setDisplayName("§aWeiter");
- Slime.setItemMeta(SMS);
- inv.setItem(26, Slime);
- p.openInventory(inv);
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 1, 1);
- }}}
- @EventHandler
- public void onClick(InventoryClickEvent e){
- Player p = (Player) e.getWhoClicked();
- if(e.getInventory().getName().equals("§bSchwerter")){
- e.setCancelled(true);
- if(e.getCurrentItem().getType() == Material.WOOD_SWORD){
- p.sendMessage("§7Du hast ein §bHolzschwert §7erhalten!");
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 4, 4);
- p.closeInventory();
- ItemStack Schwert = new ItemStack(Material.WOOD_SWORD);
- p.getInventory().addItem(Schwert);
- if(e.getInventory().getName().equals("§bSchwerter")){
- e.setCancelled(true);
- if(e.getCurrentItem().getType() == Material.GOLD_SWORD){
- p.sendMessage("§7Du hast ein §bGoldschwert §7erhalten!");
- p.playSound(p.getLocation(), Sound.LEVEL_UP, 4, 4);
- p.closeInventory();
- ItemStack Schwert1 = new ItemStack(Material.GOLD_SWORD);
- p.getInventory().addItem(Schwert1);
- }}}}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement