Skip to content

Commit

Permalink
Merge branch 'v3.0' into recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeprimm-mirific committed Jan 15, 2025
2 parents 54dc316 + de38ef4 commit ea68a31
Show file tree
Hide file tree
Showing 1,330 changed files with 6,796 additions and 8,878 deletions.
1 change: 1 addition & 0 deletions .github/workflows/gibberish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ ForgeGradle
Kosma
Kosma's
DEV
Modrinth
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
/fabric-1.16.1_server.launch
/fabric-1.16.2_client.launch
/fabric-1.16.2_server.launch

30 changes: 17 additions & 13 deletions DynmapCore/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ dependencies {
implementation 'org.yaml:snakeyaml:1.23' // DON'T UPDATE - NEWER ONE TRIPS ON WINDOWS ENCODED FILES
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
implementation 'org.postgresql:postgresql:42.2.18'
implementation 'io.github.linktosriram:s3-lite-core:0.2.0'
implementation 'io.github.linktosriram:s3-lite-api:0.2.0'
implementation 'io.github.linktosriram:s3-lite-http-client-url-connection:0.2.0'
implementation 'io.github.linktosriram:s3-lite-http-client-spi:0.2.0'
implementation 'io.github.linktosriram:s3-lite-util:0.2.0'
implementation 'io.github.linktosriram.s3lite:core:0.0.2-SNAPSHOT'
implementation 'io.github.linktosriram.s3lite:api:0.0.2-SNAPSHOT'
implementation 'io.github.linktosriram.s3lite:http-client-url-connection:0.0.2-SNAPSHOT'
implementation 'io.github.linktosriram.s3lite:http-client-spi:0.0.2-SNAPSHOT'
implementation 'io.github.linktosriram.s3lite:util:0.0.2-SNAPSHOT'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
implementation 'com.sun.xml.bind:jaxb-impl:3.0.0'
}

processResources {
Expand All @@ -46,7 +48,7 @@ processResources {
}

jar {
classifier = 'unshaded'
archiveClassifier = 'unshaded'
}

shadowJar {
Expand All @@ -58,11 +60,13 @@ shadowJar {
include(dependency('org.eclipse.jetty::'))
include(dependency('org.eclipse.jetty.orbit:javax.servlet:'))
include(dependency('org.postgresql:postgresql:'))
include(dependency('io.github.linktosriram:s3-lite-core:'))
include(dependency('io.github.linktosriram:s3-lite-api:'))
include(dependency('io.github.linktosriram:s3-lite-http-client-url-connection:'))
include(dependency('io.github.linktosriram:s3-lite-http-client-spi:'))
include(dependency('io.github.linktosriram:s3-lite-util:'))
include(dependency('io.github.linktosriram.s3lite:core:'))
include(dependency('io.github.linktosriram.s3lite:api:'))
include(dependency('io.github.linktosriram.s3lite:http-client-url-connection:'))
include(dependency('io.github.linktosriram.s3lite:http-client-spi:'))
include(dependency('io.github.linktosriram.s3lite:util:'))
include(dependency('jakarta.xml.bind::'))
include(dependency('com.sun.xml.bind::'))
include(dependency(':DynmapCoreAPI'))
exclude("META-INF/maven/**")
exclude("META-INF/services/**")
Expand All @@ -75,8 +79,8 @@ shadowJar {
relocate('org.postgresql', 'org.dynmap.org.postgresql')
relocate('io.github.linktosriram.s3lite', 'org.dynmap.s3lite')

destinationDir = file '../target'
classifier = ''
destinationDirectory = file '../target'
archiveClassifier = ''
}

artifacts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class ClientUpdateComponent extends Component {
private int hideifshadow;
private int hideifunder;
private boolean hideifsneaking;
private boolean hideifspectator;
private boolean hideifinvisiblepotion;
private boolean is_protected;
public static boolean usePlayerColors;
Expand All @@ -24,6 +25,7 @@ public ClientUpdateComponent(final DynmapCore core, ConfigurationNode configurat
hideifshadow = configuration.getInteger("hideifshadow", 15);
hideifunder = configuration.getInteger("hideifundercover", 15);
hideifsneaking = configuration.getBoolean("hideifsneaking", false);
hideifspectator = configuration.getBoolean("hideifspectator", false);
hideifinvisiblepotion = configuration.getBoolean("hide-if-invisiblity-potion", true);
is_protected = configuration.getBoolean("protected-player-info", false);
usePlayerColors = configuration.getBoolean("use-name-colors", false);
Expand Down Expand Up @@ -100,6 +102,9 @@ else if(pw.isNether() == false) { /* Not nether */
if((!hide) && hideifsneaking && p.isSneaking()) {
hide = true;
}
if((!hide) && hideifspectator && p.isSpectator()) {
hide = true;
}
if((!hide) && is_protected && (!see_all)) {
if(e.user != null) {
hide = !core.testIfPlayerVisibleToPlayer(e.user, p.getName());
Expand Down
9 changes: 9 additions & 0 deletions DynmapCore/src/main/java/org/dynmap/DynmapCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public static abstract class EnableCoreCallbacks {
private File dataDirectory;
private File tilesDirectory;
private File exportDirectory;
private File importDirectory;
private String plugin_ver;
private MapStorage defaultStorage;

Expand Down Expand Up @@ -224,6 +225,9 @@ public final File getTilesFolder() {
public final File getExportFolder() {
return exportDirectory;
}
public final File getImportFolder() {
return importDirectory;
}
public void setMinecraftVersion(String mcver) {
this.platformVersion = mcver;
}
Expand Down Expand Up @@ -428,6 +432,11 @@ public boolean initConfiguration(EnableCoreCallbacks cb) {
if (!exportDirectory.isDirectory() && !exportDirectory.mkdirs()) {
Log.warning("Could not create directory for exports ('" + exportDirectory + "').");
}
// Prime the imports directory
importDirectory = getFile(configuration.getString("importpath", "import"));
if (!importDirectory.isDirectory() && !importDirectory.mkdirs()) {
Log.warning("Could not create directory for imports ('" + importDirectory + "').");
}
// Create default storage handler
String storetype = configuration.getString("storage/type", "filetree");
if (storetype.equals("filetree")) {
Expand Down
21 changes: 12 additions & 9 deletions DynmapCore/src/main/java/org/dynmap/MarkersComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class MarkersComponent extends ClientComponent {
private MarkerSet spawnbedset;
private MarkerIcon spawnbedicon;
private String spawnbedformat;
private boolean removebedonplayerleave;
private long maxofflineage;
private boolean showSpawn;
private boolean showBorder;
Expand Down Expand Up @@ -180,23 +181,25 @@ public void playerEvent(DynmapPlayer p) {

spawnbedicon = api.getMarkerIcon(configuration.getString("spawnbedicon", "bed"));
spawnbedformat = configuration.getString("spawnbedformat", "%name%'s bed");

removebedonplayerleave = configuration.getBoolean("spawnbedremoveonplayerleave", true);
/* Add listener for players coming and going */
core.listenerManager.addListener(EventType.PLAYER_JOIN, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
updatePlayer(p);
}
});
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
Marker m = spawnbedset.findMarker(p.getName()+"_bed");
if(m != null) {
m.deleteMarker();
if (removebedonplayerleave) {
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
@Override
public void playerEvent(DynmapPlayer p) {
Marker m = spawnbedset.findMarker(p.getName() + "_bed");
if (m != null) {
m.deleteMarker();
}
}
}
});
});
}
core.listenerManager.addListener(EventType.PLAYER_BED_LEAVE, new PlayerEventListener() {
@Override
public void playerEvent(final DynmapPlayer p) {
Expand Down
18 changes: 9 additions & 9 deletions DynmapCore/src/main/java/org/dynmap/WebAuthManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Properties;
import java.util.Random;
import java.util.Set;

import org.dynmap.common.DynmapCommandSender;
Expand All @@ -26,7 +26,7 @@ public class WebAuthManager {
public static final String WEBAUTHFILE = "webauth.txt";
private static final String HASHSALT = "$HASH_SALT$";
private static final String PWDHASH_PREFIX = "hash.";
private Random rnd = new Random();
private SecureRandom rnd = new SecureRandom();
private DynmapCore core;
private String publicRegistrationURL;

Expand Down Expand Up @@ -182,36 +182,36 @@ public boolean processWebRegisterCommand(DynmapCore core, DynmapCommandSender se
boolean other = false;
if(args.length > 1) {
if(!core.checkPlayerPermission(sender, "webregister.other")) {
sender.sendMessage("Not authorized to set web login information for other players");
sender.sendMessage("You're not authorised to access web registration info for other players");
return true;
}
uid = args[1];
other = true;
}
else if (player == null) { /* Console? */
sender.sendMessage("Must provide user ID to register web login");
sender.sendMessage("Must provide username to access web registration info");
return true;
}
else {
uid = player.getName();
}
if (checkUserName(uid) == false) {
sender.sendMessage("Invalid user ID");
sender.sendMessage("Invalid username. Did you type it correctly?");
return true;
}
String regkey = String.format("%04d-%04d", rnd.nextInt(10000), rnd.nextInt(10000));
pending_registrations.put(uid.toLowerCase(), regkey.toLowerCase());
sender.sendMessage("Registration pending for user ID: " + uid);
sender.sendMessage("Registration pending for username: " + uid);
sender.sendMessage("Registration code: " + regkey);
publicRegistrationURL = core.configuration.getString("publicURL", "index.html");
sender.sendMessage("Enter ID and code on registration web page (" + publicRegistrationURL.toString() + ") to complete registration");
sender.sendMessage("Enter username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
if(other) {
DynmapPlayer p = core.getServer().getPlayer(uid);
if(p != null) {
if(p != null && sender != p) {
p.sendMessage("The registration of your account for web access has been started.");
p.sendMessage("To complete the process, access the Login page on the Dynmap map");
p.sendMessage("Registration code: " + regkey);
p.sendMessage("The user ID must match your account ID, but the password should NOT be the same.");
p.sendMessage("Enter your username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
}
}
core.events.trigger("loginupdated", null);
Expand Down
6 changes: 6 additions & 0 deletions DynmapCore/src/main/java/org/dynmap/common/DynmapPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ public interface DynmapPlayer extends DynmapCommandSender {
* @return true if sneaking
*/
public boolean isSneaking();

/**
* get spectator gamemode
* @return true if gamemode spectator
*/
public boolean isSpectator();
/**
* Get health
* @return health points
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ public GenericMapChunkCache(GenericChunkCache c) {

public void setChunks(DynmapWorld dw, List<DynmapChunk> chunks) {
this.dw = dw;
nsect = (dw.worldheight - dw.minY) >> 4;
sectoff = (-dw.minY) >> 4;
nsect = (int)Math.ceil((dw.worldheight - dw.minY) / 16.0);
sectoff = (int)(Math.ceil((-dw.minY) / 16.0));
this.chunks = chunks;

/* Compute range */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private static class DataVersionMap {

}
};
// Mapping from https://minecraft.fandom.com/wiki/Data_version
// Mapping from https://minecraft.wiki/w/Data_version
final static DataVersionMap[] versionmap = {
new DataVersionMap(0, "unknown", 0x202020),
new DataVersionMap(1519, "1.13.0", 0xF9E79F),
Expand Down Expand Up @@ -64,6 +64,13 @@ private static class DataVersionMap {
new DataVersionMap(3120, "1.19.2", 0xe7aeb8),
new DataVersionMap(3218, "1.19.3", 0xf8c0c8),
new DataVersionMap(3337, "1.19.4", 0xffb6c1),
new DataVersionMap(3465, "1.20.1", 0xe7aeb10),
new DataVersionMap(3578, "1.20.2", 0xe196a7),
new DataVersionMap(3698, "1.20.3", 0xe7aeb11),
new DataVersionMap(3700, "1.20.4", 0xe196a8),
new DataVersionMap(3837, "1.20.5", 0xe7aeb12),
new DataVersionMap(3839, "1.20.6", 0xe196a9),
new DataVersionMap(3953, "1.21.0", 0xe7aeb13),

};
final static Color unknown_color = new Color(255, 255, 255);
Expand Down
Loading

0 comments on commit ea68a31

Please sign in to comment.