本文整理匯總了Java中org.bukkit.command.CommandSender.isOp方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandSender.isOp方法的具體用法?Java CommandSender.isOp怎麽用?Java CommandSender.isOp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.command.CommandSender
的用法示例。
在下文中一共展示了CommandSender.isOp方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handle
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
public void handle(String msg, CommandSender sender, Cancellable event) {
if (Config.get().hiddenMode && !sender.hasPermission("camerastudio.use") && !sender.isOp()) return;
if (msg.startsWith("/cam") || msg.startsWith("/camerastudio")) {
event.setCancelled(true);
List<String> args = Lists.newArrayList(msg.split(" "));
if (args.size() > 1) {
args.remove(0);
}
Traveller traveller = null;
if (sender instanceof ConsoleCommandSender) {
traveller = new BukkitTraveller(null);
} else {
Player player = (Player) sender;
traveller = Travellers.impl().get(player.getUniqueId());
}
CmdCam.get().preExec(traveller, args);
}
}
示例2: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
try {
if (this.requiresPlayer() && !(sender instanceof Player)) {
throw new CommandException(Collections.singletonList("You must be a player to execute this command."));
}
if (this.requiresPermission() && !sender.hasPermission(this.getPermission()) && !sender.isOp()) {
throw new CommandException(Collections.singletonList("You do not have permission to execute this command."));
}
this.onCommand(sender, args);
}
catch (CommandException e) {
for (String message : e.getMessages()) {
sender.sendMessage(ChatColor.RED + message);
}
}
return true;
}
示例3: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
protected boolean onCommand(CommandSender sender, String label, String[] arguments)
{
if (!(sender instanceof ConsoleCommandSender) && !sender.isOp())
return true;
if (arguments.length != 2)
return true;
String cheat = arguments[0];
String player = arguments[1];
String server = SamaGamesAPI.get().getServerName();
new JsonModMessage("AntiCheat", ModChannel.REPORT, ChatColor.DARK_RED, player + "#####" + server + "#####Possible usage de la triche : " + cheat).send();
return true;
}
示例4: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender.isOp()){
if(args.length!=4){
sender.sendMessage("§c參數不正確!");
return false;
} else{
String name=args[1];
String type=args[2];
String value=args[3];
PlayerData data=Database.getInstance().getData(name);
if(data==null){
if(type.equalsIgnoreCase("p")){
data=new PlayerData(name,value,null);
}
else{
data=new PlayerData(name,null,value);
}
Database.getInstance().insertData(data);
} else{
if(type.equalsIgnoreCase("p")){
data.setPrefix(value);
}
else{
data.setSuffix(value);
}
Database.getInstance().updateData(data);
}
sender.sendMessage("§a§l完成!玩家目前稱號狀態如下(null代表無)");
sender.sendMessage(data.toString());
return true;
}
}
return false;
}
示例5: sendHelp
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
private void sendHelp(CommandSender sender) {
sender.sendMessage(new String[]{
"§6§l命令幫助:",
"§a/gp query §c查看你自己的稱號情況"
});
if(sender.isOp()){
sender.sendMessage(new String[]{
"§6§lOP命令幫助:",
"§a/gp update <玩家> <p/s> <值> §c更新某玩家的稱號情況,p為前綴,s為後綴"
});
}
}
示例6: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if(s.equalsIgnoreCase("setgame")) {
if(!commandSender.isOp()) {
commandSender.sendMessage(ChatColor.RED + "You do not have permission to execute this command.");
return false;
}
if(strings.length <= 0) {
commandSender.sendMessage(ChatColor.RED + "Please supply a class name. Ex: me.redraskal.arcadia.game.BombardmentGame");
return false;
}
final ArcadiaAPI api = Arcadia.getPlugin(Arcadia.class).getAPI();
try {
Class<? extends BaseGame> clazz = (Class<? extends BaseGame>) Class.forName(strings[0]);
api.getGameManager().endGame();
new BukkitRunnable() {
public void run() {
api.getGameManager().nullifyGame();
List<GameMap> possibleMaps = api.getGameRegistry().getMaps(clazz);
api.getGameManager().setCurrentGame(clazz, possibleMaps.get(new Random().nextInt(possibleMaps.size())));
}
}.runTaskLater(api.getPlugin(), 60L);
commandSender.sendMessage(ChatColor.GREEN + "Game has been changed.");
} catch (Exception e) {
commandSender.sendMessage(ChatColor.RED + "Invalid class name.");
}
}
return false;
}
示例7: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {//重讀指令
if (sender.isOp()) {
setConfig();
sender.sendMessage("Done.");
return true;
}
sender.sendMessage("隻有OP才能執行");
return true;
}
示例8: onTabComplete
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
if (this.requiresPlayer() && !(sender instanceof Player)) {
return Collections.emptyList();
}
if (this.requiresPermission() && !sender.hasPermission(this.getPermission()) && !sender.isOp()) {
return Collections.emptyList();
}
return this.onTabComplete(sender, args);
}
示例9: hasPermission
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
protected boolean hasPermission(CommandSender sender, String permission) {
if (sender instanceof ConsoleCommandSender || sender.isOp())
return true;
boolean result = false;
if (sender instanceof Player)
result = plugin.getAPI().getPermissionsManager().hasPermission(sender, permission);
if (!result)
sender.sendMessage(ChatColor.RED + "Vous n'avez pas le droit de faire ça.");
return result;
}
示例10: hasPermission
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
private boolean hasPermission(CommandSender player) {
return player.hasPermission(UraniumCommand.UPDATE) || player.isOp();
}
示例11: has
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
public static boolean has(CommandSender sender) {
return sender.isOp() || sender.hasPermission(common);
}
示例12: hasPerm
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
public static boolean hasPerm(CommandSender sender, String perm) {
return sender.isOp() || sender.hasPermission(perm);
}
示例13: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
PlayerFaction selfFaction = sender instanceof Player ? plugin.getFactionManager().getPlayerFaction((Player) sender) : null;
ClaimableFaction targetFaction;
if (args.length < 2) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
if (selfFaction == null) {
sender.sendMessage(ChatColor.RED + "You are not in a faction.");
return true;
}
targetFaction = selfFaction;
} else {
Faction faction = plugin.getFactionManager().getContainingFaction(args[1]);
if (faction == null) {
sender.sendMessage(ChatColor.RED + "Faction named or containing member with IGN or UUID " + args[1] + " not found.");
return true;
}
if (!(faction instanceof ClaimableFaction)) {
sender.sendMessage(ChatColor.RED + "You can only check the claims of factions that can have claims.");
return true;
}
targetFaction = (ClaimableFaction) faction;
}
Collection<Claim> claims = targetFaction.getClaims();
if (claims.isEmpty()) {
sender.sendMessage(ChatColor.RED + "Faction " + targetFaction.getDisplayName(sender) + ChatColor.RED + " has no claimed land.");
return true;
}
if (sender instanceof Player && !sender.isOp() && (targetFaction instanceof PlayerFaction && ((PlayerFaction) targetFaction).getHome() == null)) {
if (selfFaction != targetFaction) {
sender.sendMessage(ChatColor.RED + "You cannot view the claims of " + targetFaction.getDisplayName(sender) + ChatColor.RED + " because their home is unset.");
return true;
}
}
sender.sendMessage(ChatColor.GOLD + "Claims of " + targetFaction.getDisplayName(sender) + ChatColor.GOLD + " (" + claims.size() + "):");
for (Claim claim : claims) {
sender.sendMessage(ChatColor.GRAY + " " + claim.getFormattedName());
}
return true;
}
示例14: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command cmd, String cmdLabel, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "This command is available only for players!");
return true;
}
Player player = (Player) sender;
if(args.length == 0) {
plugin.getRagnorak().addVote(player);
return true;
}
else if(args.length == 1) {
if(!sender.isOp()){
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "This command is available only for OP!");
return true;
}
if(args[0].equalsIgnoreCase("additem")){
if(player.getInventory().getItemInMainHand() == null) {
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "You don't have any item in your hand!");
return true;
}
RagnorakFile.addItem(player.getInventory().getItemInMainHand());
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "You've succesfully added item to Ragnorak!");
return true;
}
else if(args[0].equalsIgnoreCase("addlocation")) {
RagnorakFile.addLocation(player.getLocation());
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "You've succesfully added new drop location!");
return true;
}
else if(args[0].equalsIgnoreCase("start")) {
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "You've started Ragnorak!");
plugin.getRagnorak().start();
return true;
}
else{
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "Unknown command!");
return true;
}
}else{
player.sendMessage(Lang.HEADERS_RAGNORAK.toString() + "Unknown command!");
return true;
}
}
示例15: onCommand
import org.bukkit.command.CommandSender; //導入方法依賴的package包/類
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.GOLD + "-----------------------");
sender.sendMessage(ChatColor.GOLD + "-- DRAGONEGGDROP INFO --");
sender.sendMessage(ChatColor.GOLD + "-----------------------");
sender.sendMessage(ChatColor.GOLD + "Original Author: PixelStix");
sender.sendMessage(ChatColor.GOLD + "Maintainer: 2008Choco");
sender.sendMessage(ChatColor.GOLD + "Version: " + plugin.getDescription().getVersion());
if (sender.isOp() && plugin.isNewVersionAvailable())
sender.sendMessage(ChatColor.AQUA + "NEW VERSION AVAILABLE!: " + plugin.getNewVersion());
sender.sendMessage(ChatColor.YELLOW + "/dragoneggdrop help");
sender.sendMessage(ChatColor.GOLD + "-----------------------");
return true;
}
// "help" and "reload" params
if (args[0].equalsIgnoreCase("help")) {
if (!sender.hasPermission("dragoneggdrop.help")) {
this.plugin.sendMessage(sender, ChatColor.RED + "Permission denied!");
return true;
}
sender.sendMessage(ChatColor.GOLD + "-----------------------");
sender.sendMessage(ChatColor.GOLD + "-- DRAGONEGGDROP HELP --");
sender.sendMessage(ChatColor.GOLD + "-----------------------");
sender.sendMessage(ChatColor.GOLD + "/dragoneggdrop reload");
sender.sendMessage(ChatColor.GOLD + "/dragontemplate list");
sender.sendMessage(ChatColor.GOLD + "/dragontemplate <template> (view/info)");
sender.sendMessage(ChatColor.GOLD + "/dragontemplate <template> edit addloot [weight]");
sender.sendMessage(ChatColor.GOLD + "-----------------------");
}
else if (args[0].equalsIgnoreCase("reload")) {
if (!sender.hasPermission("dragoneggdrop.reload")) {
this.plugin.sendMessage(sender, ChatColor.RED + "Permission denied!");
return true;
}
this.plugin.reloadConfig();
this.plugin.getDEDManager().reloadDragonTemplates();
this.plugin.sendMessage(sender, ChatColor.GREEN + "Reload complete!");
}
return true;
}