From 917991aee58bd46b1376f3a8dd11f1213e7b3644 Mon Sep 17 00:00:00 2001 From: Gabriel Harris-Rouquette Date: Mon, 30 Sep 2024 22:34:20 -0700 Subject: [PATCH] feat: swap event generation to source-based generation Still being validated, we have event generation that can run as an Annotation Processor, which has the benefits of producing closer to usage events with generics that survive their usages. This enables CompositeEvent to be near-fully implemented. --- .gitignore | 3 ++ build.gradle.kts | 35 ++++--------------- gradle/libs.versions.toml | 1 - gradle/verification-metadata.xml | 32 +++++++++++++++++ settings.gradle.kts | 3 ++ .../api/data/DataManipulator.java | 2 +- .../spongepowered/api/event/Cancellable.java | 2 +- .../org/spongepowered/api/event/Cause.java | 2 ++ .../spongepowered/api/event/EventContext.java | 2 ++ .../api/event/EventContextKeys.java | 2 ++ .../org/spongepowered/api/event/Listener.java | 3 ++ .../api/event/action/CollideEvent.java | 2 +- .../api/event/action/InteractEvent.java | 2 ++ .../api/event/block/InteractBlockEvent.java | 4 +-- .../cause/entity/damage/package-info.java | 5 ++- .../entity/damage/source/package-info.java | 5 ++- .../api/event/cause/entity/package-info.java | 5 ++- .../api/event/cause/package-info.java | 5 ++- .../api/event/data/ChangeDataHolderEvent.java | 4 +-- .../api/event/entity/AffectEntityEvent.java | 6 ++-- .../api/event/entity/AttackEntityEvent.java | 4 +-- .../entity/ChangeEntityEquipmentEvent.java | 2 +- .../event/entity/ChangeEntityWorldEvent.java | 2 +- .../api/event/entity/CollideEntityEvent.java | 2 +- .../api/event/entity/DamageEntityEvent.java | 4 +-- .../api/event/entity/DestructEntityEvent.java | 2 +- .../api/event/entity/ExpireEntityEvent.java | 2 +- .../api/event/entity/HarvestEntityEvent.java | 2 +- .../api/event/entity/InvokePortalEvent.java | 4 +-- .../api/event/entity/MoveEntityEvent.java | 2 +- .../api/event/entity/RotateEntityEvent.java | 4 +-- .../api/event/entity/SpawnEntityEvent.java | 4 +-- .../api/event/entity/ai/goal/GoalEvent.java | 2 +- .../player/ResourcePackStatusEvent.java | 2 +- .../event/impl/AbstractCompositeEvent.java | 5 ++- .../impl/data/AbstractValueChangeEvent.java | 2 +- .../entity/AbstractAffectEntityEvent.java | 2 +- .../entity/AbstractAttackEntityEvent.java | 2 +- .../AbstractChangeEntityEquipmentEvent.java | 2 +- .../entity/AbstractDamageEntityEvent.java | 2 +- .../impl/world/AbstractDetonateEvent.java | 2 +- .../item/inventory/AffectItemStackEvent.java | 2 +- .../event/item/inventory/AffectSlotEvent.java | 2 +- .../item/inventory/ChangeInventoryEvent.java | 4 +-- .../item/inventory/InteractItemEvent.java | 13 ++++++- .../item/inventory/UpdateAnvilEvent.java | 2 +- .../event/lifecycle/EngineLifecycleEvent.java | 2 +- .../api/event/lifecycle/LifecycleEvent.java | 2 +- .../event/lifecycle/ProvideServiceEvent.java | 2 ++ .../event/lifecycle/RegisterBuilderEvent.java | 2 ++ .../event/lifecycle/RegisterChannelEvent.java | 2 +- .../event/lifecycle/RegisterCommandEvent.java | 2 ++ .../event/lifecycle/RegisterDataEvent.java | 2 +- .../lifecycle/RegisterDataPackValueEvent.java | 2 +- .../event/lifecycle/RegisterFactoryEvent.java | 2 ++ .../lifecycle/RegisterRegistryEvent.java | 2 ++ .../lifecycle/RegisterRegistryValueEvent.java | 2 ++ .../event/message/AudienceMessageEvent.java | 2 +- .../api/event/message/MessageCancellable.java | 2 +- .../api/event/message/MessageEvent.java | 2 +- .../api/event/message/PlayerChatEvent.java | 4 +-- .../network/ServerSideConnectionEvent.java | 2 +- .../spongepowered/api/event/package-info.java | 7 +++- .../event/server/ClientPingServerEvent.java | 4 +-- .../api/event/user/BanUserEvent.java | 2 +- .../api/event/user/PardonUserEvent.java | 2 +- .../event/world/ChangeWorldBorderEvent.java | 2 +- .../api/event/world/ExplosionEvent.java | 4 +-- .../api/event/world/chunk/ChunkEvent.java | 2 +- 69 files changed, 165 insertions(+), 95 deletions(-) diff --git a/.gitignore b/.gitignore index 1e698d63c71..b394daef259 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,9 @@ MANIFEST.MF dependency-reduced-pom.xml .checkstyle !.checkstyle/ +# We exclude the generated events from git to avoid +# temptation to edit said generated files. +src/main/generated/ # Compiled # ############ diff --git a/build.gradle.kts b/build.gradle.kts index 2ce206c7de7..68de6da7881 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,11 +3,6 @@ import org.jetbrains.gradle.ext.delegateActions import org.jetbrains.gradle.ext.settings import org.jetbrains.gradle.ext.taskTriggers -buildscript { - dependencies { - classpath(libs.spoon) // bump for EIG - } -} plugins { eclipse @@ -21,6 +16,9 @@ plugins { alias(libs.plugins.nexusPublish) } +// Enable event generation to be considered part of +// the main source set +val generatedEventSourcesDir = project.file("src/main/generated") val javaTarget: String by project val ap by sourceSets.registering { compileClasspath += sourceSets.main.get().compileClasspath + sourceSets.main.get().output @@ -46,7 +44,7 @@ tasks { sourceSets { main { - java.srcDirs(layout.buildDirectory.dir("generated/sources/annotationProcessor/java/main")) + java.srcDirs(generatedEventSourcesDir) } } @@ -150,33 +148,14 @@ dependencies { tasks { compileJava { + options.generatedSourceOutputDirectory = generatedEventSourcesDir options.compilerArgs.addAll(listOf( + "-AeventGenInclusiveFolders=org/spongepowered/api/event", + "-AeventGenExclusiveFolders=org/spongepowered/api/event/cause,org/spongepowered/api/event/filter,org/spongepowered/api/event/impl,org/spongepowered/api/event/lifecycle", "-AeventGenFactory=org.spongepowered.api.event.SpongeEventFactory", "-AeventGenDebug=true", )) } -// genEventImpl { -// sourceCompatibility = javaTarget -// destinationDirectory = project.layout.buildDirectory.dir("generated/event-factory") -// -// outputFactory = "org.spongepowered.api.event.SpongeEventFactory" -// include("org/spongepowered/api/event/*/**/*") -// include("org/spongepowered/api/event/CompositeEvent.java") -// exclude("org/spongepowered/api/event/action/InteractEvent.java") -// exclude("org/spongepowered/api/event/cause/") -// exclude("org/spongepowered/api/event/entity/AffectEntityEvent.java") -// exclude("org/spongepowered/api/event/filter/") -// exclude("org/spongepowered/api/event/impl/") -// exclude("org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java") -// exclude("org/spongepowered/api/event/lifecycle/RegisterWorldEvent.java") -// inclusiveAnnotations = setOf("org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod") -// exclusiveAnnotations = setOf("org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod") -// } jar { from(ap.get().output) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 8a0ca4bc066..6b7e1acf2a4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,7 +45,6 @@ eventImplGen-annotations = { module = "org.spongepowered:event-impl-gen-annotati checkerQual = { module = "org.checkerframework:checker-qual", version.ref = "checker" } errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" } errorprone-annotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorprone" } -spoon = { module = "fr.inria.gforge.spoon:spoon-core", version = "10.4.2" } # bump for EIG # testing diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 8f2fe9d3fc4..8fabcce1d88 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -264,6 +264,14 @@ + + + + + + + + @@ -748,6 +756,22 @@ + + + + + + + + + + + + + + + + @@ -1512,6 +1536,9 @@ + + + @@ -1621,6 +1648,11 @@ + + + + + diff --git a/settings.gradle.kts b/settings.gradle.kts index 9007387b615..f27804704dc 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,6 +13,9 @@ plugins { } dependencyResolutionManagement { + repositories { + mavenLocal() + } repositoriesMode = RepositoriesMode.FAIL_ON_PROJECT_REPOS pluginManagement.repositories.forEach(repositories::add) } diff --git a/src/main/java/org/spongepowered/api/data/DataManipulator.java b/src/main/java/org/spongepowered/api/data/DataManipulator.java index 05254bc457e..ed41c99ac12 100644 --- a/src/main/java/org/spongepowered/api/data/DataManipulator.java +++ b/src/main/java/org/spongepowered/api/data/DataManipulator.java @@ -30,7 +30,7 @@ import org.spongepowered.api.data.value.Value; import org.spongepowered.api.data.value.ValueContainer; import org.spongepowered.api.entity.Entity; -import org.spongepowered.api.util.annotation.eventgen.TransformWith; +import org.spongepowered.eventgen.annotations.TransformWith; import org.spongepowered.api.world.World; import java.util.Arrays; diff --git a/src/main/java/org/spongepowered/api/event/Cancellable.java b/src/main/java/org/spongepowered/api/event/Cancellable.java index 7a5b5bd7bd7..2ad6bc82887 100644 --- a/src/main/java/org/spongepowered/api/event/Cancellable.java +++ b/src/main/java/org/spongepowered/api/event/Cancellable.java @@ -24,7 +24,7 @@ */ package org.spongepowered.api.event; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.PropertySettings; /** * Represents an event that can be cancelled. diff --git a/src/main/java/org/spongepowered/api/event/Cause.java b/src/main/java/org/spongepowered/api/event/Cause.java index ede6a617623..a1b42f7f59c 100644 --- a/src/main/java/org/spongepowered/api/event/Cause.java +++ b/src/main/java/org/spongepowered/api/event/Cause.java @@ -27,6 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.DoNotStore; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.Arrays; @@ -54,6 +55,7 @@ */ @DoNotStore @SuppressWarnings("unchecked") +@NoFactoryMethod public final class Cause implements Iterable { /** diff --git a/src/main/java/org/spongepowered/api/event/EventContext.java b/src/main/java/org/spongepowered/api/event/EventContext.java index 645f1f66912..96aa907de4d 100644 --- a/src/main/java/org/spongepowered/api/event/EventContext.java +++ b/src/main/java/org/spongepowered/api/event/EventContext.java @@ -27,6 +27,7 @@ import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.util.CopyableBuilder; import org.spongepowered.api.util.annotation.DoNotStore; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.HashMap; import java.util.Map; @@ -42,6 +43,7 @@ * in the event's {@link Cause}. */ @DoNotStore +@NoFactoryMethod public final class EventContext { private static final EventContext EMPTY_CONTEXT = new EventContext(Map.of()); diff --git a/src/main/java/org/spongepowered/api/event/EventContextKeys.java b/src/main/java/org/spongepowered/api/event/EventContextKeys.java index a8019aafd34..17df7c6cb0f 100644 --- a/src/main/java/org/spongepowered/api/event/EventContextKeys.java +++ b/src/main/java/org/spongepowered/api/event/EventContextKeys.java @@ -53,6 +53,7 @@ import org.spongepowered.api.world.portal.PortalLogic; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.math.vector.Vector3d; import org.spongepowered.plugin.PluginContainer; @@ -62,6 +63,7 @@ * Standard keys for use within {@link EventContext}s. */ @SuppressWarnings("unused") +@NoFactoryMethod public final class EventContextKeys { // @formatter:off diff --git a/src/main/java/org/spongepowered/api/event/Listener.java b/src/main/java/org/spongepowered/api/event/Listener.java index 776dcb0d1c3..2873fd2e5aa 100644 --- a/src/main/java/org/spongepowered/api/event/Listener.java +++ b/src/main/java/org/spongepowered/api/event/Listener.java @@ -24,6 +24,8 @@ */ package org.spongepowered.api.event; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -34,6 +36,7 @@ */ @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) +@NoFactoryMethod public @interface Listener { /** diff --git a/src/main/java/org/spongepowered/api/event/action/CollideEvent.java b/src/main/java/org/spongepowered/api/event/action/CollideEvent.java index 30404ad787f..04c73854acd 100644 --- a/src/main/java/org/spongepowered/api/event/action/CollideEvent.java +++ b/src/main/java/org/spongepowered/api/event/action/CollideEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.api.world.server.ServerLocation; /** diff --git a/src/main/java/org/spongepowered/api/event/action/InteractEvent.java b/src/main/java/org/spongepowered/api/event/action/InteractEvent.java index e3f3f889130..4f4ea4a3528 100644 --- a/src/main/java/org/spongepowered/api/event/action/InteractEvent.java +++ b/src/main/java/org/spongepowered/api/event/action/InteractEvent.java @@ -25,10 +25,12 @@ package org.spongepowered.api.event.action; import org.spongepowered.api.event.Event; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Base event for all interactions. */ +@NoFactoryMethod public interface InteractEvent extends Event { } diff --git a/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java b/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java index 9631e0a6042..545d415dcf5 100644 --- a/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java +++ b/src/main/java/org/spongepowered/api/event/block/InteractBlockEvent.java @@ -35,8 +35,7 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.util.Direction; import org.spongepowered.api.util.Tristate; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.ImplementedBy; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.math.vector.Vector3d; @@ -105,7 +104,6 @@ interface Finish extends Primary, Cancellable { * *

This is usually right-click.

*/ - @GenerateFactoryMethod interface Secondary extends InteractBlockEvent { Tristate originalUseItemResult(); diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java index 854a642a92d..b8d89392421 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/package-info.java @@ -22,5 +22,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity.damage; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java index 2259174ac8f..2385f8466a9 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/damage/source/package-info.java @@ -22,5 +22,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity.damage.source; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java b/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java index 88639e98bbc..cb3fa67ca4c 100644 --- a/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/entity/package-info.java @@ -22,5 +22,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause.entity; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/cause/package-info.java b/src/main/java/org/spongepowered/api/event/cause/package-info.java index d4759eac38c..15dada1c460 100644 --- a/src/main/java/org/spongepowered/api/event/cause/package-info.java +++ b/src/main/java/org/spongepowered/api/event/cause/package-info.java @@ -22,5 +22,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event.cause; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; diff --git a/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java b/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java index fe6c156a31f..31de1e88d1e 100644 --- a/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java +++ b/src/main/java/org/spongepowered/api/event/data/ChangeDataHolderEvent.java @@ -30,8 +30,8 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; import org.spongepowered.api.event.impl.data.AbstractValueChangeEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; /** * An event that is associated with a {@link org.spongepowered.api.data.DataHolder.Mutable} that may have some diff --git a/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java index a099ee8114e..dafe15f0188 100644 --- a/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/AffectEntityEvent.java @@ -30,8 +30,9 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.event.Order; import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.PropertySettings; import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.server.ServerLocation; @@ -48,6 +49,7 @@ * Other cases will be included as necessary. */ @ImplementedBy(AbstractAffectEntityEvent.class) +@NoFactoryMethod public interface AffectEntityEvent extends Event, Cancellable { /** diff --git a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java index 208f68a4108..b5f17d4c7ba 100644 --- a/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/AttackEntityEvent.java @@ -45,8 +45,8 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.difficulty.Difficulties; import org.spongepowered.api.world.difficulty.Difficulty; diff --git a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java index 6ee0f580e9f..0a5885e7f09 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityEquipmentEvent.java @@ -32,7 +32,7 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.inventory.Slot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an entity changes an equipped item. This can occur whenever diff --git a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java index 2cb09c213fe..48e489f971b 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ChangeEntityWorldEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; import org.spongepowered.api.world.server.ServerWorld; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java index 5668e895be3..6b36c2c40af 100644 --- a/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/CollideEntityEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.action.CollideEvent; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Fired when an {@link Entity} collides with one or more {@link Entity}'s. diff --git a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java index 990a05a1deb..66827f2c453 100644 --- a/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/DamageEntityEvent.java @@ -42,8 +42,8 @@ import org.spongepowered.api.item.ItemTypes; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.difficulty.Difficulties; import org.spongepowered.api.world.difficulty.Difficulty; diff --git a/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java index 192cbdb8c44..e1e00f2651b 100644 --- a/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/DestructEntityEvent.java @@ -29,7 +29,7 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.message.AudienceMessageEvent; import org.spongepowered.api.event.message.MessageCancellable; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import org.spongepowered.api.world.gamerule.GameRules; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java index 9cb96bc2a7d..a9f265eb765 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ExpireEntityEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.entity.living.monster.Endermite; import org.spongepowered.api.entity.weather.LightningBolt; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an {@link Entity} is expiring from the world. Examples may diff --git a/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java index e2feb2fe8d8..3bbb689d414 100644 --- a/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/HarvestEntityEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Called when an {@link Entity} has been killed and is being "harvested" (drops/etc). Happens diff --git a/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java b/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java index e71bea00bec..a9deb7d81f3 100644 --- a/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/InvokePortalEvent.java @@ -27,8 +27,8 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.api.world.portal.PortalLogic; import org.spongepowered.math.vector.Vector3d; diff --git a/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java index bed41167130..5a550c5cabd 100644 --- a/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/MoveEntityEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; import org.spongepowered.math.vector.Vector3d; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java index 007007ef281..f245eef5c8c 100644 --- a/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/RotateEntityEvent.java @@ -27,8 +27,8 @@ import org.spongepowered.api.entity.Entity; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.AbsoluteSortPosition; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.AbsoluteSortPosition; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import org.spongepowered.math.vector.Vector3d; /** diff --git a/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java b/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java index 81e4f127143..8ead9621984 100644 --- a/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java @@ -28,8 +28,8 @@ import org.spongepowered.api.event.Cause; import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; import org.spongepowered.api.event.impl.entity.AbstractSpawnEntityEvent; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.ImplementedBy; /** * Raised when an {@link Entity} is spawned. This usually follows the chain of diff --git a/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java b/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java index 0d14efda4ac..0e9758a6f34 100644 --- a/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/ai/goal/GoalEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; import org.spongepowered.api.event.impl.entity.ai.goal.AbstractGoalEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; +import org.spongepowered.eventgen.annotations.ImplementedBy; @ImplementedBy(AbstractGoalEvent.class) public interface GoalEvent extends Event, Cancellable { diff --git a/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java b/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java index 5502c27384d..7dc4e4f27ba 100644 --- a/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java +++ b/src/main/java/org/spongepowered/api/event/entity/living/player/ResourcePackStatusEvent.java @@ -31,7 +31,7 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.network.ServerSideConnection; import org.spongepowered.api.profile.GameProfile; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java b/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java index 7733bc7fb93..22db9c27911 100644 --- a/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/AbstractCompositeEvent.java @@ -3,13 +3,16 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.CompositeEvent; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Collections; import java.util.List; public abstract class AbstractCompositeEvent extends AbstractEvent implements CompositeEvent { + @UseField + protected E baseEvent; + @UseField(overrideToString = true) protected List children; diff --git a/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java b/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java index 34292304fcf..a19d1081fb2 100644 --- a/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/data/AbstractValueChangeEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.data.DataTransactionResult; import org.spongepowered.api.event.data.ChangeDataHolderEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; public abstract class AbstractValueChangeEvent implements ChangeDataHolderEvent.ValueChange { diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java index 7504abafd55..a6b4d36638c 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAffectEntityEvent.java @@ -29,7 +29,7 @@ import org.spongepowered.api.event.Order; import org.spongepowered.api.event.entity.AffectEntityEvent; import org.spongepowered.api.event.impl.AbstractEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Collections; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java index 6d8531e060a..d8f63462257 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractAttackEntityEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.event.cause.entity.damage.ModifierFunction; import org.spongepowered.api.event.entity.AttackEntityEvent; import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Iterator; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java index 20e52426b5d..b1bfdea3ddc 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractChangeEntityEquipmentEvent.java @@ -28,7 +28,7 @@ import org.spongepowered.api.event.entity.ChangeEntityEquipmentEvent; import org.spongepowered.api.event.impl.AbstractEvent; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; public abstract class AbstractChangeEntityEquipmentEvent extends AbstractEvent implements ChangeEntityEquipmentEvent { diff --git a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java index 598d34e222e..55377efb27b 100644 --- a/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/entity/AbstractDamageEntityEvent.java @@ -31,7 +31,7 @@ import org.spongepowered.api.event.cause.entity.damage.ModifierFunction; import org.spongepowered.api.event.entity.DamageEntityEvent; import org.spongepowered.api.util.Tuple; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import java.util.Iterator; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java b/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java index 2227b7b165e..7754b29d439 100644 --- a/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java +++ b/src/main/java/org/spongepowered/api/event/impl/world/AbstractDetonateEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.event.impl.entity.AbstractAffectEntityEvent; import org.spongepowered.api.event.world.ExplosionEvent; -import org.spongepowered.api.util.annotation.eventgen.UseField; +import org.spongepowered.eventgen.annotations.UseField; import org.spongepowered.api.world.server.ServerLocation; import java.util.Collections; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java index 6e46aafe463..a24e83a0b30 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/AffectItemStackEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java index ab7d667fd58..197893a448b 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/AffectSlotEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.item.inventory.ItemStack; import org.spongepowered.api.item.inventory.transaction.SlotTransaction; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java index 0ba10845c86..2936292ea15 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/ChangeInventoryEvent.java @@ -32,8 +32,8 @@ import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStackSnapshot; import org.spongepowered.api.item.inventory.Slot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.PropertySettings; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java index 74ede46988f..98e4c87014f 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/InteractItemEvent.java @@ -25,6 +25,7 @@ package org.spongepowered.api.event.item.inventory; import org.spongepowered.api.event.Cancellable; +import org.spongepowered.api.event.CompositeEvent; import org.spongepowered.api.event.action.InteractEvent; import org.spongepowered.api.event.block.InteractBlockEvent; import org.spongepowered.api.event.entity.InteractEntityEvent; @@ -64,5 +65,15 @@ interface Primary extends InteractItemEvent { * *

Vanilla minecraft does not call an event when interacting with an empty hand in air.

*/ - interface Secondary extends InteractItemEvent, Cancellable {} + interface Secondary extends InteractItemEvent, Cancellable { + + interface Pre extends Secondary { + + } + + interface Post extends CompositeEvent, Secondary { + + } + + } } diff --git a/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java b/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java index 3f4f0986feb..98f865043b9 100644 --- a/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java +++ b/src/main/java/org/spongepowered/api/event/item/inventory/UpdateAnvilEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.item.inventory.AnvilCost; import org.spongepowered.api.item.inventory.Inventory; import org.spongepowered.api.item.inventory.ItemStackSnapshot; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Fires whenever the left and right slots of an anvil are filled and a new result is computed. diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java index 58cf05f64dd..a420393f18e 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/EngineLifecycleEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.Engine; import org.spongepowered.api.event.GenericEvent; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; @NoFactoryMethod public interface EngineLifecycleEvent extends GenericEvent, LifecycleEvent { diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java index e76643aac7f..21df07bf922 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/LifecycleEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.Game; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * An event called during the lifetime (start to stop) of a diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java index bf449d52316..84e088cb051 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/ProvideServiceEvent.java @@ -26,6 +26,7 @@ import org.spongepowered.api.Engine; import org.spongepowered.api.event.GenericEvent; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.function.Supplier; @@ -47,6 +48,7 @@ * * @param The service to provide. */ +@NoFactoryMethod public interface ProvideServiceEvent extends GenericEvent, LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java index 5c027aa7ccb..e295e7e7b16 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterBuilderEvent.java @@ -26,9 +26,11 @@ import org.spongepowered.api.registry.DuplicateRegistrationException; import org.spongepowered.api.util.Builder; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.function.Supplier; +@NoFactoryMethod public interface RegisterBuilderEvent extends LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java index bb9e3d248be..8c8818ebd7d 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterChannelEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.network.channel.Channel; import org.spongepowered.api.registry.DuplicateRegistrationException; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Lifecycle event to indicate when network channels should be created and registered. diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java index 1fbecd17c14..6640ffb14cf 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterCommandEvent.java @@ -29,6 +29,7 @@ import org.spongepowered.api.command.manager.CommandMapping; import org.spongepowered.api.command.registrar.CommandRegistrar; import org.spongepowered.api.event.GenericEvent; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.plugin.PluginContainer; /** @@ -60,6 +61,7 @@ * * @param The type of command that is being registered. */ +@NoFactoryMethod public interface RegisterCommandEvent extends GenericEvent, LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java index 294f0620ffe..a34d4d9147b 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataEvent.java @@ -26,7 +26,7 @@ import org.spongepowered.api.data.DataManager; import org.spongepowered.api.data.DataRegistration; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Lifecycle event for registering custom {@link DataRegistration data} within the {@link DataManager}. diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java index eb92a194c1a..3aaaff4c914 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterDataPackValueEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.datapack.DataPackEntry; import org.spongepowered.api.datapack.DataPackType; import org.spongepowered.api.event.GenericEvent; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; @SuppressWarnings("rawtypes") @NoFactoryMethod diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java index dab7e6222a9..c54152ea77d 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterFactoryEvent.java @@ -25,7 +25,9 @@ package org.spongepowered.api.event.lifecycle; import org.spongepowered.api.registry.DuplicateRegistrationException; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +@NoFactoryMethod public interface RegisterFactoryEvent extends LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java index 562da7f2adc..85a176c7fde 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryEvent.java @@ -30,10 +30,12 @@ import org.spongepowered.api.registry.DuplicateRegistrationException; import org.spongepowered.api.registry.Registry; import org.spongepowered.api.registry.RegistryType; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Map; import java.util.function.Supplier; +@NoFactoryMethod public interface RegisterRegistryEvent extends LifecycleEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java index d8129480980..c54883a67f1 100644 --- a/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java +++ b/src/main/java/org/spongepowered/api/event/lifecycle/RegisterRegistryValueEvent.java @@ -29,7 +29,9 @@ import org.spongepowered.api.event.GenericEvent; import org.spongepowered.api.registry.DefaultedRegistryValue; import org.spongepowered.api.registry.RegistryType; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; +@NoFactoryMethod public interface RegisterRegistryValueEvent extends LifecycleEvent { RegistryStep registry(RegistryType registryType); diff --git a/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java b/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java index 654f183e9e4..80ee098351c 100644 --- a/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/AudienceMessageEvent.java @@ -28,7 +28,7 @@ import net.kyori.adventure.text.Component; import org.checkerframework.checker.nullness.qual.Nullable; import org.spongepowered.api.adventure.Audiences; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Optional; import java.util.function.Predicate; diff --git a/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java b/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java index 2ff2850ee4e..3f16ffeced2 100644 --- a/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java +++ b/src/main/java/org/spongepowered/api/event/message/MessageCancellable.java @@ -25,7 +25,7 @@ package org.spongepowered.api.event.message; import net.kyori.adventure.text.Component; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Represents an event whose message can be cancelled. diff --git a/src/main/java/org/spongepowered/api/event/message/MessageEvent.java b/src/main/java/org/spongepowered/api/event/message/MessageEvent.java index 814f3ecc458..389e160f54a 100644 --- a/src/main/java/org/spongepowered/api/event/message/MessageEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/MessageEvent.java @@ -26,7 +26,7 @@ import net.kyori.adventure.text.Component; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; /** * Describes events when a involving a {@link Component} message. diff --git a/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java b/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java index ff4ab709be0..51d900df732 100644 --- a/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java +++ b/src/main/java/org/spongepowered/api/event/message/PlayerChatEvent.java @@ -30,7 +30,7 @@ import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Cause; import org.spongepowered.api.registry.RegistryReference; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.Optional; import java.util.function.Predicate; @@ -39,7 +39,7 @@ * Fired when sending a chat message. * To modify the message use {@link Decorate}. */ -@NoFactoryMethod +@NoFactoryMethod(ignoreNested = true) public interface PlayerChatEvent extends MessageEvent { /** diff --git a/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java b/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java index a23d58b2139..a755bcfc3f0 100644 --- a/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java +++ b/src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java @@ -38,7 +38,7 @@ import org.spongepowered.api.profile.GameProfile; import org.spongepowered.api.service.ban.BanService; import org.spongepowered.api.service.whitelist.WhitelistService; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.api.world.server.ServerLocation; import org.spongepowered.api.world.server.ServerWorld; import org.spongepowered.math.vector.Vector3d; diff --git a/src/main/java/org/spongepowered/api/event/package-info.java b/src/main/java/org/spongepowered/api/event/package-info.java index 9d12180f851..e5d13b53794 100644 --- a/src/main/java/org/spongepowered/api/event/package-info.java +++ b/src/main/java/org/spongepowered/api/event/package-info.java @@ -22,5 +22,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -@org.checkerframework.framework.qual.DefaultQualifier(org.checkerframework.checker.nullness.qual.NonNull.class) +@NoFactoryMethod(ignoreNested = true) +@DefaultQualifier(NonNull.class) package org.spongepowered.api.event; + +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; diff --git a/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java b/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java index 1181ae82d32..61cbbd29d73 100644 --- a/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java +++ b/src/main/java/org/spongepowered/api/event/server/ClientPingServerEvent.java @@ -33,8 +33,8 @@ import org.spongepowered.api.network.status.StatusClient; import org.spongepowered.api.network.status.StatusResponse; import org.spongepowered.api.profile.GameProfile; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import java.util.List; import java.util.Optional; diff --git a/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java b/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java index 6fadd6153b7..39ec4bb4bf6 100644 --- a/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java +++ b/src/main/java/org/spongepowered/api/event/user/BanUserEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.Event; import org.spongepowered.api.service.ban.Ban; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Occurs when a user is banned. diff --git a/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java b/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java index 39473f80212..72278efaa50 100644 --- a/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java +++ b/src/main/java/org/spongepowered/api/event/user/PardonUserEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.living.player.User; import org.spongepowered.api.event.Event; import org.spongepowered.api.service.ban.Ban; -import org.spongepowered.api.util.annotation.eventgen.GenerateFactoryMethod; +import org.spongepowered.eventgen.annotations.GenerateFactoryMethod; /** * Occurs when a user is pardoned. diff --git a/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java b/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java index 66c3affcc74..8d1cac64bd8 100644 --- a/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/ChangeWorldBorderEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.entity.living.player.server.ServerPlayer; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.api.world.border.WorldBorder; import org.spongepowered.api.world.server.ServerWorld; diff --git a/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java b/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java index 86322fdf353..f27fdead9cc 100644 --- a/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/ExplosionEvent.java @@ -28,8 +28,8 @@ import org.spongepowered.api.event.Event; import org.spongepowered.api.event.entity.AffectEntityEvent; import org.spongepowered.api.event.impl.world.AbstractDetonateEvent; -import org.spongepowered.api.util.annotation.eventgen.ImplementedBy; -import org.spongepowered.api.util.annotation.eventgen.PropertySettings; +import org.spongepowered.eventgen.annotations.ImplementedBy; +import org.spongepowered.eventgen.annotations.PropertySettings; import org.spongepowered.api.world.World; import org.spongepowered.api.world.explosion.Explosion; import org.spongepowered.api.world.server.ServerLocation; diff --git a/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java b/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java index 09358b7d35a..5c26ae49b76 100644 --- a/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java +++ b/src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java @@ -27,7 +27,7 @@ import org.spongepowered.api.ResourceKey; import org.spongepowered.api.event.Cancellable; import org.spongepowered.api.event.Event; -import org.spongepowered.api.util.annotation.eventgen.NoFactoryMethod; +import org.spongepowered.eventgen.annotations.NoFactoryMethod; import org.spongepowered.api.world.World; import org.spongepowered.api.world.chunk.BlockChunk; import org.spongepowered.api.world.chunk.Chunk;