Search in sources :

Example 1 with SecretChannel

use of com.easterlyn.chat.channel.SecretChannel in project Easterlyn by Easterlyn.

the class EasterlynChat method enable.

@Override
protected void enable() {
    // Permission to use >greentext.
    PermissionUtil.getOrCreate("easterlyn.chat.greentext", PermissionDefault.TRUE);
    // Permission to bypass all chat filtering.
    PermissionUtil.addParent("easterlyn.chat.spam", UserRank.MODERATOR.getPermission());
    PermissionUtil.addParent("easterlyn.chat.spam", "easterlyn.spam");
    // Permission to use all caps.
    PermissionUtil.getOrCreate("easterlyn.chat.spam.caps", PermissionDefault.TRUE);
    PermissionUtil.addParent("easterlyn.chat.spam.caps", "easterlyn.chat.spam");
    // Permission to use non-ascii characters and mixed case words.
    PermissionUtil.getOrCreate("easterlyn.chat.spam.normalize", PermissionDefault.TRUE);
    PermissionUtil.addParent("easterlyn.chat.spam.normalize", "easterlyn.chat.spam");
    // Permission to not be affected by speed limitations.
    PermissionUtil.getOrCreate("easterlyn.chat.spam.fast", PermissionDefault.TRUE);
    PermissionUtil.addParent("easterlyn.chat.spam.fast", "easterlyn.chat.spam");
    // Permission for gibberish filtering, average characters per word.
    PermissionUtil.addParent("easterlyn.chat.spam.gibberish", "easterlyn.chat.spam");
    // Permission to send duplicate messages in a row within 30 seconds.
    // Default false - quite handy to prevent accidental uparrow enter.
    PermissionUtil.getOrCreate("easterlyn.chat.spam.repeat", PermissionDefault.FALSE);
    // Permission for messages to automatically color using name color.
    PermissionUtil.getOrCreate("easterlyn.chat.color", PermissionDefault.FALSE);
    // Permission to be recognized as a moderator in every channel.
    PermissionUtil.addParent("easterlyn.chat.channel.moderator", UserRank.STAFF.getPermission());
    // Permission to be recognized as an owner in every channel.
    PermissionUtil.addParent("easterlyn.chat.channel.owner", UserRank.ADMIN.getPermission());
    // Permission to make funky channel names
    PermissionUtil.addParent("easterlyn.command.channel.create.anyname", UserRank.HEAD_ADMIN.getPermission());
    FileConfiguration config = getConfig();
    Set<String> remove = new HashSet<>();
    config.getKeys(false).forEach(key -> {
        if (!loadChannel(key, config.getConfigurationSection(key))) {
            remove.add(key);
        }
    });
    remove.forEach(key -> config.set(key, null));
    channels.put("", DEFAULT);
    channels.put("main", DEFAULT);
    channels.put("aether", DEFAULT);
    channels.put("discord", DEFAULT);
    channels.put("pm", new SecretChannel("pm", DEFAULT.getOwner()));
    channels.put("sign", new SecretChannel("sign", DEFAULT.getOwner()));
    channels.put("#", new SecretChannel("#", DEFAULT.getOwner()));
    getServer().getPluginManager().registerEvents(new ChannelManagementListener(this), this);
    getServer().getPluginManager().registerEvents(new MuteListener(), this);
// TODO
// - anti-spam listener
// - log signs to #sign
// - Add permission for translating & codes in chat
// - Allow overrides for channel hover
}
Also used : FileConfiguration(org.bukkit.configuration.file.FileConfiguration) SecretChannel(com.easterlyn.chat.channel.SecretChannel) ChannelManagementListener(com.easterlyn.chat.listener.ChannelManagementListener) HashSet(java.util.HashSet) MuteListener(com.easterlyn.chat.listener.MuteListener)

Aggregations

SecretChannel (com.easterlyn.chat.channel.SecretChannel)1 ChannelManagementListener (com.easterlyn.chat.listener.ChannelManagementListener)1 MuteListener (com.easterlyn.chat.listener.MuteListener)1 HashSet (java.util.HashSet)1 FileConfiguration (org.bukkit.configuration.file.FileConfiguration)1