extended info provided with system_info
This commit is contained in:
1 parent
53f6a49b8d
commit
47f9efb0f2
3 files changed
+24
No files matched your search
@@ -621,7 +621,13 @@ Available options in the scarpet app space:
|
|||||||
* `game_view_distance` - the view distance
|
* `game_view_distance` - the view distance
|
||||||
* `game_mod_name` - the name of the base mod. Expect `'fabric'`
|
* `game_mod_name` - the name of the base mod. Expect `'fabric'`
|
||||||
* `game_version` - base version of the game
|
* `game_version` - base version of the game
|
||||||
|
* `game_target` - target release version
|
||||||
|
* `game_major_target` - major release target. For 1.12.2, that would be 12
|
||||||
|
* `game_minor_reease` - minor release target. For 1.12.2, that woudl be 2
|
||||||
|
* `game_protocol` - protocol version number
|
||||||
|
* `game_pack_version` - datapack version number
|
||||||
* `game_data_version` - data version of the game. Returns an integer, so it can be compared.
|
* `game_data_version` - data version of the game. Returns an integer, so it can be compared.
|
||||||
|
* `game_stable` - indicating if its a production release or a snapshot
|
||||||
|
|
||||||
Server related properties
|
Server related properties
|
||||||
* `server_motd` - the motd of the server visible when joining
|
* `server_motd` - the motd of the server visible when joining
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import carpet.CarpetServer;
|
|||||||
import carpet.CarpetSettings;
|
import carpet.CarpetSettings;
|
||||||
import carpet.script.CarpetContext;
|
import carpet.script.CarpetContext;
|
||||||
import carpet.script.CarpetScriptHost;
|
import carpet.script.CarpetScriptHost;
|
||||||
|
import carpet.script.value.BooleanValue;
|
||||||
import carpet.script.value.ListValue;
|
import carpet.script.value.ListValue;
|
||||||
import carpet.script.value.MapValue;
|
import carpet.script.value.MapValue;
|
||||||
import carpet.script.value.NumericValue;
|
import carpet.script.value.NumericValue;
|
||||||
@@ -59,7 +60,19 @@ public class SystemInfo {
|
|||||||
put("game_view_distance", c -> new NumericValue(c.s.getMinecraftServer().getPlayerManager().getViewDistance()));
|
put("game_view_distance", c -> new NumericValue(c.s.getMinecraftServer().getPlayerManager().getViewDistance()));
|
||||||
put("game_mod_name", c -> StringValue.of(c.s.getMinecraftServer().getServerModName()));
|
put("game_mod_name", c -> StringValue.of(c.s.getMinecraftServer().getServerModName()));
|
||||||
put("game_version", c -> StringValue.of(c.s.getMinecraftServer().getVersion()));
|
put("game_version", c -> StringValue.of(c.s.getMinecraftServer().getVersion()));
|
||||||
|
put("game_target", c -> StringValue.of(SharedConstants.getGameVersion().getReleaseTarget()));
|
||||||
|
put("game_protocol", c -> NumericValue.of(SharedConstants.method_31372()));
|
||||||
|
put("game_major_target", c -> {
|
||||||
|
String [] vers = SharedConstants.getGameVersion().getReleaseTarget().split("\\.");
|
||||||
|
return NumericValue.of((vers.length > 1)?Integer.parseInt(vers[1]):0);
|
||||||
|
});
|
||||||
|
put("game_minor_target", c -> {
|
||||||
|
String [] vers = SharedConstants.getGameVersion().getReleaseTarget().split("\\.");
|
||||||
|
return NumericValue.of((vers.length > 2)?Integer.parseInt(vers[2]):0);
|
||||||
|
});
|
||||||
|
put("game_stable", c -> BooleanValue.of(SharedConstants.getGameVersion().isStable()));
|
||||||
put("game_data_version", c->NumericValue.of(SharedConstants.getGameVersion().getWorldVersion()));
|
put("game_data_version", c->NumericValue.of(SharedConstants.getGameVersion().getWorldVersion()));
|
||||||
|
put("game_pack_version", c->NumericValue.of(SharedConstants.getGameVersion().getPackVersion()));
|
||||||
|
|
||||||
put("server_ip", c -> StringValue.of(c.s.getMinecraftServer().getServerIp()));
|
put("server_ip", c -> StringValue.of(c.s.getMinecraftServer().getServerIp()));
|
||||||
put("server_whitelisted", c -> new NumericValue(c.s.getMinecraftServer().isEnforceWhitelist()));
|
put("server_whitelisted", c -> new NumericValue(c.s.getMinecraftServer().isEnforceWhitelist()));
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ public class BooleanValue extends NumericValue
|
|||||||
boolValue = boolval;
|
boolValue = boolval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BooleanValue of(boolean value)
|
||||||
|
{
|
||||||
|
return value?TRUE:FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getString() {
|
public String getString() {
|
||||||
return boolValue?"true":"false";
|
return boolValue?"true":"false";
|
||||||
|
|||||||
Reference in new issue
Block a user