本文整理汇总了Java中org.bukkit.command.ConsoleCommandSender.sendMessage方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleCommandSender.sendMessage方法的具体用法?Java ConsoleCommandSender.sendMessage怎么用?Java ConsoleCommandSender.sendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.command.ConsoleCommandSender
的用法示例。
在下文中一共展示了ConsoleCommandSender.sendMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateConfigFiles
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void updateConfigFiles() {
final int verConfig = 210;
final int verLang = 211;
final int verFish = 212;
String msg = locale.getString("old-file");
ConsoleCommandSender console = getServer().getConsoleSender();
if (getConfig().getInt("version") != verConfig) {
// Update
console.sendMessage(String.format(msg, "config.yml"));
}
if (locale.getLangVersion() != verLang) {
// Update
console.sendMessage(String.format(msg, locale.getLangPath()));
}
if (locale.getFishVersion() != verFish) {
// Update
console.sendMessage(String.format(msg, locale.getFishPath()));
}
}
示例2: checkConfigVersions
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void checkConfigVersions(Configuration config, Path dataFolder) {
if (config.getInt("config-version", 0) < TradeConfiguration.CURRENT_CONFIG_VERSION) {
Path configSource = dataFolder.resolve(TradeConfiguration.DESTINATION_FILE_NAME);
Path configTarget = dataFolder.resolve("config_old.yml");
try {
Files.move(configSource, configTarget, StandardCopyOption.REPLACE_EXISTING);
URL configResource = getClass().getResource(TradeConfiguration.CLASSPATH_RESOURCE_NAME);
copyResource(configResource, configSource.toFile());
ConsoleCommandSender sender = Bukkit.getConsoleSender();
sender.sendMessage(ChatColor.RED + "Due to a SimpleTrading update your old configuration has been renamed");
sender.sendMessage(ChatColor.RED + "to config_old.yml and a new one has been generated. Make sure to");
sender.sendMessage(ChatColor.RED + "apply your old changes to the new config!");
} catch (IOException e) {
getLogger().log(Level.SEVERE, "Could not create updated configuration due to an IOException", e);
}
}
}
示例3: convertConfigV5
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void convertConfigV5(ConsoleCommandSender console, String oldConfig) {
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Converting config to version 5...");
for (String name : getConfig().getConfigurationSection("Crates").getKeys(false)) {
getConfig().set("Crates." + name + ".Key.Item", getConfig().getString("Crate Keys.Item"));
getConfig().set("Crates." + name + ".Key.Name", getConfig().getString("Crate Keys.Name"));
getConfig().set("Crates." + name + ".Key.Enchanted", getConfig().getBoolean("Crate Keys.Enchanted"));
}
getConfig().set("Crate Keys", null);
// Set config version
getConfig().set("Config Version", 5);
// Save config
saveConfig();
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Conversion of config has completed.");
if (oldConfig != null && !oldConfig.equalsIgnoreCase("")) {
configBackup = oldConfig;
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Your old config was backed up to " + oldConfig);
}
}
示例4: convertConfigV6
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void convertConfigV6(ConsoleCommandSender console, String oldConfig) {
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Converting config to version 6...");
if (getConfig().isSet("Hologram Text")) {
List<String> oldHologramList = getConfig().getStringList("Hologram Text");
getConfig().set("Default Hologram Text", oldHologramList);
getConfig().set("Hologram Text", null);
}
// Set config version
getConfig().set("Config Version", 6);
// Save config
saveConfig();
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Conversion of config has completed.");
if (oldConfig != null && !oldConfig.equalsIgnoreCase("")) {
configBackup = oldConfig;
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Your old config was backed up to " + oldConfig);
}
}
示例5: convertConfigV7
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void convertConfigV7(ConsoleCommandSender console, String oldConfig) {
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Converting config to version 7...");
if (getConfig().isSet("Crates")) {
for (String crate : getConfig().getConfigurationSection("Crates").getKeys(false)) {
if (!getConfig().isSet("Crates." + crate + ".Type")) {
getConfig().set("Crates." + crate + ".Type", "KeyCrate");
}
}
}
// Set config version
getConfig().set("Config Version", 7);
// Save config
saveConfig();
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Conversion of config has completed.");
if (oldConfig != null && !oldConfig.equalsIgnoreCase("")) {
configBackup = oldConfig;
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Your old config was backed up to " + oldConfig);
}
}
示例6: run
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
@Override
public void run(ConsoleCommandSender sender, String label, String[] args) {
if (args.length == 2) {
Integer i;
try {
i = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
sender.sendMessage(PAData.CORE.getPrefix() + "&cEl rango no es un número");
return;
}
if (i > Grupo.values().length - 1) {
sender.sendMessage(PAData.CORE.getPrefix() + "&cEste número es más grande de los rangos que hay");
return;
}
PAUser target = PAServer.getUser(plugin.getServer().getPlayer(args[0]));
if (target == null || !target.isOnline()) {
sender.sendMessage(Utils.colorize(PAData.CORE.getPrefix() + "&cEl jugador no está conectado"));
return;
}
target.getUserData().setGrupo(Grupo.values()[i]);
target.save();
sender.sendMessage(Utils.colorize(PAData.CORE.getPrefix() + "&3Rango cambiado a &c" + target.getName() + " &3: &" + Grupo.groupColor(Grupo.values()[i]) + Grupo.values()[i].toString()));
target.sendMessage(PAData.CORE.getPrefix() + "&6Tu rango ha sido cambiado a &" + Grupo.groupColor(Grupo.values()[i]) + Grupo.values()[i].toString());
}
}
示例7: updateCheck
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
public static void updateCheck(){
String version = Bukkit.getServer().getClass().getPackage().getName().replace(".", ",").split(",")[3];
if (!(version.equals("v1_7_R1")||version.equals("v1_7_R2")||version.equals("v1_7_R3")||version.equals("v1_7_R4"))){
if (ConfigManager.getConfig().getBoolean("Updates.Check")){
UpdateChecker.getLastUpdate();
Object[] updates = UpdateChecker.getLastUpdate();
if (updates.length == 2){
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
console.sendMessage(ChatColor.GREEN + "There is a new update for");
console.sendMessage(ChatColor.GREEN + "Command Blocker");
console.sendMessage(ChatColor.RED + "Download at:");
console.sendMessage(ChatColor.LIGHT_PURPLE + "https://www.spigotmc.org/resources/5280/");
console.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
if (ConfigManager.getConfig().getBoolean("Updates.TellPlayers")){
for (Player p : Bukkit.getOnlinePlayers()){
if (p.hasPermission("cb.updates")){
p.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
p.sendMessage(ChatColor.GREEN + "There is a new update for");
p.sendMessage(ChatColor.GREEN + "Command Blocker");
p.sendMessage(ChatColor.RED + "Download at:");
p.sendMessage(ChatColor.LIGHT_PURPLE + "https://www.spigotmc.org/resources/5280/");
p.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
}
}
}
}
}
}
}
示例8: updateCheck
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
public static void updateCheck(){
if (ConfigManager.getConfig().getBoolean("Updates.Check")){
UpdateChecker.getLastUpdate();
Object[] updates = UpdateChecker.getLastUpdate();
if (updates.length == 2){
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
console.sendMessage(ChatColor.GREEN + "There is a new update for");
console.sendMessage(ChatColor.GREEN + "Trey's Double Jump");
console.sendMessage(ChatColor.RED + "Download at:");
console.sendMessage(ChatColor.LIGHT_PURPLE + "https://www.spigotmc.org/resources/19630/");
console.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
if (ConfigManager.getConfig().getBoolean("Updates.TellPlayers")){
for (Player p : Bukkit.getOnlinePlayers()){
if (p.hasPermission("tdj.updates")){
p.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
p.sendMessage(ChatColor.GREEN + "There is a new update for");
p.sendMessage(ChatColor.GREEN + "Trey's Double Jump");
p.sendMessage(ChatColor.RED + "Download at:");
p.sendMessage(ChatColor.LIGHT_PURPLE + "https://www.spigotmc.org/resources/19630/");
p.sendMessage(ChatColor.AQUA + "+=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=+");
}
}
}
}
}
}
示例9: debug
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
@Override
public void debug(final String s) {
ConsoleCommandSender console = Bukkit.getConsoleSender();
if (console != null) {
console.sendMessage(BBC.color(s));
} else {
Bukkit.getLogger().info(BBC.color(s));
}
}
示例10: alert
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
public void alert(ChatColor color, String message) {
ConsoleCommandSender cs = getServer().getConsoleSender();
cs.sendMessage(color + message);
for (Player player : getServer().getOnlinePlayers()) {
if (player.isOp()) {
player.sendMessage(color + message);
}
}
}
示例11: run
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
@Override
public void run(List<String> args, String categoryName, String clioteName){
String mgs = "";
String server = args.get(0);
args.remove(0);
for(String arg : args){
mgs += arg + " ";
}
mgs = mgs.substring(0, mgs.length()-1);
if(!mgs.equals(EstiChat.lastSent)){
ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
console.sendMessage("[" + server + "] " + mgs);
}
}
示例12: convertConfigV3
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
private void convertConfigV3(ConsoleCommandSender console, String oldConfig) {
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Converting config to version 3...");
for (String crate : getConfig().getConfigurationSection("Crates").getKeys(false)) {
List<?> items = getConfig().getList("Crates." + crate + ".Items");
List<String> newItems = new ArrayList<>();
for (Object object : items) {
String i = object.toString();
if (i.toUpperCase().contains("COMMAND:")) {
newItems.add(i);
} else {
String newi = getCrateHandler().itemstackToString(getCrateHandler().stringToItemstackOld(i));
newItems.add(newi);
}
}
getConfig().set("Crates." + crate + ".Items", newItems);
}
// Remove old options
getConfig().set("Use Interact", null);
getConfig().set("Crate Previews", null);
getConfig().set("Crate Open GUI", null);
// Set config version
getConfig().set("Config Version", 3);
// Save config
saveConfig();
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Conversion of config has completed.");
if (oldConfig != null && !oldConfig.equalsIgnoreCase("")) {
configBackup = oldConfig;
console.sendMessage(pluginPrefix + ChatColor.GREEN + "Your old config was backed up to " + oldConfig);
}
}
示例13: onPlayerChat
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
@EventHandler(ignoreCancelled=true, priority=EventPriority.HIGHEST)
public void onPlayerChat(AsyncPlayerChatEvent event)
{
String message = event.getMessage();
Player player = event.getPlayer();
PlayerFaction playerFaction = this.plugin.getFactionManager().getPlayerFaction(player);
ChatChannel chatChannel = playerFaction == null ? ChatChannel.PUBLIC : playerFaction.getMember(player).getChatChannel();
Set<Player> recipients = event.getRecipients();
if ((chatChannel == ChatChannel.FACTION) || (chatChannel == ChatChannel.ALLIANCE)) {
if (isGlobalChannel(message))
{
message = message.substring(1, message.length()).trim();
event.setMessage(message);
}
else
{
Collection<Player> online = playerFaction.getOnlinePlayers();
if (chatChannel == ChatChannel.ALLIANCE)
{
Collection<PlayerFaction> allies = playerFaction.getAlliedFactions();
for (PlayerFaction ally : allies) {
online.addAll(ally.getOnlinePlayers());
}
}
recipients.retainAll(online);
event.setFormat(chatChannel.getRawFormat(player));
Bukkit.getPluginManager().callEvent(new FactionChatEvent(true, playerFaction, player, chatChannel, recipients, event.getMessage()));
return;
}
}
String format = this.essentials.getSettings().getChatFormat(this.essentials.getUser(player).getGroup());
String displayName = ChatColor.WHITE + format;
event.setFormat(format);
event.setCancelled(true);
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(getFormattedMessage(player, playerFaction, displayName, message, console));
for (Player recipient : event.getRecipients()) {
recipient.sendMessage(getFormattedMessage(player, playerFaction, displayName, message, recipient));
}
}
示例14: onEnable
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
@Override
public void onEnable()
{
if(LicenseManager.isAllowed())
try
{
instance = this;
prm = ProtocolLibrary.getProtocolManager();
MapManager.setup();
Clan.loadClans();
config = Configuration.load();
if(config.getStorageType() == StorageType.MYSQL)
mySQL = config.connectToMySQL();
BPPlayer.updateTable(mySQL);
Language.loadLanguage(PLUGIN_NAME, config.getLanguageFileName());
FileManager.loadOnlinePlayerHistory();
config.getRandomShop().build();
ChatManager.loadStrings();
InventoryMenuManager.initialize();
GameManager.loadGames();
GameManager.startPlayableGames();
redirectCommands();
StatisticsManager.startLoop();
NametagEditManager.setLoaded();
registerListeners();
afkm.startLoop();
MapManager.startLoop();
VIPManager.startLoops();
LobbyInfoManager.startLoop();
setEventManager();
DoubleMoneyManager.update();
getServer().clearRecipes();
World world = config.getLobbyLocation().getWorld();
world.setStorm(false);
world.setThundering(false);
world.setWeatherDuration(1000000000);
successfullyEnabled = true;
System.out.println("Breakpoint v" + getDescription().getVersion() + " by Limeth enabled!");
return;
}
catch (Throwable t)
{
Breakpoint.warn("Fatal error when enabling Breakpoint!");
t.printStackTrace();
}
else
{
ConsoleCommandSender ccs = Bukkit.getConsoleSender();
ccs.sendMessage(ChatColor.YELLOW + "###");
ccs.sendMessage(ChatColor.RED + "This server doesn't have the license to use Breakpoint. Contact us at " + ChatColor.WHITE + "[email protected]" + ChatColor.RED + ", please.");
ccs.sendMessage(ChatColor.YELLOW + "###");
}
successfullyEnabled = false;
getServer().getPluginManager().registerEvents(new BanListener(), this);
}
示例15: sendConsoleMessage
import org.bukkit.command.ConsoleCommandSender; //导入方法依赖的package包/类
public static void sendConsoleMessage(final String message)
{
ConsoleCommandSender console = Bukkit.getConsoleSender();
console.sendMessage(message);
}