public LogListBlock putChild(String key) { updateKey(key); LogListBlock block = new LogListBlock(); items.put(key, block); return block; }
public LogListBlock put(String key, byte value) { put(key, String.valueOf(value)); return this; }
@Override public String toString() { return getOutput(""); } }
private void appendGlobalConfiguration() { appendHeader("Global Configuration"); LogListBlock log = new LogListBlock(); LogListBlock configLog = log.putChild("Configuration"); for (ConfigValue config : CraftBookPlugin.spongeInst().getConfig().getConfigurationNodes()) { ConfigurationNode node = SimpleCommentedConfigurationNode.root(); config.serializeDefault(node); configLog.put(config.getKey(), node.getString("UNKNOWN")); } append(log); appendln(); }
private void appendServerInformation() { appendHeader("Server Information"); LogListBlock log = new LogListBlock(); Runtime runtime = Runtime.getRuntime(); log.put("Java", "%s %s (%s)", System.getProperty("java.vendor"), System.getProperty("java.version"), System.getProperty("java.vendor.url")); log.put("Operating system", "%s %s (%s)", System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("os.arch")); log.put("Available processors", runtime.availableProcessors()); log.put("Free memory", runtime.freeMemory() / 1024 / 1024 + " MB"); log.put("Max memory", runtime.maxMemory() / 1024 / 1024 + " MB"); log.put("Total memory", runtime.totalMemory() / 1024 / 1024 + " MB"); //log.put("Server ID", Sponge.getServer().getServerId()); //log.put("Server name", Sponge.getServerName()); log.put("Platform", Sponge.getPlatform().getType().name()); log.put("Game version", Sponge.getPlatform().getMinecraftVersion().getName()); log.put("Player count", "%d/%d", Sponge.getServer().getOnlinePlayers().size(), Sponge.getServer().getMaxPlayers()); append(log); appendln(); }
protected String getOutput(String prefix) { StringBuilder out = new StringBuilder(); for (Map.Entry<String, Object> entry : items.entrySet()) { Object val = entry.getValue(); if (val instanceof LogListBlock) { out.append(prefix); out.append(padKey(entry.getKey(), maxKeyLength)); out.append(":\r\n"); out.append(((LogListBlock) val).getOutput(prefix + " ")); } else { out.append(prefix); out.append(padKey(entry.getKey(), maxKeyLength)); out.append(": "); out.append(val.toString()); out.append("\r\n"); } } return out.toString(); }
public LogListBlock put(String key, LogListBlock value) { updateKey(key); items.put(key, value); return this; }
protected void append(LogListBlock log) { output.append(log.toString()); }
private void appendModuleConfigurations() { appendHeader("Module Configurations"); LogListBlock log = new LogListBlock(); List<ModuleWrapper> enabledModules = CraftBookPlugin.spongeInst().moduleController.getModules().stream() .filter(ModuleWrapper::isEnabled).collect(Collectors.toList()); for (ModuleWrapper<?> moduleWrapper : enabledModules) { Object module = moduleWrapper.getModule().orElse(null); if (module == null || !(module instanceof DocumentationProvider)) { continue; } LogListBlock configLog = log.putChild(moduleWrapper.getName()); for (ConfigValue config : ((DocumentationProvider) module).getConfigurationNodes()) { ConfigurationNode node = SimpleCommentedConfigurationNode.root(); config.serializeDefault(node); configLog.put(config.getKey(), node.getString("UNKNOWN")); } } append(log); appendln(); } }
private void appendPluginInformation() { Collection<PluginContainer> plugins = Sponge.getPluginManager().getPlugins(); appendHeader("Plugins (" + plugins.size() + ')'); LogListBlock log = new LogListBlock(); for (PluginContainer plugin : plugins) { log.put(plugin.getName(), plugin.getVersion().orElse("UNKNOWN")); } append(log); appendln(); }
public LogListBlock put(String key, String value) { updateKey(key); items.put(key, String.valueOf(value)); return this; }
private void appendCraftBookInformation() { appendHeader("CraftBook Information"); LogListBlock log = new LogListBlock(); List<ModuleWrapper> enabledModules = CraftBookPlugin.spongeInst().moduleController.getModules().stream() .filter(ModuleWrapper::isEnabled).collect(Collectors.toList()); int i = enabledModules.size(); log.put("Mechanics Loaded", "%d", i); Optional<SpongeSelfTriggerManager> selfTriggerManagerOptional = CraftBookPlugin.spongeInst().getSelfTriggerManager() .map(stm -> (SpongeSelfTriggerManager) stm); log.put("ST Mechanics Loaded", "%d", selfTriggerManagerOptional.map(stm -> stm.getSelfTriggeringMechanics().size()).orElse(0)); append(log); appendln(); appendHeader("Loaded Mechanics"); log = new LogListBlock(); for(ModuleWrapper<?> mech : enabledModules) { log.put(mech.getName(), mech.getId() + '-' + mech.getVersion()); } append(log); appendln(); }
public LogListBlock put(String key, long value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, String value, Object ... args) { put(key, String.format(value, args)); return this; }
public LogListBlock put(String key, int value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, Object value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, double value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, short value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, float value) { put(key, String.valueOf(value)); return this; }
public LogListBlock put(String key, boolean value) { put(key, String.valueOf(value)); return this; }