Skip to content

Commit ea68a31

Browse files
Merge branch 'v3.0' into recommended
2 parents 54dc316 + de38ef4 commit ea68a31

File tree

1,330 files changed

+6796
-8878
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,330 files changed

+6796
-8878
lines changed

.github/workflows/gibberish.txt

+1
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,4 @@ ForgeGradle
5959
Kosma
6060
Kosma's
6161
DEV
62+
Modrinth

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@
3737
/fabric-1.16.1_server.launch
3838
/fabric-1.16.2_client.launch
3939
/fabric-1.16.2_server.launch
40+

DynmapCore/build.gradle

+17-13
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ dependencies {
1919
implementation 'org.yaml:snakeyaml:1.23' // DON'T UPDATE - NEWER ONE TRIPS ON WINDOWS ENCODED FILES
2020
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20180219.1'
2121
implementation 'org.postgresql:postgresql:42.2.18'
22-
implementation 'io.github.linktosriram:s3-lite-core:0.2.0'
23-
implementation 'io.github.linktosriram:s3-lite-api:0.2.0'
24-
implementation 'io.github.linktosriram:s3-lite-http-client-url-connection:0.2.0'
25-
implementation 'io.github.linktosriram:s3-lite-http-client-spi:0.2.0'
26-
implementation 'io.github.linktosriram:s3-lite-util:0.2.0'
22+
implementation 'io.github.linktosriram.s3lite:core:0.0.2-SNAPSHOT'
23+
implementation 'io.github.linktosriram.s3lite:api:0.0.2-SNAPSHOT'
24+
implementation 'io.github.linktosriram.s3lite:http-client-url-connection:0.0.2-SNAPSHOT'
25+
implementation 'io.github.linktosriram.s3lite:http-client-spi:0.0.2-SNAPSHOT'
26+
implementation 'io.github.linktosriram.s3lite:util:0.0.2-SNAPSHOT'
27+
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:3.0.1'
28+
implementation 'com.sun.xml.bind:jaxb-impl:3.0.0'
2729
}
2830

2931
processResources {
@@ -46,7 +48,7 @@ processResources {
4648
}
4749

4850
jar {
49-
classifier = 'unshaded'
51+
archiveClassifier = 'unshaded'
5052
}
5153

5254
shadowJar {
@@ -58,11 +60,13 @@ shadowJar {
5860
include(dependency('org.eclipse.jetty::'))
5961
include(dependency('org.eclipse.jetty.orbit:javax.servlet:'))
6062
include(dependency('org.postgresql:postgresql:'))
61-
include(dependency('io.github.linktosriram:s3-lite-core:'))
62-
include(dependency('io.github.linktosriram:s3-lite-api:'))
63-
include(dependency('io.github.linktosriram:s3-lite-http-client-url-connection:'))
64-
include(dependency('io.github.linktosriram:s3-lite-http-client-spi:'))
65-
include(dependency('io.github.linktosriram:s3-lite-util:'))
63+
include(dependency('io.github.linktosriram.s3lite:core:'))
64+
include(dependency('io.github.linktosriram.s3lite:api:'))
65+
include(dependency('io.github.linktosriram.s3lite:http-client-url-connection:'))
66+
include(dependency('io.github.linktosriram.s3lite:http-client-spi:'))
67+
include(dependency('io.github.linktosriram.s3lite:util:'))
68+
include(dependency('jakarta.xml.bind::'))
69+
include(dependency('com.sun.xml.bind::'))
6670
include(dependency(':DynmapCoreAPI'))
6771
exclude("META-INF/maven/**")
6872
exclude("META-INF/services/**")
@@ -75,8 +79,8 @@ shadowJar {
7579
relocate('org.postgresql', 'org.dynmap.org.postgresql')
7680
relocate('io.github.linktosriram.s3lite', 'org.dynmap.s3lite')
7781

78-
destinationDir = file '../target'
79-
classifier = ''
82+
destinationDirectory = file '../target'
83+
archiveClassifier = ''
8084
}
8185

8286
artifacts {

DynmapCore/src/main/java/org/dynmap/ClientUpdateComponent.java

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class ClientUpdateComponent extends Component {
1212
private int hideifshadow;
1313
private int hideifunder;
1414
private boolean hideifsneaking;
15+
private boolean hideifspectator;
1516
private boolean hideifinvisiblepotion;
1617
private boolean is_protected;
1718
public static boolean usePlayerColors;
@@ -24,6 +25,7 @@ public ClientUpdateComponent(final DynmapCore core, ConfigurationNode configurat
2425
hideifshadow = configuration.getInteger("hideifshadow", 15);
2526
hideifunder = configuration.getInteger("hideifundercover", 15);
2627
hideifsneaking = configuration.getBoolean("hideifsneaking", false);
28+
hideifspectator = configuration.getBoolean("hideifspectator", false);
2729
hideifinvisiblepotion = configuration.getBoolean("hide-if-invisiblity-potion", true);
2830
is_protected = configuration.getBoolean("protected-player-info", false);
2931
usePlayerColors = configuration.getBoolean("use-name-colors", false);
@@ -100,6 +102,9 @@ else if(pw.isNether() == false) { /* Not nether */
100102
if((!hide) && hideifsneaking && p.isSneaking()) {
101103
hide = true;
102104
}
105+
if((!hide) && hideifspectator && p.isSpectator()) {
106+
hide = true;
107+
}
103108
if((!hide) && is_protected && (!see_all)) {
104109
if(e.user != null) {
105110
hide = !core.testIfPlayerVisibleToPlayer(e.user, p.getName());

DynmapCore/src/main/java/org/dynmap/DynmapCore.java

+9
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public static abstract class EnableCoreCallbacks {
164164
private File dataDirectory;
165165
private File tilesDirectory;
166166
private File exportDirectory;
167+
private File importDirectory;
167168
private String plugin_ver;
168169
private MapStorage defaultStorage;
169170

@@ -224,6 +225,9 @@ public final File getTilesFolder() {
224225
public final File getExportFolder() {
225226
return exportDirectory;
226227
}
228+
public final File getImportFolder() {
229+
return importDirectory;
230+
}
227231
public void setMinecraftVersion(String mcver) {
228232
this.platformVersion = mcver;
229233
}
@@ -428,6 +432,11 @@ public boolean initConfiguration(EnableCoreCallbacks cb) {
428432
if (!exportDirectory.isDirectory() && !exportDirectory.mkdirs()) {
429433
Log.warning("Could not create directory for exports ('" + exportDirectory + "').");
430434
}
435+
// Prime the imports directory
436+
importDirectory = getFile(configuration.getString("importpath", "import"));
437+
if (!importDirectory.isDirectory() && !importDirectory.mkdirs()) {
438+
Log.warning("Could not create directory for imports ('" + importDirectory + "').");
439+
}
431440
// Create default storage handler
432441
String storetype = configuration.getString("storage/type", "filetree");
433442
if (storetype.equals("filetree")) {

DynmapCore/src/main/java/org/dynmap/MarkersComponent.java

+12-9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class MarkersComponent extends ClientComponent {
3131
private MarkerSet spawnbedset;
3232
private MarkerIcon spawnbedicon;
3333
private String spawnbedformat;
34+
private boolean removebedonplayerleave;
3435
private long maxofflineage;
3536
private boolean showSpawn;
3637
private boolean showBorder;
@@ -180,23 +181,25 @@ public void playerEvent(DynmapPlayer p) {
180181

181182
spawnbedicon = api.getMarkerIcon(configuration.getString("spawnbedicon", "bed"));
182183
spawnbedformat = configuration.getString("spawnbedformat", "%name%'s bed");
183-
184+
removebedonplayerleave = configuration.getBoolean("spawnbedremoveonplayerleave", true);
184185
/* Add listener for players coming and going */
185186
core.listenerManager.addListener(EventType.PLAYER_JOIN, new PlayerEventListener() {
186187
@Override
187188
public void playerEvent(DynmapPlayer p) {
188189
updatePlayer(p);
189190
}
190191
});
191-
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
192-
@Override
193-
public void playerEvent(DynmapPlayer p) {
194-
Marker m = spawnbedset.findMarker(p.getName()+"_bed");
195-
if(m != null) {
196-
m.deleteMarker();
192+
if (removebedonplayerleave) {
193+
core.listenerManager.addListener(EventType.PLAYER_QUIT, new PlayerEventListener() {
194+
@Override
195+
public void playerEvent(DynmapPlayer p) {
196+
Marker m = spawnbedset.findMarker(p.getName() + "_bed");
197+
if (m != null) {
198+
m.deleteMarker();
199+
}
197200
}
198-
}
199-
});
201+
});
202+
}
200203
core.listenerManager.addListener(EventType.PLAYER_BED_LEAVE, new PlayerEventListener() {
201204
@Override
202205
public void playerEvent(final DynmapPlayer p) {

DynmapCore/src/main/java/org/dynmap/WebAuthManager.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import java.io.UnsupportedEncodingException;
88
import java.security.MessageDigest;
99
import java.security.NoSuchAlgorithmException;
10+
import java.security.SecureRandom;
1011
import java.util.ArrayList;
1112
import java.util.HashMap;
1213
import java.util.HashSet;
1314
import java.util.Properties;
14-
import java.util.Random;
1515
import java.util.Set;
1616

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

@@ -182,36 +182,36 @@ public boolean processWebRegisterCommand(DynmapCore core, DynmapCommandSender se
182182
boolean other = false;
183183
if(args.length > 1) {
184184
if(!core.checkPlayerPermission(sender, "webregister.other")) {
185-
sender.sendMessage("Not authorized to set web login information for other players");
185+
sender.sendMessage("You're not authorised to access web registration info for other players");
186186
return true;
187187
}
188188
uid = args[1];
189189
other = true;
190190
}
191191
else if (player == null) { /* Console? */
192-
sender.sendMessage("Must provide user ID to register web login");
192+
sender.sendMessage("Must provide username to access web registration info");
193193
return true;
194194
}
195195
else {
196196
uid = player.getName();
197197
}
198198
if (checkUserName(uid) == false) {
199-
sender.sendMessage("Invalid user ID");
199+
sender.sendMessage("Invalid username. Did you type it correctly?");
200200
return true;
201201
}
202202
String regkey = String.format("%04d-%04d", rnd.nextInt(10000), rnd.nextInt(10000));
203203
pending_registrations.put(uid.toLowerCase(), regkey.toLowerCase());
204-
sender.sendMessage("Registration pending for user ID: " + uid);
204+
sender.sendMessage("Registration pending for username: " + uid);
205205
sender.sendMessage("Registration code: " + regkey);
206206
publicRegistrationURL = core.configuration.getString("publicURL", "index.html");
207-
sender.sendMessage("Enter ID and code on registration web page (" + publicRegistrationURL.toString() + ") to complete registration");
207+
sender.sendMessage("Enter username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
208208
if(other) {
209209
DynmapPlayer p = core.getServer().getPlayer(uid);
210-
if(p != null) {
210+
if(p != null && sender != p) {
211211
p.sendMessage("The registration of your account for web access has been started.");
212212
p.sendMessage("To complete the process, access the Login page on the Dynmap map");
213213
p.sendMessage("Registration code: " + regkey);
214-
p.sendMessage("The user ID must match your account ID, but the password should NOT be the same.");
214+
p.sendMessage("Enter your username and registration code when prompted on web page (" + publicRegistrationURL.toString() + ") to complete registration");
215215
}
216216
}
217217
core.events.trigger("loginupdated", null);

DynmapCore/src/main/java/org/dynmap/common/DynmapPlayer.java

+6
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ public interface DynmapPlayer extends DynmapCommandSender {
4444
* @return true if sneaking
4545
*/
4646
public boolean isSneaking();
47+
48+
/**
49+
* get spectator gamemode
50+
* @return true if gamemode spectator
51+
*/
52+
public boolean isSpectator();
4753
/**
4854
* Get health
4955
* @return health points

DynmapCore/src/main/java/org/dynmap/common/chunk/GenericMapChunkCache.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,8 @@ public GenericMapChunkCache(GenericChunkCache c) {
618618

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

625625
/* Compute range */

DynmapCore/src/main/java/org/dynmap/hdmap/ChunkVersionHDShader.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ private static class DataVersionMap {
3434

3535
}
3636
};
37-
// Mapping from https://minecraft.fandom.com/wiki/Data_version
37+
// Mapping from https://minecraft.wiki/w/Data_version
3838
final static DataVersionMap[] versionmap = {
3939
new DataVersionMap(0, "unknown", 0x202020),
4040
new DataVersionMap(1519, "1.13.0", 0xF9E79F),
@@ -64,6 +64,13 @@ private static class DataVersionMap {
6464
new DataVersionMap(3120, "1.19.2", 0xe7aeb8),
6565
new DataVersionMap(3218, "1.19.3", 0xf8c0c8),
6666
new DataVersionMap(3337, "1.19.4", 0xffb6c1),
67+
new DataVersionMap(3465, "1.20.1", 0xe7aeb10),
68+
new DataVersionMap(3578, "1.20.2", 0xe196a7),
69+
new DataVersionMap(3698, "1.20.3", 0xe7aeb11),
70+
new DataVersionMap(3700, "1.20.4", 0xe196a8),
71+
new DataVersionMap(3837, "1.20.5", 0xe7aeb12),
72+
new DataVersionMap(3839, "1.20.6", 0xe196a9),
73+
new DataVersionMap(3953, "1.21.0", 0xe7aeb13),
6774

6875
};
6976
final static Color unknown_color = new Color(255, 255, 255);

0 commit comments

Comments
 (0)