本文整理汇总了Java中org.bukkit.command.Command.broadcastCommandMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Command.broadcastCommandMessage方法的具体用法?Java Command.broadcastCommandMessage怎么用?Java Command.broadcastCommandMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.command.Command
的用法示例。
在下文中一共展示了Command.broadcastCommandMessage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " <playerName>");
return true;
}
final OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]);
if (!target.hasPlayedBefore() && !target.isOnline()) {
sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[0] + ChatColor.GOLD + "' not found.");
return true;
}
final UUID targetUUID = target.getUniqueId();
final FactionUser factionTarget = HCF.getPlugin().getUserManager().getUser(targetUUID);
final Deathban deathban = factionTarget.getDeathban();
if (deathban == null || !deathban.isActive()) {
sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
return true;
}
factionTarget.removeDeathban();
Command.broadcastCommandMessage(sender, ChatColor.LIGHT_PURPLE + "A staff has revived " + target.getName() + ".");
return false;
}
示例2: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 2) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
long duration = JavaUtils.parse(args[1]);
if (duration == -1L) {
sender.sendMessage(ChatColor.RED + "Invalid duration, use the correct format: 10m 1s");
return true;
}
SettingsYML.DEFAULT_DEATHBAN_DURATION = duration;
Command.broadcastCommandMessage(sender, ChatColor.RED + "Base death-ban time set to " + DurationFormatUtils.formatDurationWords(duration, true, true) + " (not including multipliers, etc).");
return true;
}
示例3: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 3) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
Faction faction = plugin.getFactionManager().getFaction(args[1]);
if (!(faction instanceof PlayerFaction)) {
sender.sendMessage(ChatColor.RED + "Faction " + args[1] + " is either not found or is not a player faction.");
return true;
}
Integer amount = JavaUtils.tryParseInt(args[2]);
if (amount == null) {
sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a number.");
return true;
}
if (amount > SettingsYML.CONQUEST_REQUIRED_WIN_POINTS) {
sender.sendMessage(ChatColor.RED + "Maximum points for Conquest is " + SettingsYML.CONQUEST_REQUIRED_WIN_POINTS + '.');
return true;
}
PlayerFaction playerFaction = (PlayerFaction) faction;
((ConquestTracker) EventType.CONQUEST.getEventTracker()).setPoints(playerFaction, amount);
Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set the points of faction " + playerFaction.getName() + " to " + amount + '.');
return true;
}
示例4: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 2) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
if (args[1].equalsIgnoreCase("all")) {
if (!(sender instanceof ConsoleCommandSender)) {
sender.sendMessage(ChatColor.RED + "This command can be only executed from console.");
return true;
}
Conversable conversable = (Conversable) sender;
conversable.beginConversation(factory.buildConversation(conversable));
return true;
}
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 (plugin.getFactionManager().removeFaction(faction, sender)) {
Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Disbanded faction " + faction.getName() + ChatColor.YELLOW + '.');
}
return true;
}
示例5: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 3) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
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;
}
Double multiplier = JavaUtils.tryParseDouble(args[2]);
if (multiplier == null) {
sender.sendMessage(ChatColor.RED + "'" + args[2] + "' is not a valid number.");
return true;
}
if (multiplier < MIN_MULTIPLIER) {
sender.sendMessage(ChatColor.RED + "Deathban multipliers may not be less than " + MIN_MULTIPLIER + '.');
return true;
}
if (multiplier > MAX_MULTIPLIER) {
sender.sendMessage(ChatColor.RED + "Deathban multipliers may not be more than " + MAX_MULTIPLIER + '.');
return true;
}
double previousMultiplier = faction.getDeathbanMultiplier();
faction.setDeathbanMultiplier(multiplier);
Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "Set deathban multiplier of " + faction.getName() + " from " + previousMultiplier + " to " + multiplier + '.');
return true;
}
示例6: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
for (FactionUser user : plugin.getUserManager().getUsers().values()) {
user.removeDeathban();
}
Command.broadcastCommandMessage(sender, ChatColor.YELLOW + "All death-bans have been cleared.");
return true;
}
示例7: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 1) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " <playerName>");
return true;
}
OfflinePlayer target = Bukkit.getOfflinePlayer(args[0]); // TODO: breaking
if (!target.hasPlayedBefore() && !target.isOnline()) {
sender.sendMessage(ChatColor.GOLD + "Player '" + ChatColor.WHITE + args[0] + ChatColor.GOLD + "' not found.");
return true;
}
UUID targetUUID = target.getUniqueId();
FactionUser factionTarget = HCF.getPlugin().getUserManager().getUser(targetUUID);
Deathban deathban = factionTarget.getDeathban();
if (deathban == null || !deathban.isActive()) {
sender.sendMessage(ChatColor.RED + target.getName() + " is not death-banned.");
return true;
}
factionTarget.removeDeathban();
Command.broadcastCommandMessage(sender, ChatColor.LIGHT_PURPLE + "Staff revived " + target.getName() + ".");
//sender.sendMessage(ChatColor.GREEN +"You have revived: " + target.getName() + ChatColor.GRAY + ChatColor.ITALIC + "(Click here to refund items)").setHoverText(ChatColor.GREEN + "Click here to refund items for: " + ChatColor.GRAY + target.getPlayer().getName().setClick(ClickAction.RUN_COMMAND, "/inv " + target.getPlayer().getName()));
return false;
}
示例8: onCommand
import org.bukkit.command.Command; //导入方法依赖的package包/类
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args.length < 3) {
sender.sendMessage(ChatColor.RED + "Usage: " + getUsage(label));
return true;
}
long newRegen = JavaUtils.parse(args[2]);
if (newRegen < 0L) {
sender.sendMessage(ChatColor.RED + "Faction DTR regeneration duration cannot be negative.");
return true;
}
if (newRegen > FactionManager.MAX_DTR_REGEN_MILLIS) {
sender.sendMessage(ChatColor.RED + "Cannot set factions DTR regen above " + FactionManager.MAX_DTR_REGEN_WORDS + ".");
return true;
}
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 PlayerFaction)) {
sender.sendMessage(ChatColor.RED + "This type of faction does not use DTR.");
return true;
}
PlayerFaction playerFaction = (PlayerFaction) faction;
long previousRegenRemaining = playerFaction.getRemainingRegenerationTime();
playerFaction.setRemainingRegenerationTime(newRegen);
Command.broadcastCommandMessage(
sender,
ChatColor.YELLOW + "Set DTR regen of " + faction.getName()
+ (previousRegenRemaining > 0L ? " from " + DurationFormatUtils.formatDurationWords(previousRegenRemaining, true, true) : "") + " to "
+ DurationFormatUtils.formatDurationWords(newRegen, true, true) + '.');
return true;
}