Java Code Examples for cn.nukkit.utils.TextFormat#ITALIC

The following examples show how to use cn.nukkit.utils.TextFormat#ITALIC . 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: Command.java    From Jupiter with GNU General Public License v3.0 6 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource) {
    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    TranslationContainer result = new TranslationContainer("chat.type.admin", new String[]{source.getName(), message});

    TranslationContainer colored = new TranslationContainer(TextFormat.GRAY + "" + TextFormat.ITALIC + "%chat.type.admin", new String[]{source.getName(), message});

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}
 
Example 2
Source File: Command.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource) {
    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    TranslationContainer result = new TranslationContainer("chat.type.admin", source.getName(), message);

    TranslationContainer colored = new TranslationContainer(TextFormat.GRAY + "" + TextFormat.ITALIC + "%chat.type.admin", source.getName(), message);

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}
 
Example 3
Source File: Command.java    From Nukkit with GNU General Public License v3.0 6 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, String message, boolean sendToSource) {
    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    TranslationContainer result = new TranslationContainer("chat.type.admin", new String[]{source.getName(), message});

    TranslationContainer colored = new TranslationContainer(TextFormat.GRAY + "" + TextFormat.ITALIC + "%chat.type.admin", new String[]{source.getName(), message});

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}
 
Example 4
Source File: Command.java    From Jupiter with GNU General Public License v3.0 5 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, TextContainer message, boolean sendToSource) {
    TextContainer m = message.clone();
    String resultStr = "[" + source.getName() + ": " + (!m.getText().equals(source.getServer().getLanguage().get(m.getText())) ? "%" : "") + m.getText() + "]";

    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    String coloredStr = TextFormat.GRAY + "" + TextFormat.ITALIC + resultStr;

    m.setText(resultStr);
    TextContainer result = m.clone();
    m.setText(coloredStr);
    TextContainer colored = m.clone();

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}
 
Example 5
Source File: Command.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, TextContainer message, boolean sendToSource) {
    TextContainer m = message.clone();
    String resultStr = "[" + source.getName() + ": " + (!m.getText().equals(source.getServer().getLanguage().get(m.getText())) ? "%" : "") + m.getText() + "]";

    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    String coloredStr = TextFormat.GRAY + "" + TextFormat.ITALIC + resultStr;

    m.setText(resultStr);
    TextContainer result = m.clone();
    m.setText(coloredStr);
    TextContainer colored = m.clone();

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}
 
Example 6
Source File: Command.java    From Nukkit with GNU General Public License v3.0 5 votes vote down vote up
public static void broadcastCommandMessage(CommandSender source, TextContainer message, boolean sendToSource) {
    TextContainer m = message.clone();
    String resultStr = "[" + source.getName() + ": " + (!m.getText().equals(source.getServer().getLanguage().get(m.getText())) ? "%" : "") + m.getText() + "]";

    Set<Permissible> users = source.getServer().getPluginManager().getPermissionSubscriptions(Server.BROADCAST_CHANNEL_ADMINISTRATIVE);

    String coloredStr = TextFormat.GRAY + "" + TextFormat.ITALIC + resultStr;

    m.setText(resultStr);
    TextContainer result = m.clone();
    m.setText(coloredStr);
    TextContainer colored = m.clone();

    if (sendToSource && !(source instanceof ConsoleCommandSender)) {
        source.sendMessage(message);
    }

    for (Permissible user : users) {
        if (user instanceof CommandSender) {
            if (user instanceof ConsoleCommandSender) {
                ((ConsoleCommandSender) user).sendMessage(result);
            } else if (!user.equals(source)) {
                ((CommandSender) user).sendMessage(colored);
            }
        }
    }
}