Java Code Examples for org.bukkit.Bukkit#getConsoleSender()
The following examples show how to use
org.bukkit.Bukkit#getConsoleSender() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LunaChatAPIImpl.java From LunaChat with GNU Lesser General Public License v3.0 | 6 votes |
/** * ChannelMemberをChannelPlayerに変換する * @param cp * @return */ private ChannelPlayer convertChannelMemberToChannelPlayer(ChannelMember cm) { if ( cm == null ) return null; if ( cm instanceof ChannelMemberBungee ) return null; // Bungeeモードの場合は変換できない if ( cm instanceof ChannelMemberPlayer ) { return ChannelPlayer.getChannelPlayer(cm.toString()); } else if ( cm instanceof ChannelMemberBukkitConsole ) { return new ChannelPlayerConsole(Bukkit.getConsoleSender()); } else if ( cm instanceof ChannelMemberBlock ) { ChannelMemberBlock cmb = (ChannelMemberBlock)cm; if ( cmb.getBlockCommandSender() != null ) { return new ChannelPlayerBlock(cmb.getBlockCommandSender()); } } return null; }
Example 2
Source File: BukkitEventSender.java From LunaChat with GNU Lesser General Public License v3.0 | 6 votes |
/** * ChannelMemberをChannelPlayerに変換する * @param cm * @return */ private ChannelPlayer convertChannelMemberToChannelPlayer(ChannelMember cm) { if ( cm == null ) return null; if ( cm instanceof ChannelMemberBungee ) return null; // Bungeeモードの場合は変換できない if ( cm instanceof ChannelMemberPlayer ) { return ChannelPlayer.getChannelPlayer(cm.toString()); } else if ( cm instanceof ChannelMemberBukkitConsole ) { return new ChannelPlayerConsole(Bukkit.getConsoleSender()); } else if ( cm instanceof ChannelMemberBlock ) { ChannelMemberBlock cmb = (ChannelMemberBlock)cm; if ( cmb.getBlockCommandSender() != null ) { return new ChannelPlayerBlock(cmb.getBlockCommandSender()); } } return null; }
Example 3
Source File: Channel.java From LunaChat with GNU Lesser General Public License v3.0 | 6 votes |
/** * ChannelMemberをChannelPlayerに変換する * @param cp * @return */ private ChannelPlayer convertChannelMemberToChannelPlayer(ChannelMember cm) { if ( cm == null ) return null; if ( cm instanceof ChannelMemberBungee ) return null; // Bungeeモードの場合は変換できない if ( cm instanceof ChannelMemberPlayer ) { return ChannelPlayer.getChannelPlayer(cm.toString()); } else if ( cm instanceof ChannelMemberBukkitConsole ) { return new ChannelPlayerConsole(Bukkit.getConsoleSender()); } else if ( cm instanceof ChannelMemberBlock ) { ChannelMemberBlock cmb = (ChannelMemberBlock)cm; if ( cmb.getBlockCommandSender() != null ) { return new ChannelPlayerBlock(cmb.getBlockCommandSender()); } } return null; }
Example 4
Source File: BukkitEventListener.java From BungeePerms with GNU General Public License v3.0 | 6 votes |
@Override public void enable() { if (enabled) { return; } enabled = true; Bukkit.getPluginManager().registerEvents(this, BukkitPlugin.getInstance()); //inject into console // seems to be best place here BPPermissible permissible = new BPPermissible(Bukkit.getConsoleSender(), null, Injector.getPermissible(Bukkit.getConsoleSender())); permissible.inject(); //inject from players for (Player p : BukkitPlugin.getBukkitPlayers()) { if (!(Injector.getPermissible(p) instanceof BPPermissible)) { User u = config.isUseUUIDs() ? pm().getUser(p.getUniqueId()) : pm().getUser(p.getName()); BPPermissible perm = new BPPermissible(p, u, Injector.getPermissible(p)); perm.inject(); } p.recalculatePermissions(); } }
Example 5
Source File: HeavySpleef.java From HeavySpleef with GNU General Public License v3.0 | 6 votes |
private void checkConfigVersions(Configuration config, Path dataFolder) { if (config.getInt("config-version") < DefaultConfig.CURRENT_CONFIG_VERSION) { Path configSource = dataFolder.resolve(ConfigType.DEFAULT_CONFIG.getDestinationFileName()); Path configTarget = dataFolder.resolve("config_old.yml"); try { Files.move(configSource, configTarget, StandardCopyOption.REPLACE_EXISTING); URL configResource = getClass().getResource(ConfigType.DEFAULT_CONFIG.getClasspathResourceName()); copyResource(configResource, configSource.toFile()); ConsoleCommandSender sender = Bukkit.getConsoleSender(); sender.sendMessage(ChatColor.RED + "Due to a HeavySpleef 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); } } }
Example 6
Source File: ConfigVersion.java From CratesPlus with GNU General Public License v3.0 | 6 votes |
protected void runUpdate() { String configBackup = backupConfig(); ConsoleCommandSender console = Bukkit.getConsoleSender(); console.sendMessage(getCratesPlus().getPluginPrefix() + ChatColor.GREEN + "Converting config to version " + getVersion() + "..."); update(); getConfig().set("Config Version", getVersion()); save(); console.sendMessage(getCratesPlus().getPluginPrefix() + ChatColor.GREEN + "Conversion of config has completed."); if (configBackup != null && !configBackup.equalsIgnoreCase("")) { getCratesPlus().setConfigBackup(configBackup); console.sendMessage(getCratesPlus().getPluginPrefix() + ChatColor.GREEN + "Your old config was backed up to " + configBackup); } }
Example 7
Source File: CommandSign.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
@Override public boolean activate(Player player) { CommandSender sender = player; boolean wasOp = player.isOp(); if (executor == Executor.OP) { player.setOp(true); } else if (executor == Executor.CONSOLE) { sender = Bukkit.getConsoleSender(); } ((CommandTask) getRunnable()).setSender(sender, wasOp); startTask(); active = true; return true; }
Example 8
Source File: LunaChatAPIImpl.java From LunaChat with GNU Lesser General Public License v3.0 | 5 votes |
/** * ChannelPlayerをChannelMemberに変換する * @param cp * @return */ private ChannelMember convertChannelPlayerToChannelMember(ChannelPlayer cp) { if ( cp == null ) return null; if ( cp instanceof ChannelPlayerName || cp instanceof ChannelPlayerUUID ) { return ChannelMember.getChannelMember(cp.toString()); } else if ( cp instanceof ChannelPlayerConsole ) { return new ChannelMemberBukkitConsole(Bukkit.getConsoleSender()); } else if ( cp instanceof ChannelPlayerBlock ) { ChannelPlayerBlock cpb = (ChannelPlayerBlock)cp; if ( cpb.getBlockCommandSender() != null ) { return new ChannelMemberBlock(cpb.getBlockCommandSender()); } } return null; }
Example 9
Source File: BukkitEventSender.java From LunaChat with GNU Lesser General Public License v3.0 | 5 votes |
/** * ChannelMemberをCommandSenderに変換する * @param cm * @return */ private CommandSender convertChannelMemberToCommandSender(ChannelMember cm) { if ( cm == null ) return null; if ( cm instanceof ChannelMemberBungee ) return null; // Bungeeモードの場合は変換できない if ( cm instanceof ChannelMemberPlayer ) { return ((ChannelMemberPlayer)cm).getPlayer(); } else if ( cm instanceof ChannelMemberBukkitConsole ) { return Bukkit.getConsoleSender(); } else if ( cm instanceof ChannelMemberBlock ) { return ((ChannelMemberBlock)cm).getBlockCommandSender(); } return null; }
Example 10
Source File: CommandTask.java From DungeonsXL with GNU General Public License v3.0 | 5 votes |
@Override public void cancel() { super.cancel(); if (sender != Bukkit.getConsoleSender()) { sender.setOp(wasOp); } }
Example 11
Source File: FaweBukkit.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
@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)); } }
Example 12
Source File: ColouredConsoleSender.java From Thermos with GNU General Public License v3.0 | 5 votes |
public static ConsoleCommandSender getInstance() { if (Bukkit.getConsoleSender() != null) { return Bukkit.getConsoleSender(); } else { return new ColouredConsoleSender(); } }
Example 13
Source File: BukkitEventSender.java From LunaChat with GNU Lesser General Public License v3.0 | 5 votes |
/** * ChannelPlayerをChannelMemberに変換する * @param cp * @return */ private ChannelMember convertChannelPlayerToChannelMember(ChannelPlayer cp) { if ( cp == null ) return null; if ( cp instanceof ChannelPlayerName || cp instanceof ChannelPlayerUUID ) { return ChannelMember.getChannelMember(cp.toString()); } else if ( cp instanceof ChannelPlayerConsole ) { return new ChannelMemberBukkitConsole(Bukkit.getConsoleSender()); } else if ( cp instanceof ChannelPlayerBlock ) { ChannelPlayerBlock cpb = (ChannelPlayerBlock)cp; if ( cpb.getBlockCommandSender() != null ) { return new ChannelMemberBlock(cpb.getBlockCommandSender()); } } return null; }
Example 14
Source File: CombatManager.java From CombatLogX with GNU General Public License v3.0 | 5 votes |
private void runAsConsole(String command) { try { CommandSender console = Bukkit.getConsoleSender(); Bukkit.dispatchCommand(console, command); } catch(Throwable ex) { Logger logger = this.plugin.getLogger(); logger.log(Level.SEVERE, "An error occurred while executing a command as the console:", ex); } }
Example 15
Source File: ColouredConsoleSender.java From Kettle with GNU General Public License v3.0 | 5 votes |
public static ConsoleCommandSender getInstance() { if (Bukkit.getConsoleSender() != null) { return Bukkit.getConsoleSender(); } else { return new ColouredConsoleSender(); } }
Example 16
Source File: USBImporterExecutor.java From uSkyBlock with GNU General Public License v3.0 | 4 votes |
public USBImporterExecutor(uSkyBlock plugin) { this.plugin = plugin; double progressEveryPct = plugin.getConfig().getDouble("importer.progressEveryPct", 10); long progressEveryMs = plugin.getConfig().getLong("importer.progressEveryMs", 10000); progressTracker = new ProgressTracker(Bukkit.getConsoleSender(), marktr("\u00a7eProgress: {0,number,##}% ({1}/{2} - success:{3}, failed:{4}, skipped:{5}) ~ {6}"), progressEveryPct, progressEveryMs); }
Example 17
Source File: PostSetup.java From Slimefun4 with GNU General Public License v3.0 | 4 votes |
public static void loadItems() { Iterator<SlimefunItem> iterator = SlimefunPlugin.getRegistry().getEnabledSlimefunItems().iterator(); while (iterator.hasNext()) { SlimefunItem item = iterator.next(); if (item == null) { Slimefun.getLogger().log(Level.WARNING, "Removed bugged Item ('NULL?')"); iterator.remove(); } else { item.load(); } } loadAutomaticCraftingChamber(); loadOreGrinderRecipes(); loadSmelteryRecipes(); CommandSender sender = Bukkit.getConsoleSender(); int total = SlimefunPlugin.getRegistry().getEnabledSlimefunItems().size(); int slimefunOnly = countNonAddonItems(); sender.sendMessage(""); sender.sendMessage(ChatColor.GREEN + "######################### - Slimefun v" + SlimefunPlugin.getVersion() + " - #########################"); sender.sendMessage(""); sender.sendMessage(ChatColor.GREEN + "Successfully loaded " + total + " Items and " + SlimefunPlugin.getRegistry().getResearches().size() + " Researches"); sender.sendMessage(ChatColor.GREEN + "( " + slimefunOnly + " Items from Slimefun, " + (total - slimefunOnly) + " Items from " + SlimefunPlugin.getInstalledAddons().size() + " Addons )"); sender.sendMessage(""); sender.sendMessage(ChatColor.GREEN + "Slimefun is an Open-Source project that is kept alive by a large community."); sender.sendMessage(ChatColor.GREEN + "Consider helping us maintain this project by contributing on GitHub!"); if (SlimefunPlugin.getUpdater().getBranch().isOfficial()) { sender.sendMessage(""); sender.sendMessage(ChatColor.GREEN + " - Source Code: https://github.com/TheBusyBiscuit/Slimefun4"); sender.sendMessage(ChatColor.GREEN + " - Wiki: https://github.com/TheBusyBiscuit/Slimefun4/wiki"); sender.sendMessage(ChatColor.GREEN + " - Addons: https://github.com/TheBusyBiscuit/Slimefun4/wiki/Addons"); sender.sendMessage(ChatColor.GREEN + " - Bug Reports: https://github.com/TheBusyBiscuit/Slimefun4/issues"); sender.sendMessage(ChatColor.GREEN + " - Discord: https://discord.gg/fsD4Bkh"); } else { sender.sendMessage(ChatColor.GREEN + " - UNOFFICIALLY MODIFIED BUILD - NO OFFICIAL SUPPORT GIVEN"); } sender.sendMessage(""); SlimefunPlugin.getItemCfg().save(); SlimefunPlugin.getResearchCfg().save(); SlimefunPlugin.getRegistry().setAutoLoadingMode(true); }
Example 18
Source File: BukkitPlugin.java From BungeePerms with GNU General Public License v3.0 | 4 votes |
@Override public Sender getConsole() { return new BukkitSender(Bukkit.getConsoleSender()); }
Example 19
Source File: RedirectingLogHandler.java From Skript with GNU General Public License v3.0 | 4 votes |
public RedirectingLogHandler(final CommandSender recipient, final @Nullable String prefix) { this.recipient = recipient == Bukkit.getConsoleSender() ? null : recipient; this.prefix = prefix == null ? "" : prefix; }
Example 20
Source File: ConsoleIdentity.java From ProjectAres with GNU Affero General Public License v3.0 | 4 votes |
@Override public boolean belongsTo(CommandSender sender) { return sender == Bukkit.getConsoleSender(); }