Added ResourcePack related packets, along with sending and recieving them, and added PlayerResourcePackStatusEvent to simplify reading the incoming packets for plugins.

This commit is contained in:
GamerDuck123
2021-11-15 21:02:12 -05:00
parent d460ca735b
commit 92a4a85b50
11 changed files with 257 additions and 0 deletions
@@ -50,6 +50,11 @@ public class ServerProperties {
private double ticksPerSecond;
private boolean handshakeVerbose;
private String resourcePackSHA;
private String resourcePackLink;
private boolean resourcePackRequired;
private String resourcePackPrompt;
Optional<BufferedImage> favicon;
public ServerProperties(File file) throws IOException {
@@ -122,6 +127,11 @@ public class ServerProperties {
viewDistance = Integer.parseInt(prop.getProperty("view-distance"));
ticksPerSecond = Double.parseDouble(prop.getProperty("ticks-per-second"));
handshakeVerbose = Boolean.parseBoolean(prop.getProperty("handshake-verbose"));
resourcePackLink = prop.getProperty("resource-pack");
resourcePackSHA = prop.getProperty("resource-pack-sha1");
resourcePackRequired = Boolean.parseBoolean(prop.getProperty("required-resource-pack"));
resourcePackPrompt = prop.getProperty("resource-pack-prompt");
File png = new File("server-icon.png");
if (png.exists()) {
@@ -242,5 +252,21 @@ public class ServerProperties {
public boolean handshakeVerboseEnabled() {
return handshakeVerbose;
}
public String getResourcePackLink() {
return resourcePackLink;
}
public String getResourcePackSHA() {
return resourcePackSHA;
}
public boolean getResourcePackRequired() {
return resourcePackRequired;
}
public String getResourcePackPrompt() {
return resourcePackPrompt;
}
}