Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.wyrix.gui.template;
- import java.util.Arrays;
- import org.bukkit.ChatColor;
- import org.bukkit.Material;
- import org.bukkit.Statistic;
- import org.bukkit.entity.Player;
- import org.bukkit.event.inventory.ClickType;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import fr.wyrix.Main;
- import fr.wyrix.gui.AbstractGui;
- public class GuiCustom extends AbstractGui {
- private final Main plugin;
- private Player target;
- private int topluck;
- public GuiCustom(Main plugin, Player target) {
- super(plugin);
- this.plugin = plugin;
- this.target = target;
- }
- @Override
- public void display(Player player) {
- this.inventory = this.plugin.getServer().createInventory(null, 6*9, "" + target.getName());
- topluck = target.getStatistic(Statistic.MINE_BLOCK, Material.DIAMOND_ORE)*100 / target.getStatistic(Statistic.MINE_BLOCK, Material.STONE);
- if(topluck == 0) {
- player.sendMessage("0");
- return;
- }
- if(topluck >=1) {
- player.sendMessage("1");
- }
- ItemStack customSta = new ItemStack(Material.DIAMOND_PICKAXE, 1);
- ItemMeta customS = customSta.getItemMeta();
- customS.setDisplayName(ChatColor.DARK_PURPLE + "Statistiques");
- customS.setLore(Arrays.asList(""+ topluck));
- customSta.setItemMeta(customS);
- this.setSlotData(ChatColor.GOLD + "Teleport Vers", Material.ENDER_PEARL, 1, null, "tp");
- this.setSlotData(ChatColor.GOLD + "Teleport Ici", Material.ENDER_CHEST, 7, null, "tphere");
- this.setSlotData(ChatColor.AQUA + "Fermer", Material.WOOD_DOOR, 49, null, "close");
- this.setSlotData(ChatColor.RED + "Kill", Material.DEAD_BUSH, 13, null, "Mort");
- this.setSlotData(ChatColor.DARK_GREEN + "Inventaire", Material.BOOK, 31, null, "Inventaire");
- this.setSlotData(ChatColor.DARK_RED + "Ban", Material.LAVA_BUCKET, 20, null, "Ban");
- this.setSlotData(ChatColor.DARK_RED + "Dé-Ban", Material.WATER_BUCKET, 24, null, "UnBan");
- this.setSlotData(ChatColor.YELLOW + "Kick", Material.ANVIL, 43, null, "Kick");
- this.setSlotData(ChatColor.BLUE + "Freez", Material.ICE, 37, null, "Freez");
- this.setSlotData(customSta,4, "");
- player.openInventory(this.inventory);
- }
- @SuppressWarnings("deprecation")
- @Override
- public void onClick(Player player, ItemStack stack, String action, ClickType clickType) {
- if(action.equalsIgnoreCase("close")){
- this.plugin.getGuiManager().closeGui(player);
- } else if(action.equalsIgnoreCase("tp")) {
- player.teleport(target.getLocation());
- player.sendMessage("Teleport succefull");
- }
- if(action.equalsIgnoreCase("Mort")) {
- target.setHealth(0);
- player.sendMessage("Joueur Mort");
- }
- else if(action.equalsIgnoreCase("Inventaire")) {
- player.openInventory(target.getInventory());
- //player.sendMessage("test");
- }
- if(action.equalsIgnoreCase("Ban")) {
- target.kickPlayer("§8You have been banned by " + "§4" + player.getName());
- target.setBanned(true);
- }
- else if(action.equalsIgnoreCase("UnBan")) {
- target.setBanned(false);
- }
- if(action.equalsIgnoreCase("Kick")) {
- target.kickPlayer(ChatColor.GOLD +"Kick Par " + ChatColor.RED + player.getName());
- }
- else if(action.equalsIgnoreCase("tphere")) {
- target.teleport(player);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement