protected void collectFields(Map<String, FieldData> cachedFields, Class<? super T> clazz) throws ObjectMappingException { for (Field field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(Setting.class)) { Setting setting = field.getAnnotation(Setting.class); String path = setting.value(); if (path.isEmpty()) { path = field.getName(); } FieldData data = new FieldData(field, setting.comment()); field.setAccessible(true); if (!cachedFields.containsKey(path)) { cachedFields.put(path, data); } } } }
protected void collectFields(Map<String, FieldData> cachedFields, Class<? super T> clazz) throws ObjectMappingException { for (Field field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(Setting.class)) { Setting setting = field.getAnnotation(Setting.class); String path = setting.value(); if (path.isEmpty()) { path = field.getName(); } FieldData data = new FieldData(field, setting.comment()); field.setAccessible(true); if (!cachedFields.containsKey(path)) { cachedFields.put(path, data); } } } }
@ConfigSerializable public static class PrefixCategory { @Setting(value = "enabled") public boolean ENABLED = true; @Setting(value = "text") public String TEXT = "&6[Discord]"; @Setting(value = "hover") public String HOVER = "&bClick do join our Discord!"; @Setting(value = "link") public String LINK = "https://github.com/Eufranio/MagiBridge"; }
protected void collectFields(Map<String, FieldData> cachedFields, Class<? super T> clazz) throws ObjectMappingException { for (Field field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(Setting.class)) { Setting setting = field.getAnnotation(Setting.class); String path = setting.value(); if (path.isEmpty()) { path = field.getName(); } FieldData data = new FieldData(field, setting.comment()); field.setAccessible(true); if (!cachedFields.containsKey(path)) { cachedFields.put(path, data); } } } }
@ConfigSerializable public class LinkConfig extends BaseConfig { @Setting(comment = "The type of link which is used to connect multiple servers.\n" + "Can be one of 'None', 'WebSocket', 'Redis' or 'RabbitMQ'") public LinkType type = LinkType.None; @Setting(comment = "The url which this plugin should connect to.") public String url = ""; @Setting(comment = "The key that is used to identify this node. Make it long and secure!") public String privateKey = ""; }
@ConfigSerializable public static class NucleusCategory { @Setting(value = "global-discord-channel", comment = "Discord Channel ID which global messages are sent to") public String GLOBAL_CHANNEL = "GLOBAL_DISCORD_CHANNEL_ID_HERE"; @Setting(value = "staff-discord-channel", comment = "Discord Channel ID which messages from the staff chat are sent to") public String STAFF_CHANNEL = "STAFF_DISCORD_CHANNEL_ID_HERE"; @Setting(value = "helpop-channel", comment = "Channel that HelpOp messages will be sent to (if enabled)") public String HELPOP_CHANNEL = ""; }
@ConfigSerializable public static class AFKCategory { @Setting(value = "enabled") public boolean AFK_ENABLED = false; @Setting(value = "going", comment = "Message sent when a player goes AFK") public String GOING = "%player% is now AFK"; @Setting(value = "returning", comment = "Message sent when a player is not AFK anymore") public String RETURNING = "%player% is not AFK anymore"; } }
@ConfigSerializable public class BlockConfig extends BaseConfig { @Setting(comment = "This controls the maximum amount of blocks a client can get\n" + "in one Web-API call") public int maxBlockGetSize = 1000000; @Setting(comment = "This is the maximum amount of blocks that a client can change\n" + "in one Web-API call. Please note that not all blocks are changed\n" + "at once (see below)") public int maxBlockUpdateSize = 1000000; @Setting(comment = "The maximum number of blocks that are changed per second during\n" + "a block update (related to the setting above)") public int maxBlocksPerSecond = 1000; }
@ConfigSerializable public class CacheConfig extends BaseConfig { @Setting(comment = "The number of entries that are saved. This defines how \"far back\" the history goes.") public int chat_amount = 100; @Setting(comment = "The number of entries that are saved. This defines how \"far back\" the history goes.") public int cmd_amount = 100; @Setting(comment = "The number of seconds that the different types of data is cached for") public Map<String, Long> duration = new HashMap<>(); @Setting(comment = "These are commands that should not show up in the command log.\n" + "For example if you have a second auth plugin, or something where\n" + "players enter private data, put the command here, so that it's\n" + "filtered from the logs, and also won't show up in the admin panel.") public List<String> censoredCommands = Lists.newArrayList("register", "reg", "login", "password", "pass"); }
/** * Created by Frani on 27/09/2017. */ @ConfigSerializable public final class ConfigCategory { @Setting(value = "core") public CoreCategory CORE = new CoreCategory(); @Setting(value = "channel") public Channel CHANNELS = new Channel(); @Setting(value = "messages") public Messages MESSAGES = new Messages(); @Setting(value = "discord-to-mc-replacer") public Replacer REPLACER = new Replacer(); @Setting(value = "colors-converter") public Colors COLORS = new Colors(); }
/** * Configuration for the emitter settings. */ @ConfigSerializable public static class EmitterConfig { @Setting(value = "formatting-path", comment = "The path of the formatter configuration") public String formatting_path = "eclipse_formatter.xml"; @Setting(value = "import-order-path", comment = "The path of the import order configuration") public String imports_path = "eclipse.importorder"; @Setting(value = "formatting-type", comment = "One of: eclipse,intellij") public String formatting_type = "eclipse"; @Setting(value = "emit-synthetics", comment = "Whether to emit synthetic members") public boolean emit_synthetics = false; public boolean emit_this_for_fields = true; public boolean emit_this_for_methods = false; }
/** * Configuration for a targeted cleanup operation. */ @ConfigSerializable public static class CleanupConfigSection { @Setting(value = "operations", comment = "Cleanup operations to apply before emitting") public List<String> operations = new ArrayList<>(); @Setting(value = "targets", comment = "Class targets to apply this cleanup to") public List<String> targets = new ArrayList<>(); }
@ConfigSerializable public static class APConfig { @Setting(comment = "The base path where the AdminPanel is served") public String basePath = "/admin/"; @Setting(comment = "The list of servers in this AdminPanel") public List<APServer> servers; private APConfig() { servers = new ArrayList<>(); servers.add(new APServer()); } } }
/** * Created by Frani on 27/09/2017. */ @ConfigSerializable public class CoreCategory { @Setting(value = "bot-token", comment = "Bot Token of the Bot User that you want to be used when sending messages to Discord") public String BOT_TOKEN = ""; @Setting(value = "death-messages-enabled", comment = "Should MagiBridge send death messages to Discord?") public boolean DEATH_MESSAGES_ENABLED = true; @Setting(value = "advancement-messages-enabled", comment = "Should MagiBridge send advancement messages to Discord?") public boolean ADVANCEMENT_MESSAGES_ENABLED = true; @Setting(value = "use-boop", comment = "Should MagiBridge enable Boop support? Will only work if Boop is installed and updated") public boolean USE_BOOP = false; @Setting(value = "hide-vanished-chat", comment = "Don't send messages of a player to Discord if he is vanished") public boolean HIDE_VANISHED_CHAT = false; @Setting(value = "cut-messages", comment = "Set to false if MagiBridge should NOT cut messages coming from Discord with more than\n" + "120 characters. This can turn the chat ugly if someone sends a big message") public boolean CUT_MESSAGES = false; @Setting(value = "topic-updater-interval", comment = "Topic Updater interval in seconds, minimum is 10") public int UPDATER_INTERVAL = 10; @Setting(value = "enable-topic-updater", comment = "Should MagiBridge enable the Topic Updater, updating the topic of the main Discord channel?") public boolean ENABLE_UPDATER = true; @Setting(value = "send-helpop", comment = "Should MagiBridge send Nucleus' HelpOp messages to Discord? The channel that the messages will be sent\n" + "SHOULD be defined in the Channels section if this is enabled!") public boolean SEND_HELPOP = false; }
@Setting(comment = "Set this to true to enable the whitelist, false to turn it off") public boolean useWhitelist = true; @Setting(comment = "Add IP address that are allowed to connect to the Web-API to this list") public List<String> whitelist = Lists.newArrayList("127.0.0.1", "::1"); @Setting(comment = "Set this to true to enable the blacklist, false to turn it off") public boolean useBlacklist = false; @Setting(comment = "Add the IP addresses that are NOT allowed to connect to the Web-API to this list") public List<String> blacklist = new ArrayList<>(); @Setting(comment = "The servers which are allowed to pass the X-Forwarded-For header indicating that they are\n" + "forwarding a request for a client and are themselves a proxy. You can use IP addresses or\n" + "CIDR notation IP blocks (e.g. \"192.168.0.0/18\")") public List<String> allowedProxies = Lists.newArrayList("127.0.0.1", "::1"); @Setting(comment = "The access control origin header that is sent with each request.\n" + "This is useful if you want to prevent CORS,\n" + "but remember that it must at least include the server where the AdminPanel is running") public String accessControlOrigin = "*"; @Setting(value = "default", comment = "These are the default permissions that a client without a key receives") public PermissionStruct def = new PermissionStruct(SecurityService.emptyNode(), 1); @Setting(comment = "This is a map of keys, defining which keys give access to which endpoints.") public Map<String, PermissionStruct> keys = new HashMap<>();
@ConfigSerializable public class ServerConfig extends BaseConfig { @Setting(comment = "The number of stat entries that are saved per stat. Together with\n" + "the stat interval this defines how far back the stats history goes.") public int maxStats = 4320; @Setting(comment = "The interval in seconds at which the server stats are recorded.") public int statsInterval = 5; }
@Setting public boolean ActiveTime = true; @Setting public boolean CmdScheduler = true; @Setting public boolean GWMCrates = true; @Setting public boolean HuskyCrates = true; @Setting public boolean MMCRestrict = true; @Setting public boolean MMCTickets = true; @Setting public boolean Nucleus = true; @Setting public boolean RedProtect = true; @Setting public boolean UniversalMarket = true; @Setting public boolean VillagerShops = true;
@ConfigSerializable public static class UChatCategory { @Setting(value = "channels", comment = "Format: ChannelID = IngameChannelName, Example:\n" + "12345678912345 = global\n" + "Replace the default value with your own channels") public Map<String, String> UCHAT_CHANNELS = Maps.newHashMap(); @Setting(value = "channel-overrides", comment = "Channels defined here override the global format, so you can have per-channel formats") public Map<String, String> UCHAT_OVERRIDES = Maps.newHashMap(); public UChatCategory() { UCHAT_CHANNELS.put("12345678912345", "global"); UCHAT_OVERRIDES.put("global", "&7[&a&lG&7] &f%user%&7: %message%"); } }