-
-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switch config system to Configurate #5010
Open
Camotoy
wants to merge
53
commits into
master
Choose a base branch
from
feature/configurate
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 47 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
25e7deb
Start implementing Configurate config system
Camotoy dedb592
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy a135d3c
More development
Camotoy 25a755f
Start migrating to Gson only
Camotoy 10bf4ee
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy cb4c5ad
Progress
Camotoy 528de86
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy 8d24891
Update usage of WebUtils
Camotoy 2d33cfd
Most things now use Gson for JSON
Camotoy 0dadbc2
Allow tests to succeed by using new Gson version
Camotoy 7eb5b53
Use slightly cleaner version for Version deserializer
Camotoy 360350d
Work around older Gson versions without record support
Camotoy add02ca
GeyserCustomSkullConfiguration uses Configurate
Camotoy db9b951
Fix regression in properties get
Camotoy 29f8e29
New config used in core
Camotoy c095c27
The configuration is gone. Long live the config.
Camotoy ab4cc97
More changes and migrations away from Jackson
Camotoy 76ca326
Improve node ordering when updating configs
Konicai 0952f79
typo
Konicai e506c14
Better check for ignoring non-configurate configs for considering com…
Konicai f7a677e
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy 85d63de
Merge pull request #4954 from Konicai/feature/configurate
Camotoy d9d78cd
Ensure metrics UUID is valid
Camotoy f113c89
Initial advanced config
Camotoy 5870856
Remove Jackson; finish config value placements
Camotoy c4c8808
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy f40cbca
Remove duplicate relocate declarations
Camotoy a2e9e70
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy a6c21b1
Let annotations work
Camotoy b719278
Renaming to PluginSpecific
Camotoy 1271505
Use global bStats config where possible
Camotoy e99759d
Fix test
Camotoy 5551169
Re-introduce asterisk behavior in configs
Camotoy 45f8baf
Remove GeyserPluginBootstrap as it's no longer necessary
Camotoy adee6a7
Remove old config.yml file
Camotoy 869f7a8
Update Xbox achievement comment
Camotoy 2034ffa
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy 3448c2f
Apply suggestions from code review
Camotoy d03e661
Merge branch 'feature/configurate' of https://github.com/GeyserMC/Gey…
Camotoy 2ee488d
No need to remove values anymore
Camotoy a44edb3
Fix: disable bstats relocation on platforms where it is not needed
onebeastchris 02a361e
ensure it builds
onebeastchris 0d9b20a
Update custom unavailable slot comment
Camotoy bfd032d
Update cooldown image
Camotoy fc10ec2
Logger message for direct-compression still being enabled
Camotoy f42ee7d
Merge branch 'master' into feature/configurate
Camotoy 8b43498
oops
Camotoy 0a62562
More explicit RuntimeException message
Camotoy c4bed65
Constant for 'system' locale
Camotoy b2ea579
Better config JSON encoding (something is broken with Cloudflare; we'…
Camotoy c427630
Fix broadcast port default
Camotoy 6c5c451
Merge branch 'master' of https://github.com/GeyserMC/Geyser into feat…
Camotoy 8b51883
Add this file too
Camotoy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
...strap/bungeecord/src/main/java/org/geysermc/geyser/platform/bungeecord/BungeeMetrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2024 GeyserMC. http://geysermc.org | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
* | ||
* @author GeyserMC | ||
* @link https://github.com/GeyserMC/Geyser | ||
*/ | ||
|
||
package org.geysermc.geyser.platform.bungeecord; | ||
|
||
import net.md_5.bungee.api.plugin.Plugin; | ||
import net.md_5.bungee.config.Configuration; | ||
import net.md_5.bungee.config.ConfigurationProvider; | ||
import net.md_5.bungee.config.YamlConfiguration; | ||
import org.geysermc.geyser.util.metrics.MetricsPlatform; | ||
|
||
import java.io.BufferedWriter; | ||
import java.io.File; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.util.UUID; | ||
|
||
public final class BungeeMetrics implements MetricsPlatform { | ||
private final Configuration configuration; | ||
|
||
public BungeeMetrics(Plugin plugin) throws IOException { | ||
// https://github.com/Bastian/bstats-metrics/blob/master/bungeecord/src/main/java/org/bstats/bungeecord/Metrics.java | ||
File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); | ||
//noinspection ResultOfMethodCallIgnored | ||
bStatsFolder.mkdirs(); | ||
File configFile = new File(bStatsFolder, "config.yml"); | ||
if (!configFile.exists()) { | ||
writeFile(configFile, | ||
"# bStats (https://bStats.org) collects some basic information for plugin authors, like how", | ||
"# many people use their plugin and their total player count. It's recommended to keep bStats", | ||
"# enabled, but if you're not comfortable with this, you can turn this setting off. There is no", | ||
"# performance penalty associated with having metrics enabled, and data sent to bStats is fully", | ||
"# anonymous.", | ||
"enabled: true", | ||
"serverUuid: \"" + UUID.randomUUID() + "\"", | ||
"logFailedRequests: false", | ||
"logSentData: false", | ||
"logResponseStatusText: false"); | ||
} | ||
|
||
this.configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile); | ||
} | ||
|
||
@Override | ||
public boolean enabled() { | ||
return configuration.getBoolean("enabled", true); | ||
} | ||
|
||
@Override | ||
public String serverUuid() { | ||
return configuration.getString("serverUuid"); | ||
} | ||
|
||
@Override | ||
public boolean logFailedRequests() { | ||
return configuration.getBoolean("logFailedRequests", false); | ||
} | ||
|
||
@Override | ||
public boolean logSentData() { | ||
return configuration.getBoolean("logSentData", false); | ||
} | ||
|
||
@Override | ||
public boolean logResponseStatusText() { | ||
return configuration.getBoolean("logResponseStatusText", false); | ||
} | ||
|
||
private void writeFile(File file, String... lines) throws IOException { | ||
try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) { | ||
for (String line : lines) { | ||
bufferedWriter.write(line); | ||
bufferedWriter.newLine(); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's worth it to make this a default method in GeyserBootstrap - it's currently duplicated in every bootstrap impl