thevipershowita

gui.java

Jul 6th, 2019
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.28 KB | None | 0 0
  1. package me.tylercreator.guichunk.ui;
  2.  
  3. import org.bukkit.Bukkit;
  4. import org.bukkit.Location;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.inventory.Inventory;
  7. import org.bukkit.inventory.ItemStack;
  8.  
  9. import me.tylercreator.guichunk.utilities.Utilities;
  10.  
  11. public class gui {
  12.  
  13.     public static Inventory inv;
  14.     public static String inventory_name;
  15.     public static int inv_rows = 4 * 9;
  16.    
  17.    
  18.     public static void initialize() {
  19.         inventory_name = Utilities.chat("&8&l[&a&lChunkGUI&r&8&l]");
  20.        
  21.         inv = Bukkit.createInventory(null, inv_rows);
  22.        
  23.     }
  24.  
  25.     public static Inventory GUI (Player p) {
  26.        
  27.         Inventory toReturn = Bukkit.createInventory(null, inv_rows, inventory_name);
  28.         if (p.hasPermission("chunkgui.use")) {
  29.         Utilities.createItem(inv, 4, 1, 2, "&8[&aCoordinates&8]&r", "&9Get your actual coordinates.");
  30.         } else {
  31.             p.sendMessage("&cNo permissions!");
  32.            
  33.         }
  34.        
  35.         toReturn.setContents(inv.getContents());
  36.         return toReturn;
  37.     }
  38.    
  39.     public static void clicked(Player p, int slot, ItemStack clicked, Inventory inv) {
  40.         if(clicked.getItemMeta().getDisplayName().equalsIgnoreCase(Utilities.chat("&8[&aCoordinates&8]&r"))) {
  41.             Location l = p.getLocation();
  42.             p.sendMessage("&8[&aGUIChunk&8]&f: Pos X:" + l.getX() + "Pos y:" + l.getY() + "Pos z:" + l.getZ());
  43.         }
  44.     }
  45. }
Add Comment
Please, Sign In to add comment