@Override public void log(String message) { message = C.format(message, C.replacements); if (!Settings.Chat.CONSOLE_COLOR) { message = message.replaceAll('\u00a7' + "[a-z|0-9]", ""); } if (this.server == null) { this.logger.info(message); return; } this.server.getConsole().sendMessage(SpongeUtil.getText(message)); }
@Override public void dispatchCommand(String command) { Sponge.getGame().getCommandManager().process(Sponge.getServer().getConsole().getCommandSource().get(), command); }
private void triggerMechanic(Location<World> location, @Nullable Player player) { if (player != null && !usePermission.hasPermission(player)) { player.sendMessage(USE_PERMISSIONS); return; } Sign sign = location.getTileEntity().map(tile -> (Sign) tile).get(); if (SignUtil.getTextRaw(sign, 0).equalsIgnoreCase("EXPANSION")) { return; } StringBuilder command = new StringBuilder(); do { if(command.length() > 0 && !SignUtil.getTextRaw(sign, 0).equals("EXPANSION")) break; sign = location.getTileEntity().map(tile -> (Sign) tile).get(); command.append(SignUtil.getTextRaw(sign, 2)).append(SignUtil.getTextRaw(sign, 3)); location = location.getRelative(Direction.DOWN); } while(isValid(location)); String commandString = command.toString(); if (player == null) { if (commandString.contains("@p")) { return; } } else { commandString = commandString.replace("@p", player.getName()); } if (commandString.startsWith("/")) { commandString = commandString.substring(1); } Sponge.getCommandManager().process(Sponge.getServer().getConsole(), commandString); }
private void onAccLoaded(UUID src, Account account) { CommandSource receiver = Sponge.getServer().getConsole(); if (src != null) { Optional<Player> player = Sponge.getServer().getPlayer(src); if (!player.isPresent()) { return; } receiver = player.get(); } if (account == null) { receiver.sendMessage(settings.getText().getAccountNotFound()); } else { String username = account.getUsername().orElseGet(() -> account.getId().toString()); String timeFormat = timeFormatter.withLocale(receiver.getLocale()).format(account.getLastLogin()); Text message = settings.getText().getLastOnline(username, timeFormat); receiver.sendMessage(message); } }
private void broadcast(Text msg) { SparkSpongePlugin.this.game.getServer().getConsole().sendMessage(msg); for (Player player : SparkSpongePlugin.this.game.getServer().getOnlinePlayers()) { if (player.hasPermission("spark")) { player.sendMessage(msg); } } }
public static void dispatchCommand(MessageReceivedEvent e) { String args[] = e.getMessage().getContentDisplay().replace(MagiBridge.getConfig().CHANNELS.CONSOLE_COMMAND + " ", "").split(" "); if (!canUseCommand(e.getMember(), args[0])) { DiscordHandler.sendMessageToChannel(e.getChannel().getId(), MagiBridge.getConfig().MESSAGES.CONSOLE_NO_PERMISSION); return; } String cmd = e.getMessage().getContentDisplay().replace(MagiBridge.getConfig().CHANNELS.CONSOLE_COMMAND + " ", ""); Sponge.getCommandManager().process(new BridgeCommandSource(e.getChannel().getId(), Sponge.getServer().getConsole()), cmd); }
uc.sendMessage(Sponge.getServer().getConsole(), Text.of(prefix, message, attachment), true);
switch (input) { case "Server": return Optional.of(game.getServer().getConsole()); case "RCON": break;
String lockCommand = settings.getGeneral().getLockCommand(); if (!lockCommand.isEmpty()) { commandManager.process(Sponge.getServer().getConsole(), lockCommand);