mirror of https://github.com/LOOHP/Limbo.git
1.16.3 Update / Added bstats Metrics
This commit is contained in:
parent
10789c3c60
commit
26c4b9d960
4
pom.xml
4
pom.xml
|
|
@ -4,7 +4,7 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>Limbo</groupId>
|
<groupId>Limbo</groupId>
|
||||||
<artifactId>Limbo</artifactId>
|
<artifactId>Limbo</artifactId>
|
||||||
<version>0.3.2-ALPHA</version>
|
<version>0.3.3-ALPHA</version>
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
<sourceDirectory>src</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
<finalName>${project.artifactId}-${project.version}-1.16.2</finalName>
|
<finalName>${project.artifactId}-${project.version}-1.16.3</finalName>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
|
|
|
||||||
|
|
@ -18,26 +18,30 @@ import com.loohp.limbo.Utils.YamlOrder;
|
||||||
|
|
||||||
public class FileConfiguration {
|
public class FileConfiguration {
|
||||||
|
|
||||||
|
File file;
|
||||||
|
|
||||||
Map<String, Object> mapping;
|
Map<String, Object> mapping;
|
||||||
String header;
|
String header;
|
||||||
|
|
||||||
public FileConfiguration(File file) {
|
public FileConfiguration(File file) throws FileNotFoundException {
|
||||||
|
this.file = file;
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
try {
|
reloadConfig();
|
||||||
reloadConfig(new FileInputStream(file));
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
mapping = new LinkedHashMap<>();
|
mapping = new LinkedHashMap<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public FileConfiguration(InputStream input){
|
public FileConfiguration(InputStream input){
|
||||||
reloadConfig(input);
|
reloadConfig(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileConfiguration reloadConfig(InputStream input) {
|
public FileConfiguration reloadConfig() throws FileNotFoundException {
|
||||||
|
return reloadConfig(new FileInputStream(file));
|
||||||
|
}
|
||||||
|
|
||||||
|
private FileConfiguration reloadConfig(InputStream input) {
|
||||||
Yaml yml = new Yaml();
|
Yaml yml = new Yaml();
|
||||||
mapping = yml.load(input);
|
mapping = yml.load(input);
|
||||||
return this;
|
return this;
|
||||||
|
|
@ -76,7 +80,7 @@ public class FileConfiguration {
|
||||||
}
|
}
|
||||||
map = map1;
|
map = map1;
|
||||||
}
|
}
|
||||||
if (value == null) {
|
if (value != null) {
|
||||||
map.put(tree[tree.length - 1], (T) value);
|
map.put(tree[tree.length - 1], (T) value);
|
||||||
} else {
|
} else {
|
||||||
map.remove(tree[tree.length - 1]);
|
map.remove(tree[tree.length - 1]);
|
||||||
|
|
@ -93,9 +97,13 @@ public class FileConfiguration {
|
||||||
customRepresenter.setPropertyUtils(customProperty);
|
customRepresenter.setPropertyUtils(customProperty);
|
||||||
Yaml yaml = new Yaml(customRepresenter, options);
|
Yaml yaml = new Yaml(customRepresenter, options);
|
||||||
|
|
||||||
|
if (file.getParentFile() != null) {
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
PrintWriter pw = new PrintWriter(file, StandardCharsets.UTF_8.toString());
|
PrintWriter pw = new PrintWriter(file, StandardCharsets.UTF_8.toString());
|
||||||
if (header != null) {
|
if (header != null) {
|
||||||
pw.println(header);
|
pw.println("#" + header.replace("\n", "\n#"));
|
||||||
}
|
}
|
||||||
yaml.dump(mapping, pw);
|
yaml.dump(mapping, pw);
|
||||||
pw.flush();
|
pw.flush();
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,6 @@ import com.loohp.limbo.World.World;
|
||||||
|
|
||||||
public class ServerProperties {
|
public class ServerProperties {
|
||||||
|
|
||||||
public static final String JSON_BASE_RESPONSE = "{\"version\":{\"name\":\"%VERSION%\",\"protocol\":%PROTOCOL%},\"players\":{\"max\":%MAXPLAYERS%,\"online\":%ONLINECLIENTS%},\"description\":%MOTD%,%FAVICON%\"modinfo\":{\"type\":\"FML\",\"modList\":[]}}";
|
|
||||||
|
|
||||||
File file;
|
File file;
|
||||||
int maxPlayers;
|
int maxPlayers;
|
||||||
int serverPort;
|
int serverPort;
|
||||||
|
|
@ -146,10 +144,6 @@ public class ServerProperties {
|
||||||
return allowFlight;
|
return allowFlight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getJsonBaseResponse() {
|
|
||||||
return JSON_BASE_RESPONSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMotdJson() {
|
public String getMotdJson() {
|
||||||
return motdJson;
|
return motdJson;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@ package com.loohp.limbo;
|
||||||
|
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.channels.Channels;
|
import java.nio.channels.Channels;
|
||||||
import java.nio.channels.ReadableByteChannel;
|
import java.nio.channels.ReadableByteChannel;
|
||||||
|
|
@ -36,6 +38,7 @@ import com.loohp.limbo.Events.EventsManager;
|
||||||
import com.loohp.limbo.File.ServerProperties;
|
import com.loohp.limbo.File.ServerProperties;
|
||||||
import com.loohp.limbo.GUI.GUI;
|
import com.loohp.limbo.GUI.GUI;
|
||||||
import com.loohp.limbo.Location.Location;
|
import com.loohp.limbo.Location.Location;
|
||||||
|
import com.loohp.limbo.Metrics.Metrics;
|
||||||
import com.loohp.limbo.Permissions.PermissionsManager;
|
import com.loohp.limbo.Permissions.PermissionsManager;
|
||||||
import com.loohp.limbo.Player.Player;
|
import com.loohp.limbo.Player.Player;
|
||||||
import com.loohp.limbo.Plugins.LimboPlugin;
|
import com.loohp.limbo.Plugins.LimboPlugin;
|
||||||
|
|
@ -97,8 +100,8 @@ public class Limbo {
|
||||||
|
|
||||||
//===========================
|
//===========================
|
||||||
|
|
||||||
public final String serverImplementationVersion = "1.16.2";
|
public final String serverImplementationVersion = "1.16.3";
|
||||||
public final int serverImplmentationProtocol = 751;
|
public final int serverImplmentationProtocol = 753;
|
||||||
|
|
||||||
private ServerConnection server;
|
private ServerConnection server;
|
||||||
private Console console;
|
private Console console;
|
||||||
|
|
@ -118,6 +121,8 @@ public class Limbo {
|
||||||
|
|
||||||
private DimensionRegistry dimensionRegistry;
|
private DimensionRegistry dimensionRegistry;
|
||||||
|
|
||||||
|
private Metrics metrics;
|
||||||
|
|
||||||
public AtomicInteger entityIdCount = new AtomicInteger();
|
public AtomicInteger entityIdCount = new AtomicInteger();
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|
@ -136,6 +141,8 @@ public class Limbo {
|
||||||
console = new Console(System.in, System.out, System.err);
|
console = new Console(System.in, System.out, System.err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.sendMessage("Loading Limbo Version " + new BufferedReader(new InputStreamReader(Limbo.class.getClassLoader().getResourceAsStream("META-INF/MANIFEST.MF"))).lines().filter(each -> each.startsWith("Limbo-Version:")).findFirst().orElse("Limbo-Version: unknown").substring(14).trim());
|
||||||
|
|
||||||
String spName = "server.properties";
|
String spName = "server.properties";
|
||||||
File sp = new File(spName);
|
File sp = new File(spName);
|
||||||
if (!sp.exists()) {
|
if (!sp.exists()) {
|
||||||
|
|
@ -283,6 +290,8 @@ public class Limbo {
|
||||||
|
|
||||||
server = new ServerConnection(properties.getServerIp(), properties.getServerPort());
|
server = new ServerConnection(properties.getServerIp(), properties.getServerPort());
|
||||||
|
|
||||||
|
metrics = new Metrics();
|
||||||
|
|
||||||
console.run();
|
console.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -354,6 +363,10 @@ public class Limbo {
|
||||||
return console;
|
return console;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Metrics getMetrics() {
|
||||||
|
return metrics;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Player> getPlayers() {
|
public Set<Player> getPlayers() {
|
||||||
return new HashSet<>(playersByUUID.values());
|
return new HashSet<>(playersByUUID.values());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -43,6 +43,7 @@ public class PluginManager {
|
||||||
if (name.endsWith("plugin.yml") || name.endsWith("limbo.yml")) {
|
if (name.endsWith("plugin.yml") || name.endsWith("limbo.yml")) {
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
FileConfiguration pluginYaml = new FileConfiguration(zip);
|
FileConfiguration pluginYaml = new FileConfiguration(zip);
|
||||||
String main = pluginYaml.get("main", String.class);
|
String main = pluginYaml.get("main", String.class);
|
||||||
String pluginName = pluginYaml.get("name", String.class);
|
String pluginName = pluginYaml.get("name", String.class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue