Skip to content

Commit 19f7af5

Browse files
committed
Add uuid and minheight to world_Info()
1 parent c97a853 commit 19f7af5

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/main/java/com/laytonsmith/abstraction/MCWorld.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.laytonsmith.core.constructs.CClosure;
2121

2222
import java.util.List;
23+
import java.util.UUID;
2324

2425
public interface MCWorld extends MCMetadatable {
2526

@@ -31,6 +32,8 @@ public interface MCWorld extends MCMetadatable {
3132

3233
String getName();
3334

35+
UUID getUniqueID();
36+
3437
long getSeed();
3538

3639
MCWorldEnvironment getEnvironment();
@@ -43,6 +46,8 @@ public interface MCWorld extends MCMetadatable {
4346

4447
int getMaxHeight();
4548

49+
int getMinHeight();
50+
4651
MCDifficulty getDifficulty();
4752

4853
void setDifficulty(MCDifficulty difficulty);

src/main/java/com/laytonsmith/abstraction/bukkit/BukkitMCWorld.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
import java.util.ArrayList;
7979
import java.util.Collection;
8080
import java.util.List;
81+
import java.util.UUID;
8182

8283
public class BukkitMCWorld extends BukkitMCMetadatable implements MCWorld {
8384

@@ -153,6 +154,11 @@ public String getName() {
153154
return w.getName();
154155
}
155156

157+
@Override
158+
public UUID getUniqueID() {
159+
return w.getUID();
160+
}
161+
156162
@Override
157163
public long getSeed() {
158164
return w.getSeed();
@@ -235,6 +241,11 @@ public int getMaxHeight() {
235241
return getHandle().getMaxHeight();
236242
}
237243

244+
@Override
245+
public int getMinHeight() {
246+
return w.getMinHeight();
247+
}
248+
238249
@Override
239250
public MCBlock getBlockAt(int x, int y, int z) {
240251
return new BukkitMCBlock(w.getBlockAt(x, y, z));

src/main/java/com/laytonsmith/core/functions/World.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,11 +1456,13 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
14561456
}
14571457
CArray ret = CArray.GetAssociativeArray(t);
14581458
ret.set("name", new CString(w.getName(), t), t);
1459+
ret.set("uuid", new CString(w.getUniqueID().toString(), t), t);
14591460
ret.set("seed", new CInt(w.getSeed(), t), t);
14601461
ret.set("environment", new CString(w.getEnvironment().name(), t), t);
14611462
ret.set("generator", new CString(w.getGenerator(), t), t);
14621463
ret.set("worldtype", new CString(w.getWorldType().name(), t), t);
14631464
ret.set("sealevel", new CInt(w.getSeaLevel(), t), t);
1465+
ret.set("minheight", new CInt(w.getMinHeight(), t), t);
14641466
ret.set("maxheight", new CInt(w.getMaxHeight(), t), t);
14651467
return ret;
14661468
}
@@ -1477,9 +1479,9 @@ public Integer[] numArgs() {
14771479

14781480
@Override
14791481
public String docs() {
1480-
return "array {world} Returns an associative array of all the info needed to duplicate the world."
1481-
+ " The keys are name, seed, environment, generator, worldtype, sealevel and maxheight."
1482-
+ " ---- The worldtype is deprecated in 1.16 and is only applicable when creating a world.";
1482+
return "array {world} Returns an associative array of immutable info about the world."
1483+
+ " The keys are name, uuid, seed, environment, generator, sealevel, minheight and maxheight."
1484+
+ " The worldtype key is deprecated as of 1.16.";
14831485
}
14841486

14851487
@Override

0 commit comments

Comments
 (0)