Skip to content

Commit

Permalink
Update for configurate 4 and API changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Oct 20, 2020
1 parent dc7156b commit 5755368
Show file tree
Hide file tree
Showing 138 changed files with 2,354 additions and 1,802 deletions.
2 changes: 1 addition & 1 deletion SpongeAPI
Submodule SpongeAPI updated 24 files
+8 −6 build.gradle.kts
+1 −1 src/main/java/org/spongepowered/api/ResourceKey.java
+78 −6 src/main/java/org/spongepowered/api/advancement/criteria/trigger/Trigger.java
+58 −4 src/main/java/org/spongepowered/api/command/parameter/Parameter.java
+1 −1 src/main/java/org/spongepowered/api/command/registrar/CommandRegistrar.java
+31 −0 src/main/java/org/spongepowered/api/config/ConfigManager.java
+24 −2 src/main/java/org/spongepowered/api/config/ConfigRoot.java
+1 −1 src/main/java/org/spongepowered/api/config/DefaultConfig.java
+14 −1 src/main/java/org/spongepowered/api/data/DataRegistration.java
+2 −1 src/main/java/org/spongepowered/api/data/ImmutableDataProviderBuilder.java
+28 −15 src/main/java/org/spongepowered/api/data/Key.java
+2 −1 src/main/java/org/spongepowered/api/data/MutableDataProviderBuilder.java
+42 −23 src/main/java/org/spongepowered/api/data/persistence/DataQuery.java
+18 −4 src/main/java/org/spongepowered/api/data/persistence/DataStore.java
+1 −1 src/main/java/org/spongepowered/api/data/persistence/DataTranslator.java
+1 −1 src/main/java/org/spongepowered/api/data/persistence/DataTranslators.java
+24 −5 src/main/java/org/spongepowered/api/event/EventContextKey.java
+1 −1 src/main/java/org/spongepowered/api/event/EventManager.java
+1 −1 src/main/java/org/spongepowered/api/event/GenericEvent.java
+0 −1 src/main/java/org/spongepowered/api/event/lifecycle/StartingEngineEvent.java
+1 −1 src/main/java/org/spongepowered/api/statistic/StatisticCategory.java
+127 −367 src/main/java/org/spongepowered/api/util/TypeTokens.java
+3 −3 src/main/java/org/spongepowered/api/world/gamerule/GameRule.java
+30 −50 src/test/java/org/spongepowered/api/event/SpongeEventFactoryTest.java
27 changes: 11 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ dependencies {
implementation("org.ow2.asm:asm-tree:$asmVersion")

// Implementation-only Adventure
implementation("net.kyori:adventure-serializer-configurate3:4.1.1")
implementation("net.kyori:adventure-serializer-configurate4:4.2.0-SNAPSHOT")

annotationProcessor("org.spongepowered:mixin:$mixinVersion:processor")

Expand All @@ -239,19 +239,16 @@ dependencies {
applaunchConfig("org.spongepowered:plugin-spi:$pluginSpiVersion")
applaunchConfig("org.apache.logging.log4j:log4j-api:2.11.2")
applaunchConfig("com.google.guava:guava:$guavaVersion")
applaunchConfig("org.spongepowered:configurate-core:3.7.1") {
exclude(group = "com.google.inject", module = "guice")
exclude(group = "com.google.guava", module = "guava")
applaunchConfig(platform("org.spongepowered:configurate-bom:4.0.0-SNAPSHOT"))
applaunchConfig("org.spongepowered:configurate-core") {
exclude(group = "org.checkerframework", module = "checker-qual") // We use our own version
}
applaunchConfig("org.spongepowered:configurate-hocon:3.7.1") {
applaunchConfig("org.spongepowered:configurate-hocon") {
exclude(group = "org.spongepowered", module = "configurate-core")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "org.checkerframework", module = "checker-qual") // We use our own version
}
applaunchConfig("org.spongepowered:configurate-json:3.7.1") {
applaunchConfig("org.spongepowered:configurate-jackson") {
exclude(group = "org.spongepowered", module = "configurate-core")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "org.checkerframework", module = "checker-qual") // We use our own version
}
applaunchConfig("org.apache.logging.log4j:log4j-core:2.11.2")
Expand Down Expand Up @@ -563,6 +560,7 @@ project("SpongeVanilla") {
add(vanillaLaunch.implementationConfigurationName, vanillaMinecraftConfig)

vanillaInstallerConfig("com.google.code.gson:gson:2.8.0")
vanillaInstallerConfig("org.spongepowered:configurate-hocon:4.0.0-SNAPSHOT")
vanillaInstallerConfig("net.sf.jopt-simple:jopt-simple:5.0.3")
vanillaInstallerConfig("org.apache.logging.log4j:log4j-api:2.11.2")
vanillaInstallerConfig("org.apache.logging.log4j:log4j-core:2.11.2")
Expand All @@ -571,7 +569,7 @@ project("SpongeVanilla") {
vanillaInstallerImplementation(vanillaInstallerConfig)

vanillaAppLaunchConfig(project(":SpongeAPI"))
vanillaAppLaunchConfig("net.kyori:adventure-serializer-configurate3:4.1.1")
vanillaAppLaunchConfig("net.kyori:adventure-serializer-configurate4:4.2.0-SNAPSHOT")
vanillaAppLaunchConfig("org.spongepowered:mixin:$mixinVersion")
vanillaAppLaunchConfig("org.ow2.asm:asm-util:$asmVersion")
vanillaAppLaunchConfig("org.ow2.asm:asm-tree:$asmVersion")
Expand All @@ -582,19 +580,16 @@ project("SpongeVanilla") {
vanillaAppLaunchConfig("org.apache.logging.log4j:log4j-core:2.11.2")
vanillaAppLaunchConfig("com.zaxxer:HikariCP:2.6.3")
vanillaAppLaunchConfig("org.apache.logging.log4j:log4j-slf4j-impl:2.11.2")
vanillaAppLaunchConfig("org.spongepowered:configurate-core:3.7.1") {
exclude(group = "com.google.guava", module = "guava")
exclude(group = "com.google.inject", module = "guice")
vanillaAppLaunchConfig(platform("org.spongepowered:configurate-bom:4.0.0-SNAPSHOT"))
vanillaAppLaunchConfig("org.spongepowered:configurate-core") {
exclude(group = "org.checkerframework", module = "checker-qual")
}
vanillaAppLaunchConfig("org.spongepowered:configurate-hocon:3.7.1") {
vanillaAppLaunchConfig("org.spongepowered:configurate-hocon") {
exclude(group = "org.spongepowered", module = "configurate-core")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "org.checkerframework", module = "checker-qual")
}
vanillaAppLaunchConfig("org.spongepowered:configurate-json:3.7.1") {
vanillaAppLaunchConfig("org.spongepowered:configurate-jackson") {
exclude(group = "org.spongepowered", module = "configurate-core")
exclude(group = "com.google.guava", module = "guava")
exclude(group = "org.checkerframework", module = "checker-qual")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.server.ServerWorld;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.command.Command;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provider;
import com.google.inject.TypeLiteral;
import ninja.leaping.configurate.commented.CommentedConfigurationNode;
import ninja.leaping.configurate.loader.ConfigurationLoader;
import org.spongepowered.configurate.CommentedConfigurationNode;
import org.spongepowered.configurate.loader.ConfigurationLoader;
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.api.config.DefaultConfig;
import org.spongepowered.api.plugin.PluginContainer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,18 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

import java.util.ArrayList;
import java.util.List;

@ConfigSerializable
public class BrokenModCategory {

@Setting(value = "broken-network-handler-mods", comment = "A list of mod ids that have broken network handlers (they interact with the game from a Netty handler thread).\n"
@Setting("broken-network-handler-mods")
@Comment("A list of mod ids that have broken network handlers (they interact with the game from a Netty handler thread).\n"
+ "All network handlers from a forcibly scheduled to run on the main thread.\n"
+ "Note that this setting should be considered a last resort, and should only be used as a stopgap measure while waiting for a mod to properly fix the issue.")
private List<String> brokenNetworkHandlerMods = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
public class BungeeCordCategory {

@Setting(value = "ip-forwarding", comment = "If 'true', allows BungeeCord to forward IP address, UUID, and Game Profile to this server.")
@Setting(value = "ip-forwarding")
@Comment("If 'true', allows BungeeCord to forward IP address, UUID, and Game Profile to this server.")
private boolean ipForwarding = false;

public boolean getIpForwarding() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,37 +24,40 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

import java.util.HashMap;
import java.util.Map;

@ConfigSerializable
public class CommandsCategory {

@Setting(comment = "Command aliases will resolve conflicts when multiple plugins request a specific command, \n"
@Setting
@Comment("Command aliases will resolve conflicts when multiple plugins request a specific command, \n"
+ "Correct syntax is <unqualified command>=<plugin name> e.g. \"sethome=homeplugin\"")
private Map<String, String> aliases = new HashMap<>();

@Setting(value = "enforce-permission-checks-on-non-sponge-commands",
comment = "Some mods may not trigger a permission check when running their command. Setting this to\n"
+ "true will enforce a check of the Sponge provided permission (\"<modid>.command.<commandname>\").\n"
+ "Note that setting this to true may cause some commands that are generally accessible to all to\n"
+ "require a permission to run.\n\n"
+ "Setting this to true will enable greater control over whether a command will appear in\n"
+ "tab completion and Sponge's help command.\n\n"
+ "If you are not using a permissions plugin, it is highly recommended that this is set to false\n"
+ "(as it is by default).")
@Setting
@Comment("Some mods may not trigger a permission check when running their command. Setting this to\n"
+ "true will enforce a check of the Sponge provided permission (\"<modid>.command.<commandname>\").\n"
+ "Note that setting this to true may cause some commands that are generally accessible to all to\n"
+ "require a permission to run.\n\n"
+ "Setting this to true will enable greater control over whether a command will appear in\n"
+ "tab completion and Sponge's help command.\n\n"
+ "If you are not using a permissions plugin, it is highly recommended that this is set to false\n"
+ "(as it is by default).")
private boolean enforcePermissionChecksOnNonSpongeCommands = false;

@Setting(value = "multi-world-patches", comment = "Patches the specified commands to respect the world of the sender instead of applying the \n"
@Setting("multi-world-patches")
@Comment("Patches the specified commands to respect the world of the sender instead of applying the \n"
+ "changes on the all worlds.")
private Map<String, Boolean> multiWorldCommandPatches = new HashMap<>();

@Setting(value = "command-hiding",
comment = "Defines how Sponge should act when a user tries to access a command they do not have\n"
+ "permission for")
@Setting
@Comment("Defines how Sponge should act when a user tries to access a command they do not have\n"
+ "permission for")
private CommandsHiddenCategory commandHiding = new CommandsHiddenCategory();

public boolean isEnforcePermissionChecksOnNonSpongeCommands() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,23 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
public class CommandsHiddenCategory {

@Setting(value = "hide-on-discovery-attempt",
comment = "If this is true, when a user tries to tab complete a command, or use \"/sponge which\" or \n"
+ "\"/sponge:help\" this prevents commands a user does not have permission for from being completed.\n\n"
+ "Note that some commands may not show up during tab complete if a user does not have permission\n"
+ "regardless of this setting.")
@Setting("hide-on-discovery-attempt")
@Comment("If this is true, when a user tries to tab complete a command, or use \"/sponge which\" or \n"
+ "\"/sponge:help\" this prevents commands a user does not have permission for from being completed.\n\n"
+ "Note that some commands may not show up during tab complete if a user does not have permission\n"
+ "regardless of this setting.")
private boolean hideDuringDiscovery = true;

@Setting(value = "hide-on-execution-attempt",
comment = "If this is true, when a user tries to use a command they don't have permission for, Sponge\n"
+ "will act as if the command doesn't exist, rather than showing a no permissions message.")
@Setting("hide-on-execution-attempt")
@Comment("If this is true, when a user tries to use a command they don't have permission for, Sponge\n"
+ "will act as if the command doesn't exist, rather than showing a no permissions message.")
private boolean hideDuringExecution = false;

public boolean isHideDuringDiscovery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.common.applaunch.config.core.Config;

import java.util.HashMap;
Expand All @@ -47,7 +48,8 @@ public class CommonConfig implements Config {
@Setting
private GeneralCategory general = new GeneralCategory();

@Setting(comment = "Configuration options related to the SQL manager, including connection aliases etc")
@Setting
@Comment("Configuration options related to the SQL manager, including connection aliases etc")
private SqlCategory sql = new SqlCategory();

@Setting
Expand All @@ -56,32 +58,34 @@ public class CommonConfig implements Config {
@Setting
private PermissionCategory permission = new PermissionCategory();

@Setting(value = "modules")
@Setting("modules")
private ModuleCategory mixins = new ModuleCategory();

@Setting("ip-sets")
private Map<String, List<String>> ipSets = new HashMap<>();

@Setting(value = "bungeecord")
@Setting("bungeecord")
private BungeeCordCategory bungeeCord = new BungeeCordCategory();

@Setting
private ExploitCategory exploits = new ExploitCategory();

@Setting(value = "optimizations")
@Setting("optimizations")
private OptimizationCategory optimizations = new OptimizationCategory();

@Setting(value = "cause-tracker")
@Setting("cause-tracker")
private PhaseTrackerCategory causeTracker = new PhaseTrackerCategory();

@Setting(value = "teleport-helper", comment = "Blocks to blacklist for safe teleportation.")
@Setting("teleport-helper")
@Comment("Blocks to blacklist for safe teleportation.")
private TeleportHelperCategory teleportHelper = new TeleportHelperCategory();

@Setting(value = "broken-mods", comment = "Stopgap measures for dealing with broken mods")
@Setting("broken-mods")
@Comment("Stopgap measures for dealing with broken mods")
private BrokenModCategory brokenMods = new BrokenModCategory();

@Setting(value = "service-registration",
comment = "Enables server owners to require specific plugins to provide Sponge services")
@Setting("service-registration")
@Comment("Enables server owners to require specific plugins to provide Sponge services")
private ServicesCategory servicesCategory = new ServicesCategory();

@Setting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,25 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
public class DebugCategory {

@Setting(value = "thread-contention-monitoring", comment = "If 'true', Java's thread contention monitoring for thread dumps is enabled.")
@Setting("thread-contention-monitoring")
@Comment("If 'true', Java's thread contention monitoring for thread dumps is enabled.")
private boolean enableThreadContentionMonitoring = false;

@Setting(value = "concurrent-entity-checks", comment = "Detect and prevent certain attempts to use entities concurrently. \n"
@Setting("concurrent-entity-checks")
@Comment("Detect and prevent certain attempts to use entities concurrently. \n"
+ "WARNING: May drastically decrease server performance. Only set this to 'true' "
+ "to debug a pre-existing issue.")
private boolean concurrentEntityChecks = false;

@Setting(value = "concurrent-chunk-map-checks", comment = "Detect and prevent parts of PlayerChunkMap being called off the main thread.\n"
@Setting("concurrent-chunk-map-checks")
@Comment("Detect and prevent parts of PlayerChunkMap being called off the main thread.\n"
+ "This may decrease sever preformance, so you should only enable it when debugging a specific issue.")
private boolean concurrentChunkMapChecks = false;

Expand All @@ -54,7 +58,7 @@ public boolean isEnableThreadContentionMonitoring() {
return this.enableThreadContentionMonitoring;
}

public void setEnableThreadContentionMonitoring(boolean enableThreadContentionMonitoring) {
public void setEnableThreadContentionMonitoring(final boolean enableThreadContentionMonitoring) {
this.enableThreadContentionMonitoring = enableThreadContentionMonitoring;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,24 @@
*/
package org.spongepowered.common.applaunch.config.common;

import ninja.leaping.configurate.objectmapping.Setting;
import ninja.leaping.configurate.objectmapping.serialize.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;

@ConfigSerializable
public class EigenRedstoneCategory {

@Setting(value = "enabled", comment = "If 'true', uses theosib's redstone implementation which improves performance. \n"
@Setting("enabled")
@Comment("If 'true', uses theosib's redstone implementation which improves performance. \n"
+ "See https://bugs.mojang.com/browse/MC-11193 and \n "
+ " https://bugs.mojang.com/browse/MC-81098 for more information. \n"
+ "Note: We cannot guarantee compatibility with mods. Use at your discretion.")
private boolean isEnabled = false;
@Setting(value = "vanilla-search", comment = "If 'true', restores the vanilla algorithm for propagating redstone wire changes.")
@Setting("vanilla-search")
@Comment("If 'true', restores the vanilla algorithm for propagating redstone wire changes.")
private boolean vanillaSearch = false;
@Setting(value = "vanilla-decrement", comment = "If 'true', restores the vanilla algorithm for computing wire power levels when powering off.")
@Setting("vanilla-decrement")
@Comment("If 'true', restores the vanilla algorithm for computing wire power levels when powering off.")
private boolean vanillaDecrement = false;

public EigenRedstoneCategory() {
Expand Down
Loading

0 comments on commit 5755368

Please sign in to comment.