Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. package me.Fox.TrollPlus.Commands;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import org.bukkit.Bukkit;
  6. import org.bukkit.Material;
  7. import org.bukkit.command.Command;
  8. import org.bukkit.command.CommandExecutor;
  9. import org.bukkit.command.CommandSender;
  10. import org.bukkit.entity.Player;
  11. import org.bukkit.inventory.Inventory;
  12. import org.bukkit.inventory.ItemStack;
  13. import org.bukkit.inventory.meta.ItemMeta;
  14.  
  15. import me.Fox.TrollPlus.Main;
  16.  
  17. public class TrollCommand implements CommandExecutor {
  18.  
  19.     private Main main;
  20.         public void TrollCommand() {
  21.             this.main = main;
  22.        
  23.     }
  24.    
  25.     @Override
  26.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  27.        
  28.         Player player = (Player) sender;
  29.        
  30.         if (sender instanceof Player && player.hasPermission("trollplus.troll")) {
  31.             if (args.length == 0) {
  32.                 player.sendMessage("§cYou do not have permission to use this command!");
  33.                 return true;
  34.             }
  35.             if (args.length == 1) {
  36.                
  37.                 Player target = Bukkit.getPlayer(args[0]);
  38.                
  39.                 gui(player);
  40.                
  41.                
  42.             }
  43.         }
  44.        
  45.         return true;
  46.     }
  47.  
  48.  
  49.  
  50.  
  51.     public void gui(Player target) {
  52.        
  53.         //BEGINNING
  54.         Inventory gui = Bukkit.createInventory(null, 54, "§cTrollPlus - You are trolling:" + target.getName());
  55.        
  56.         // LORES
  57.        
  58.         // Launch Lore \\
  59.         ArrayList<String> launchL = new ArrayList<>();
  60.         launchL.add("§7With this command you can launch");
  61.         launchL.add("§7the current target!");
  62.         launchL.add("");
  63.         launchL.add("§7Target: §a" + target.getName());
  64.        
  65.         // Drunk Lore \\
  66.         ArrayList<String> drunkL = new ArrayList<>();
  67.         drunkL.add("§7With this command you can make");
  68.         drunkL.add("§7your target drink till they get");
  69.         drunkL.add("§7drunk!");
  70.         drunkL.add("");
  71.         drunkL.add("§7Target: §a" + target.getName());
  72.        
  73.        
  74.         // ITEM STACK
  75.        
  76.         // Launch ItemStack \\
  77.         ItemStack launchI = new ItemStack(Material.WEB);
  78.         ItemMeta launchM = launchI.getItemMeta();
  79.         launchM.setDisplayName("§a§lLaunch " + target.getName());
  80.        
  81.         // ITEM SETTINGS
  82.        
  83.         //FINAL
  84.         target.openInventory(gui);
  85.        
  86.     }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement