org.bukkit.Bukkit.getConsoleSender()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中org.bukkit.Bukkit.getConsoleSender()方法的一些代码示例,展示了Bukkit.getConsoleSender()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bukkit.getConsoleSender()方法的具体详情如下:
包路径:org.bukkit.Bukkit
类名称:Bukkit
方法名:getConsoleSender

Bukkit.getConsoleSender介绍

暂无

代码示例

代码示例来源:origin: Bukkit/Bukkit

/**
 * Sets the generator that will be used to create or load the world.
 * <p>
 * This may be null, in which case the "natural" generator for this
 * environment will be used.
 * <p>
 * If the generator cannot be found for the given name, the natural
 * environment generator will be used instead and a warning will be
 * printed to the console.
 *
 * @param generator Name of the generator to use, in "plugin:id" notation
 * @return This object, for chaining
 */
public WorldCreator generator(String generator) {
  this.generator = getGeneratorForName(name, generator, Bukkit.getConsoleSender());
  return this;
}

代码示例来源:origin: Bukkit/Bukkit

Bukkit.getConsoleSender().sendMessage(result);
return;
Bukkit.getConsoleSender().sendMessage(result);
return;

代码示例来源:origin: Bukkit/Bukkit

output = Bukkit.getConsoleSender();

代码示例来源:origin: EngineHub/WorldGuard

public CommandSender unwrapActor(Actor sender) {
  if (sender instanceof BukkitPlayer) {
    return ((BukkitPlayer) sender).getPlayer();
  } else if (sender instanceof BukkitCommandSender) {
    return Bukkit.getConsoleSender(); // TODO Fix
  } else {
    throw new IllegalArgumentException("Unknown actor type. Please report");
  }
}

代码示例来源:origin: NyaaCat/RPGItems-reloaded

@Override
  public Optional<Material> set(String value) throws IllegalArgumentException {
    Material material = getMaterial(value, Bukkit.getConsoleSender());
    if (material == null) throw new IllegalArgumentException();
    return Optional.of(material);
  }
}

代码示例来源:origin: Bkm016/TabooLib

@Override
  public void console() {
    text.forEach(line -> Bukkit.getConsoleSender().sendMessage(line));
  }
}

代码示例来源:origin: SkyWars/SkyWars

@Override
  public void run() {
    // null playerUuid signifies that it isn't a player - rather it's the console.
    CommandSender sender = playerUuid == null ? Bukkit.getConsoleSender() : Bukkit.getPlayer(playerUuid);
    if (sender != null) {
      sender.sendMessage(result);
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

@Override
  public void console() {
    Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[<ERROR-40: " + value.getLanguageKey() + ">]");
  }
}

代码示例来源:origin: Bkm016/TabooLib

@Override
  public void console() {
    Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[<ERROR-40: " + value.getLanguageKey() + ">]");
  }
}

代码示例来源:origin: Bkm016/TabooLib

@Override
  public void console() {
    Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[<ERROR-40: " + value.getLanguageKey() + ">]");
  }
}

代码示例来源:origin: Bkm016/TabooLib

/**
 * 发送调试信息
 */
public static void debug(Plugin plugin, String... args) {
  if (TabooLib.isDebug()) {
    Arrays.stream(args).forEach(var -> Bukkit.getConsoleSender().sendMessage(ChatColor.DARK_RED + "[TabooLib - DEBUG][" + plugin.getName() + "] " + ChatColor.RED + var));
  }
}

代码示例来源:origin: garbagemule/MobArena

@Override
public boolean giveTo(Player player) {
  return Bukkit.getServer().dispatchCommand(
    Bukkit.getConsoleSender(),
    command.replace("<player>", player.getName())
  );
}

代码示例来源:origin: AddstarMC/Minigames

@Override
public void giveReward(MinigamePlayer player) {
  String finalCommand = command.replace("%player%", player.getName());
  Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), finalCommand);
}

代码示例来源:origin: mkremins/fanciful

private void send(CommandSender sender, String jsonString) {
  if (!(sender instanceof Player)) {
    sender.sendMessage(toOldMessageFormat());
    return;
  }
  Player player = (Player) sender;
  Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "tellraw " + player.getName() + " " + jsonString);
}

代码示例来源:origin: Bkm016/TabooLib

public void error(String msg) {
  if (level <= ERROR) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§c错误", "§c" + TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§c错误", "§c" + TLocale.Translate.setColored(msg))));
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

public void verbose(String msg) {
  if (level <= VERBOSE) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§f全部", TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§f全部", TLocale.Translate.setColored(msg))));
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

public void info(String msg) {
  if (level <= INFO) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§b信息", TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§b信息", TLocale.Translate.setColored(msg))));
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

public void fine(String msg) {
  if (level <= FINE) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§a正常", TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§a正常", TLocale.Translate.setColored(msg))));
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

public void warn(String msg) {
  if (level <= WARN) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§6警告", "§6" + TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§6警告", "§6" + TLocale.Translate.setColored(msg))));
    }
  }
}

代码示例来源:origin: Bkm016/TabooLib

public void fatal(String msg) {
  if (level <= FATAL) {
    if (TabooLib.isSpigot()) {
      Bukkit.getConsoleSender().sendMessage(Strings.replaceWithOrder(pattern, name, "§4致命错误", "§4" + TLocale.Translate.setColored(msg)));
    } else {
      BungeeCord.getInstance().getConsole().sendMessage(TextComponent.fromLegacyText(Strings.replaceWithOrder(pattern, name, "§4致命错误", "§4" + TLocale.Translate.setColored(msg))));
    }
  }
}

相关文章