SHARE
TWEET

Untitled

a guest Aug 17th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package me.joshios.thunder.thunder;
  2.  
  3. import org.bukkit.ChatColor;
  4. import org.bukkit.GameMode;
  5. import org.bukkit.command.Command;
  6. import org.bukkit.command.CommandExecutor;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.inventory.Inventory;
  10. import org.bukkit.inventory.ItemStack;
  11.  
  12. import java.lang.reflect.Array;
  13. import java.util.ArrayList;
  14. import java.util.HashMap;
  15. import java.util.UUID;
  16.  
  17. public class Admin implements CommandExecutor {
  18.     public static boolean admin = false;
  19.     ArrayList<Player> vanish_list = new ArrayList<>();
  20.     HashMap<UUID,ItemStack[]> inventorySave = new HashMap<>();
  21.  
  22.  
  23.     @Override
  24.     public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  25.         if (sender instanceof Player)
  26.         {
  27.             Player player = (Player) sender;
  28.             ItemStack[] items = player.getInventory().getContents();
  29.             UUID id = player.getUniqueId();
  30.             inventorySave.put(id,items);
  31.  
  32.             if (player.hasPermission("thunder.admin"))
  33.             {
  34.                 if ((!admin)) {
  35.                     admin = true;
  36.                     player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&9&lThunder&r&7] &9Admin mode activated!"));
  37.                     player.setGameMode(GameMode.CREATIVE);
  38.                     player.getInventory().getContents();
  39.                     player.getInventory().clear();
  40.                     if (!vanish_list.contains(player)) {
  41.                         vanish_list.add(player);
  42.                         // working on making them invis xD
  43.                     }
  44.                     return true;
  45.                 }
  46.                 else {
  47.                     admin = false;
  48.                     player.sendMessage("hey");
  49.                     player.getInventory().setContents(inventorySave.get(id));
  50.                     return true;
  51.  
  52.                 }
  53.  
  54.             }
  55.         }
  56.         return true;
  57.     }
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top