Skip to content

Commit

Permalink
Update configurate branch
Browse files Browse the repository at this point in the history
  • Loading branch information
onebeastchris committed Feb 28, 2025
1 parent 42f135f commit cd44789
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public final class ConfigLoader {
GitHub: https://github.com/GeyserMC/Geyser
Discord: https://discord.gg/geysermc
Wiki: https://wiki.geysermc.org/
Wiki: https://geysermc.org/wiki
NOTICE: See https://wiki.geysermc.org/geyser/setup/ for the setup guide. Many video tutorials are outdated.
NOTICE: See https://geysermc.org/wiki/geyser/setup/ for the setup guide. Many video tutorials are outdated.
In most cases, especially with server hosting providers, further hosting-specific configuration is required.
--------------------------------""";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,21 @@ public class CreativeItemRegistryPopulator {
static List<CreativeItemGroup> readCreativeItemGroups(ItemRegistryPopulator.PaletteVersion palette, List<CreativeItemData> creativeItemData) {
GeyserBootstrap bootstrap = GeyserImpl.getInstance().getBootstrap();

JsonNode creativeItemEntries;
JsonArray creativeItemEntries;
try (InputStream stream = bootstrap.getResourceOrThrow(String.format("bedrock/creative_items.%s.json", palette.version()))) {
creativeItemEntries = GeyserImpl.JSON_MAPPER.readTree(stream).get("groups");
creativeItemEntries = JsonUtils.fromJson(stream).getAsJsonArray("groups");
} catch (Exception e) {
throw new AssertionError("Unable to load creative item groups", e);
}

List<CreativeItemGroup> creativeItemGroups = new ArrayList<>();
for (JsonNode creativeItemEntry : creativeItemEntries) {
CreativeItemCategory category = CreativeItemCategory.valueOf(creativeItemEntry.get("category").asText().toUpperCase(Locale.ROOT));
String name = creativeItemEntry.get("name").asText();
for (JsonElement creativeItemEntry : creativeItemEntries) {
JsonObject creativeItemEntryObject = creativeItemEntry.getAsJsonObject();
CreativeItemCategory category = CreativeItemCategory.valueOf(creativeItemEntryObject.get("category").getAsString().toUpperCase(Locale.ROOT));
String name = creativeItemEntryObject.get("name").getAsString();

JsonNode icon = creativeItemEntry.get("icon");
String identifier = icon.get("id").asText();
JsonElement icon = creativeItemEntryObject.get("icon");
String identifier = icon.getAsJsonObject().get("id").getAsString();

ItemData itemData;
if (identifier.equals("minecraft:air")) {
Expand Down Expand Up @@ -115,7 +116,8 @@ static void populate(ItemRegistryPopulator.PaletteVersion palette, Map<String, I
continue;
}

int groupId = ((JsonObject) itemNode).get("groupId") != null ? itemNode.getAsInt("groupId") : 0;
var groupIdElement = itemNode.getAsJsonObject().get("groupId");
int groupId = groupIdElement != null ? groupIdElement.getAsInt() : 0;

itemConsumer.accept(itemBuilder, groupId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ public void connect() {
upstream.sendPacket(playStatusPacket);

SetCommandsEnabledPacket setCommandsEnabledPacket = new SetCommandsEnabledPacket();
setCommandsEnabledPacket.setCommandsEnabled(!geyser.getConfig().isXboxAchievementsEnabled());
setCommandsEnabledPacket.setCommandsEnabled(!geyser.config().xboxAchievementsEnabled());
upstream.sendPacket(setCommandsEnabledPacket);

UpdateAttributesPacket attributesPacket = new UpdateAttributesPacket();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void packetSending(PacketSendingEvent event) {
ClientIntentionPacket intentionPacket = event.getPacket();

String address;
if (geyser.getConfig().getRemote().isForwardHost()) {
if (geyser.config().java().forwardHostname()) {
address = clientData.getServerAddress().split(":")[0];
} else {
address = intentionPacket.getHostname();
Expand Down Expand Up @@ -174,15 +174,15 @@ public void disconnected(DisconnectedEvent event) {
customDisconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.authentication_type_mismatch", locale);
// Explain that they may be looking for Floodgate.
geyser.getLogger().warning(GeyserLocale.getLocaleStringLog(
geyser.getPlatformType() == PlatformType.STANDALONE ?
geyser.platformType() == PlatformType.STANDALONE ?
"geyser.network.remote.floodgate_explanation_standalone"
: "geyser.network.remote.floodgate_explanation_plugin",
Constants.FLOODGATE_DOWNLOAD_LOCATION
));
} else {
// Likely that Floodgate is not configured correctly.
customDisconnectMessage = GeyserLocale.getPlayerLocaleString("geyser.network.remote.floodgate_login_error", locale);
if (geyser.getPlatformType() == PlatformType.STANDALONE) {
if (geyser.platformType() == PlatformType.STANDALONE) {
geyser.getLogger().warning(GeyserLocale.getLocaleStringLog("geyser.network.remote.floodgate_login_error_standalone"));
}
}
Expand All @@ -205,7 +205,7 @@ public void disconnected(DisconnectedEvent event) {
} else {
GeyserImpl.getInstance().getLogger().error("An exception occurred: ", cause);
}
if (geyser.getConfig().isDebugMode()) {
if (geyser.config().debugMode()) {
cause.printStackTrace();
}
}
Expand Down Expand Up @@ -235,7 +235,7 @@ public void packetError(PacketErrorEvent event) {
(event.getPacketClass() != null ? "(" + event.getPacketClass().getSimpleName() + ") " : "") +
event.getCause().getMessage())
);
if (geyser.getConfig().isDebugMode())
if (geyser.config().debugMode())
event.getCause().printStackTrace();
event.setSuppress(true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void initialize(GeyserItemStack itemStack) {
if (session.getTagCache().is(ItemTag.BUNDLES, itemStack)) {
if (itemStack.getBundleData() != null) {
session.getGeyser().getLogger().warning("Stack has bundle data already! It should not!");
if (session.getGeyser().getConfig().isDebugMode()) {
if (session.getGeyser().getLogger().isDebug()) {
session.getGeyser().getLogger().debug("Player: " + session.javaUsername());
session.getGeyser().getLogger().debug("Stack: " + itemStack);
}
Expand Down

0 comments on commit cd44789

Please sign in to comment.