2012-02-20 20:09:44 +00:00
|
|
|
/*
|
2012-03-03 18:58:24 +00:00
|
|
|
* Copyright (C) 2011-2012 lishid. All rights reserved.
|
2012-02-20 20:09:44 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2012-01-17 03:20:25 +00:00
|
|
|
package lishid.openinv.commands;
|
|
|
|
|
|
|
|
import lishid.openinv.OpenInv;
|
|
|
|
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.command.Command;
|
|
|
|
import org.bukkit.command.CommandExecutor;
|
|
|
|
import org.bukkit.command.CommandSender;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2012-06-28 14:53:11 +00:00
|
|
|
public class AnyChestPluginCommand implements CommandExecutor
|
|
|
|
{
|
|
|
|
public AnyChestPluginCommand(OpenInv plugin)
|
|
|
|
{
|
|
|
|
|
2012-01-17 03:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-06-28 14:53:11 +00:00
|
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
|
|
{
|
|
|
|
if (!(sender instanceof Player))
|
|
|
|
{
|
2012-02-18 06:46:39 +00:00
|
|
|
sender.sendMessage(ChatColor.RED + "You can't use this from the console.");
|
2012-06-28 14:53:11 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (!sender.hasPermission("OpenInv.anychest"))
|
|
|
|
{
|
2012-01-17 03:20:25 +00:00
|
|
|
sender.sendMessage(ChatColor.RED + "You do not have permission to use anychest.");
|
|
|
|
return true;
|
|
|
|
}
|
2012-06-28 14:53:11 +00:00
|
|
|
|
|
|
|
if (args.length > 0)
|
|
|
|
{
|
|
|
|
if (args[0].equalsIgnoreCase("check"))
|
|
|
|
{
|
|
|
|
if (OpenInv.GetPlayerAnyChestStatus(sender.getName()))
|
|
|
|
sender.sendMessage("AnyChest is ON.");
|
|
|
|
else
|
|
|
|
sender.sendMessage("AnyChest is OFF.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OpenInv.SetPlayerAnyChestStatus(sender.getName(), !OpenInv.GetPlayerAnyChestStatus(sender.getName()));
|
|
|
|
sender.sendMessage("AnyChest is now " + (OpenInv.GetPlayerAnyChestStatus(sender.getName()) ? "On" : "Off") + ".");
|
|
|
|
|
2012-01-17 03:20:25 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|