Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.jellysalto.main.commands;
- import me.jellysalto.main.JellyPlugin;
- import me.jellysalto.main.inventory.GuiInvCreator;
- import me.jellysalto.main.inventory.GuiInvItems;
- import me.jellysalto.main.util.Logger;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- public class Gui implements CommandExecutor {
- private JellyPlugin plugin = JellyPlugin.getPlugin(JellyPlugin.class);
- public static String targetPlayer;
- public Gui() {
- this.targetPlayer = null;
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if(!(sender instanceof Player)) {
- Logger.log(Logger.LogLevel.ERROR, plugin.getConfig().getString("console-error"));
- return true;
- }
- Player player = (Player) sender;
- if(!cmd.getName().equalsIgnoreCase("gui")) {
- return true;
- }
- if(args.length < 1) {
- sender.sendMessage(ChatColor.translateAlternateColorCodes('&',
- plugin.getConfig().getString("guiprefix")
- + plugin.getConfig().getString("guiusage")));
- return true;
- }
- if(args.length == 1) {
- targetPlayer = args[0];
- }
- if(!sender.hasPermission("jellyplugin.gui.use")) {
- sender.sendMessage(ChatColor.translateAlternateColorCodes('&',
- plugin.getConfig().getString("guiprefix")
- + plugin.getConfig().getString("noperms")));
- return true;
- }
- if(args.length > 1) {
- sender.sendMessage(ChatColor.translateAlternateColorCodes('&',
- plugin.getConfig().getString("guiprefix")
- + plugin.getConfig().getString("guiusage")));
- return true;
- }
- if(targetPlayer.length() > 16) {
- sender.sendMessage(ChatColor.translateAlternateColorCodes('&',
- plugin.getConfig().getString("guiprefix")
- + plugin.getConfig().getString("guilength")));
- return true;
- }
- GuiInvCreator.i.setItem(plugin.getConfig().getInt("reload"), GuiInvItems.KickSeverity1(player));
- for(int i = 0; i < 54; ++i) {
- if(GuiInvCreator.i.getItem(i) == null) {
- GuiInvCreator.i.setItem(i, GuiInvItems.Glass(player));
- }
- }
- player.openInventory(GuiInvCreator.i);
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement