Java Code Examples for org.bukkit.Bukkit#broadcastMessage()
The following examples show how to use
org.bukkit.Bukkit#broadcastMessage() .
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: AutoRestarter.java From AnnihilationPro with MIT License | 6 votes |
private void beginRestart() { canRun = false; countingDown = true; data = AnnounceBar.getInstance().getData(); if(GameVars.getEndOfGameCommand().equals("")) { Bukkit.broadcastMessage("The auto restart feature has been activated, but no end of game command was specified."); Bukkit.broadcastMessage("Please have an admin set an end of game command if he wants this feature to work."); } else { Bukkit.getConsoleSender().sendMessage(ChatColor.RED+"Auto-restart actvated! restarting the server in "+this.countdown+" seconds."); Announcement ann = new Announcement(ChatColor.DARK_PURPLE + "Auto-restart in: {#}"); ann.setTime(this.countdown).setCallback(new Runnable() { @Override public void run() { countingDown = false; Bukkit.dispatchCommand(Bukkit.getConsoleSender(), GameVars.getEndOfGameCommand()); } }); AnnounceBar.getInstance().countDown(ann); } }
Example 2
Source File: TeamManager.java From skRayFall with GNU General Public License v3.0 | 6 votes |
/** * Create a empty team. * * @param teamName The reference name of the team. */ public void createTeam(String teamName) { if (!teamMap.containsKey(teamName)) { Team team = teamBoard.registerNewTeam(teamName); teamMap.put(teamName, team); for (Object p : Bukkit.getServer().getOnlinePlayers().toArray()) { Player tempPlayer = (Player) p; if (!(tempPlayer.getScoreboard().getTeams().contains(teamMap.get(teamName)))) { // Debug Bukkit.broadcastMessage("Team Reg!"); tempPlayer.getScoreboard().registerNewTeam(teamName); } } } }
Example 3
Source File: KDMListener.java From ProjectAres with GNU Affero General Public License v3.0 | 6 votes |
@EventHandler(priority = EventPriority.LOW) public void onMatchEnd(MatchEndEvent event) { Match match = event.getMatch(); Tourney plugin = Tourney.get(); this.session.appendMatch(match, plugin.getMatchManager().getTeamManager().teamToEntrant(Iterables.getOnlyElement(event.getMatch().needMatchModule(VictoryMatchModule.class).winners(), null))); Entrant winningParticipation = this.session.calculateWinner(); int matchesPlayed = this.session.getMatchesPlayed(); if (winningParticipation != null) { Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has been determined!"); Bukkit.broadcastMessage(ChatColor.AQUA + WordUtils.capitalize(winningParticipation.team().name()) + ChatColor.RESET + ChatColor.YELLOW + " wins! Congratulations!"); plugin.clearKDMSession(); } else if (matchesPlayed < 3) { Bukkit.broadcastMessage(ChatColor.YELLOW + "A winner has not yet been determined! Beginning match #" + (matchesPlayed + 1) + "..."); match.needMatchModule(CycleMatchModule.class).startCountdown(Duration.ofSeconds(15), session.getMap()); } else { Bukkit.broadcastMessage(ChatColor.YELLOW + "There is a tie! Congratulations to both teams!"); Tourney.get().clearKDMSession(); } }
Example 4
Source File: AnonymousListener.java From UhcCore with GNU General Public License v3.0 | 6 votes |
@Override public void onEnable(){ GameManager gm = GameManager.getGameManager(); ScoreboardManager sm = gm.getScoreboardManager(); if (!gm.getConfiguration().getProtocolLibLoaded()){ Bukkit.broadcastMessage(ChatColor.RED + "[UhcCore] For Anonymous ProtocolLib needs to be installed!"); getScenarioManager().removeScenario(Scenario.ANONYMOUS); return; } for (UhcPlayer uhcPlayer : gm.getPlayersManager().getAllPlayingPlayers()){ ProtocolUtils.setPlayerNickName(uhcPlayer, getPlayerNickName(uhcPlayer.getName())); sm.updatePlayerTab(uhcPlayer); } }
Example 5
Source File: ExampleSkriptAddon.java From skript-yaml with MIT License | 6 votes |
@Override public void onEnable() { Plugin skript = Bukkit.getServer().getPluginManager().getPlugin("Skript"); if (skript != null) { /* try { SkriptAddon addonInstance = Skript.registerAddon(this); addonInstance.loadClasses("my.awesome.plugin", "skript"); } catch (IOException e) { e.printStackTrace(); } */ Plugin skriptYaml = Bukkit.getServer().getPluginManager().getPlugin("skript-yaml"); if (skriptYaml != null) { if (SkriptYaml.isTagRegistered("example")) { SkriptYaml.registerTag(this, "example", ExampleClass.class, new ExampleRepresentedClass(), new ExampleConstructedClass()); Bukkit.broadcastMessage("skript-yaml found, hooks enabled."); } } } else { Bukkit.getPluginManager().disablePlugin(this); Bukkit.broadcastMessage("Skript not found, plugin disabled."); } }
Example 6
Source File: SilentNightListener.java From UhcCore with GNU General Public License v3.0 | 5 votes |
@Override public void onEnable() { // Disable Anonymous when enabled. if (isActivated(Scenario.ANONYMOUS)){ getScenarioManager().removeScenario(Scenario.ANONYMOUS); } // Check for ProtocolLib if (!getGameManager().getConfiguration().getProtocolLibLoaded()){ Bukkit.broadcastMessage(ChatColor.RED + "[UhcCore] For Anonymous ProtocolLib needs to be installed!"); getScenarioManager().removeScenario(Scenario.SILENTNIGHT); } }
Example 7
Source File: PunishmentCommands.java From CardinalPGM with MIT License | 5 votes |
@Command(aliases = {"kick", "k"}, desc = "Kick a player.", usage = "<player> [reason]", min = 1) @CommandPermissions("cardinal.punish.kick") public static void kick(CommandContext cmd, CommandSender sender) throws CommandException { Player kicked = Bukkit.getPlayer(cmd.getString(0)); if (kicked == null) { throw new CommandException(ChatConstant.ERROR_PLAYER_NOT_FOUND.getMessage(ChatUtil.getLocale(sender))); } if (!sender.isOp() && kicked.isOp()) { throw new CommandException(ChatConstant.ERROR_PLAYER_NOT_AFFECTED.getMessage(ChatUtil.getLocale(sender))); } String reason = cmd.argsLength() > 1 ? cmd.getJoinedStrings(1) : "You have been kicked!"; Bukkit.broadcastMessage(Players.getName(sender) + ChatColor.GOLD + " \u00BB Kicked \u00BB " + Players.getName(kicked) + ChatColor.GOLD + " \u00BB " + reason); kicked.kickPlayer(ChatColor.RED + "Kicked" + ChatColor.GOLD + " \u00BB " + ChatColor.AQUA + reason); }
Example 8
Source File: MessageCoordinator.java From StaffPlus with GNU General Public License v3.0 | 5 votes |
public void sendGlobalMessage(String message, String prefix) { if(message.isEmpty() && !prefix.isEmpty()) { return; } Bukkit.broadcastMessage(colorize(prefix + " " + message)); }
Example 9
Source File: TeamManager.java From skRayFall with GNU General Public License v3.0 | 5 votes |
/** * Set the a teams option by team name. * * @param team The reference name of the team. * @param option The option to be set. * @param status The options value to be set. */ public void setTeamOption(String team, Option option, OptionStatus status) { if (teamMap.containsKey(team)) { teamMap.get(team).setOption(option, status); for (Object p : Bukkit.getServer().getOnlinePlayers().toArray()) { // Debug Bukkit.broadcastMessage("Team option set!"); ((Player) p).getScoreboard().getTeam(team).setOption(option, status); } } }
Example 10
Source File: Localization.java From CS-CoreLib with GNU General Public License v3.0 | 5 votes |
/** * Sends all Messages the key is referring to * including the Prefix and specified Variables * * @param key The Key of those Messages * @param addPrefix Specify whether the Prefix will get added or not * @param variables All Variables which should be applied to the sent messages */ public void broadcastTranslation(String key, boolean addPrefix, Variable... variables) { String prefix = addPrefix && config.contains("prefix") ? getTranslation("prefix").get(0): ""; for (String translation: getTranslation(key)) { for (Variable variable: variables) { translation = variable.apply(translation); } Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', prefix + translation)); } }
Example 11
Source File: TeamManager.java From skRayFall with GNU General Public License v3.0 | 5 votes |
/** * Set the display name of a team by team name. * * @param team The reference name of the team. * @param newTeamName New name to be displayed */ public void setDisplayName(String team, String newTeamName) { if (teamMap.containsKey(team)) { teamMap.get(team).setDisplayName(newTeamName); for (Object p : Bukkit.getServer().getOnlinePlayers().toArray()) { // Debug Bukkit.broadcastMessage("Team display name set!"); ((Player) p).getScoreboard().getTeam(team).setDisplayName(newTeamName); } } }
Example 12
Source File: AdventurersGuildGUI.java From EliteMobs with GNU General Public License v3.0 | 4 votes |
@EventHandler public void onRankSelectorClick(InventoryClickEvent event) { if (!(event.getWhoClicked() instanceof Player)) return; if (!event.getInventory().getName().equalsIgnoreCase("Guild rank selector")) return; if (event.getCurrentItem() == null || event.getCurrentItem().getType().equals(Material.AIR)) return; event.setCancelled(true); if (!event.getClickedInventory().getName().equals("Guild rank selector")) { event.setCancelled(true); return; } int maxTier = PlayerData.playerMaxGuildRank.get(event.getWhoClicked().getUniqueId()); int selectedTier = event.getSlot() + 1; if (selectedTier < maxTier + 1) { PlayerData.playerSelectedGuildRank.put(event.getWhoClicked().getUniqueId(), selectedTier); difficultyMenu((Player) event.getWhoClicked()); } if (selectedTier == maxTier + 1) { if (EconomyHandler.checkCurrency(event.getWhoClicked().getUniqueId()) < tierPriceCalculator(selectedTier)) event.getWhoClicked().sendMessage("[EliteMobs] You don't have enough Elite Coins! Sell some Elite Mob loot to [/em shop]!"); else { EconomyHandler.subtractCurrency(event.getWhoClicked().getUniqueId(), tierPriceCalculator(selectedTier)); PlayerData.playerMaxGuildRank.put(event.getWhoClicked().getUniqueId(), selectedTier); event.getWhoClicked().sendMessage(ChatColorConverter.convert("&aYou have unlocked the " + rankNamer(selectedTier) + " &arank for " + tierPriceCalculator(selectedTier) + " " + ConfigValues.economyConfig.getString(EconomySettingsConfig.CURRENCY_NAME) + ". \n&6Happy hunting!")); difficultyMenu((Player) event.getWhoClicked()); Bukkit.broadcastMessage(ChatColorConverter.convert( ((Player) event.getWhoClicked()).getDisplayName() + " has reached the " + rankNamer(selectedTier) + " &fguild rank!")); if (ConfigValues.adventurersGuildConfig.getBoolean(AdventurersGuildConfig.ADD_MAX_HEALTH)) event.getWhoClicked().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue((selectedTier - 10) * 2 + 20); } } if (selectedTier > maxTier + 1) { event.getWhoClicked().sendMessage("[EliteMobs] You need to unlock other ranks first!"); } }
Example 13
Source File: BroadcastIconCommand.java From ChestCommands with GNU General Public License v3.0 | 4 votes |
@Override public void execute(Player player) { Bukkit.broadcastMessage(getParsedCommand(player)); }
Example 14
Source File: EntityLivingTransformer.java From RuntimeTransformer with MIT License | 4 votes |
@Inject(InjectionType.APPEND) public void setHealth_INJECTED(float f) { Bukkit.broadcastMessage("Finished setting health"); }
Example 15
Source File: GlobalChannel.java From CardinalPGM with MIT License | 4 votes |
@Override public void sendMessage(String string) { Bukkit.broadcastMessage(string); }
Example 16
Source File: EntityLivingTransformer.java From RuntimeTransformer with MIT License | 4 votes |
@Inject(InjectionType.INSERT) public void _init_(World world) { Bukkit.broadcastMessage("Entity created!"); throw null; }
Example 17
Source File: AxcBan.java From FunnyGuilds with Apache License 2.0 | 4 votes |
@Override public void execute(CommandSender sender, String[] args) { MessageConfiguration messages = FunnyGuilds.getInstance().getMessageConfiguration(); if (args.length < 1) { sender.sendMessage(messages.generalNoTagGiven); return; } else if (args.length < 2) { sender.sendMessage(messages.adminNoBanTimeGiven); return; } else if (args.length < 3) { sender.sendMessage(messages.adminNoReasonGiven); return; } Guild guild = GuildUtils.getByTag(args[0]); if (guild == null) { sender.sendMessage(messages.generalNoGuildFound); return; } if (guild.isBanned()) { sender.sendMessage(messages.adminGuildBanned); return; } long time = TimeUtils.parseTime(args[1]); if (time < 1) { sender.sendMessage(messages.adminTimeError); return; } StringBuilder reasonBuilder = new StringBuilder(); for (int i = 2; i < args.length; i++) { reasonBuilder.append(args[i]); reasonBuilder.append(" "); } String reason = reasonBuilder.toString(); User admin = (sender instanceof Player) ? User.get(sender.getName()) : null; if (!SimpleEventHandler.handle(new GuildBanEvent(admin == null ? EventCause.CONSOLE : EventCause.ADMIN, admin, guild, time, reason))) { return; } BanUtils.ban(guild, time, reason); MessageFormatter formatter = new MessageFormatter() .register("{GUILD}", guild.getName()) .register("{TAG}", guild.getTag()) .register("{TIME}", args[1]) .register("{REASON}", ChatUtils.colored(reason)); sender.sendMessage(formatter.format(messages.adminGuildBan)); Bukkit.broadcastMessage(formatter.format(messages.broadcastBan)); }
Example 18
Source File: BukkitService.java From AuthMeReloaded with GNU General Public License v3.0 | 2 votes |
/** * Broadcast a message to all players. * * @param message the message * @return the number of players */ public int broadcastMessage(String message) { return Bukkit.broadcastMessage(message); }
Example 19
Source File: ChannelMemberBukkitConsole.java From LunaChat with GNU Lesser General Public License v3.0 | 2 votes |
/** * 指定されたメッセージの内容を発言する * @param message メッセージ * @see com.github.ucchyocean.lc3.member.ChannelMember#chat(java.lang.String) */ public void chat(String message) { Bukkit.broadcastMessage("<" + getName() + ">" + message); }
Example 20
Source File: ChannelMemberBlock.java From LunaChat with GNU Lesser General Public License v3.0 | 2 votes |
/** * 指定されたメッセージの内容を発言する * @param message メッセージ * @see com.github.ucchyocean.lc3.member.ChannelMember#chat(java.lang.String) */ public void chat(String message) { Bukkit.broadcastMessage("<" + getName() + ">" + message); }