Skip to content

Commit 7394a7b

Browse files
committed
chore: merge api-14 for updates
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
2 parents 44874a9 + 1b0e82f commit 7394a7b

File tree

7 files changed

+173
-20
lines changed

7 files changed

+173
-20
lines changed

gradle/verification-metadata.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
<configuration>
44
<verify-metadata>true</verify-metadata>
55
<verify-signatures>false</verify-signatures>
6+
<trusted-artifacts>
7+
<trust file=".*-javadoc[.]jar" regex="true"/>
8+
<trust file=".*-sources[.]jar" regex="true"/>
9+
</trusted-artifacts>
610
</configuration>
711
<components>
812
<component group="aopalliance" name="aopalliance" version="1.0">

src/main/java/org/spongepowered/api/data/type/HandPreference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@
3636
* <p>For players, this is controlled by the left hand/right hand setting</p>
3737
*/
3838
@CatalogedBy(HandPreferences.class)
39-
public interface HandPreference extends DefaultedRegistryValue, ComponentLike {
39+
public interface HandPreference extends DefaultedRegistryValue, ComponentLike, StringRepresentable {
4040

4141
}

src/main/java/org/spongepowered/api/entity/living/player/server/ServerPlayer.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.spongepowered.api.event.Cause;
4747
import org.spongepowered.api.item.inventory.Container;
4848
import org.spongepowered.api.item.inventory.Inventory;
49+
import org.spongepowered.api.network.ServerConnectionState;
4950
import org.spongepowered.api.network.ServerSideConnection;
5051
import org.spongepowered.api.scoreboard.Scoreboard;
5152
import org.spongepowered.api.service.permission.Subject;
@@ -184,6 +185,14 @@ default SetValue.Mutable<SkinPart> displayedSkinParts() {
184185
*/
185186
ServerSideConnection connection();
186187

188+
/**
189+
* Gets the appropriate {@link ServerConnectionState.Game} linking this player to a
190+
* connection state.
191+
*
192+
* @return The connection state
193+
*/
194+
ServerConnectionState.Game connectionState();
195+
187196
/**
188197
* Gets this player's {@link TabList}.
189198
*
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.api.event.lifecycle;
26+
27+
import org.spongepowered.api.Engine;
28+
import org.spongepowered.api.ResourceKey;
29+
import org.spongepowered.api.event.GenericEvent;
30+
import org.spongepowered.api.registry.Registry;
31+
import org.spongepowered.api.registry.RegistryHolder;
32+
import org.spongepowered.api.registry.RegistryType;
33+
34+
import java.util.function.Consumer;
35+
36+
public interface FreezeRegistryEvent extends LifecycleEvent {
37+
38+
/**
39+
* Fired after a layer has established its registries
40+
* and is no longer accepting any type of modifications.
41+
*
42+
* <p><strong>Note:</strong> Layers might be reloadable!
43+
* When a registry is being reloaded, this event is fired
44+
* again for the relevant registries.</p>
45+
*/
46+
interface Post extends FreezeRegistryEvent {
47+
48+
/**
49+
* Gets the built {@link RegistryHolder registry holder}.
50+
*
51+
* @return The registry holder.
52+
*/
53+
RegistryHolder holder();
54+
55+
/**
56+
* <p>Fetch a registry by its type.</p>
57+
*
58+
* <p>The consumer will be called if it matches the current set of
59+
* registries being created.</p>
60+
*
61+
* @param registryType The registry type to fetch.
62+
* @param consumer The consumer to be called if found.
63+
*/
64+
default <T> void registry(RegistryType<T> registryType, Consumer<Registry<T>> consumer) {
65+
this.holder().findRegistry(registryType).ifPresent(consumer);
66+
}
67+
68+
interface GameScoped extends Post {
69+
}
70+
71+
interface EngineScoped<E extends Engine> extends Post, GenericEvent<E> {
72+
}
73+
74+
interface WorldScoped extends Post {
75+
76+
ResourceKey worldKey();
77+
}
78+
}
79+
}

src/main/java/org/spongepowered/api/world/WorldType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525
package org.spongepowered.api.world;
2626

27+
import org.spongepowered.api.Sponge;
2728
import org.spongepowered.api.data.Key;
2829
import org.spongepowered.api.data.value.Value;
2930
import org.spongepowered.api.datapack.DataPackSerializable;
@@ -36,6 +37,10 @@
3637
@CatalogedBy(WorldTypes.class)
3738
public interface WorldType extends DefaultedRegistryValue, ContextSource, WorldTypeDataFetcher, DataPackSerializable {
3839

40+
static WorldType.Builder builder() {
41+
return Sponge.game().builderProvider().provide(WorldType.Builder.class);
42+
}
43+
3944
interface Builder extends org.spongepowered.api.util.Builder<WorldType, Builder>, CopyableBuilder<WorldType, Builder> {
4045

4146
<V> Builder add(Key<? extends Value<V>> key, V value);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
3+
*
4+
* Copyright (c) SpongePowered <https://www.spongepowered.org>
5+
* Copyright (c) contributors
6+
*
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in
15+
* all copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23+
* THE SOFTWARE.
24+
*/
25+
package org.spongepowered.api.world.server;
26+
27+
import org.spongepowered.api.Sponge;
28+
import org.spongepowered.api.world.generation.config.WorldGenerationConfig;
29+
30+
import java.util.Optional;
31+
32+
public interface WorldArchetype {
33+
34+
static WorldArchetype.Builder builder() {
35+
return Sponge.game().builderProvider().provide(WorldArchetype.Builder.class);
36+
}
37+
38+
static WorldArchetype of(WorldArchetypeType type) {
39+
return WorldArchetype.builder().type(type).build();
40+
}
41+
42+
static WorldArchetype of(WorldArchetypeType type, WorldGenerationConfig generationConfig) {
43+
return WorldArchetype.builder().type(type).generationConfig(generationConfig).build();
44+
}
45+
46+
WorldArchetypeType type();
47+
48+
Optional<WorldGenerationConfig> generationConfig();
49+
50+
interface Builder extends org.spongepowered.api.util.Builder<WorldArchetype, Builder> {
51+
52+
Builder type(WorldArchetypeType type);
53+
54+
Builder generationConfig(WorldGenerationConfig generationConfig);
55+
}
56+
}

src/main/java/org/spongepowered/api/world/server/storage/ServerWorldProperties.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import org.spongepowered.api.world.gamerule.GameRuleHolder;
4545
import org.spongepowered.api.world.generation.config.WorldGenerationConfig;
4646
import org.spongepowered.api.world.server.ServerWorld;
47-
import org.spongepowered.api.world.server.WorldArchetypeType;
47+
import org.spongepowered.api.world.server.WorldArchetype;
4848
import org.spongepowered.api.world.storage.WorldProperties;
4949
import org.spongepowered.api.world.weather.Weather;
5050
import org.spongepowered.api.world.weather.WeatherUniverse;
@@ -493,15 +493,15 @@ static LoadOptions getOrLoad(Consumer<ServerWorldProperties> getCallback, Consum
493493

494494
/**
495495
* Load a new {@link ServerWorldProperties} from disk
496-
* or create a new one with the provided {@link WorldArchetypeType}.
496+
* or create a new one with the provided {@link WorldArchetype}.
497497
* Do not attempt to use the already loaded instance.
498498
*
499499
* <p>This operation fails if properties were already loaded.</p>
500500
*
501501
* @param worldArchetype The archetype to use for creation.
502502
* @return The load options.
503503
*/
504-
static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype) {
504+
static LoadOptions loadOrCreate(WorldArchetype worldArchetype) {
505505
return LoadOptions.builder()
506506
.load()
507507
.create(worldArchetype)
@@ -510,7 +510,7 @@ static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype) {
510510

511511
/**
512512
* Load a new {@link ServerWorldProperties} from disk
513-
* or create a new one with the provided {@link WorldArchetypeType}.
513+
* or create a new one with the provided {@link WorldArchetype}.
514514
* Do not attempt to use the already loaded instance.
515515
*
516516
* <p>This operation fails if properties were already loaded.</p>
@@ -520,7 +520,7 @@ static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype) {
520520
* creation for additional configuration.
521521
* @return The load options.
522522
*/
523-
static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype, Consumer<ServerWorldProperties> createCallback) {
523+
static LoadOptions loadOrCreate(WorldArchetype worldArchetype, Consumer<ServerWorldProperties> createCallback) {
524524
return LoadOptions.builder()
525525
.load()
526526
.create(worldArchetype)
@@ -530,7 +530,7 @@ static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype, Consumer<Serv
530530

531531
/**
532532
* Load a new {@link ServerWorldProperties} from disk
533-
* or create a new one with the provided {@link WorldArchetypeType}.
533+
* or create a new one with the provided {@link WorldArchetype}.
534534
* Do not attempt to use the already loaded instance.
535535
*
536536
* <p>This operation fails if properties were already loaded.</p>
@@ -542,7 +542,7 @@ static LoadOptions loadOrCreate(WorldArchetypeType worldArchetype, Consumer<Serv
542542
* creation for additional configuration.
543543
* @return The load options.
544544
*/
545-
static LoadOptions loadOrCreate(Consumer<ServerWorldProperties> loadCallback, WorldArchetypeType worldArchetype, Consumer<ServerWorldProperties> createCallback) {
545+
static LoadOptions loadOrCreate(Consumer<ServerWorldProperties> loadCallback, WorldArchetype worldArchetype, Consumer<ServerWorldProperties> createCallback) {
546546
return LoadOptions.builder()
547547
.load()
548548
.loadCallback(loadCallback)
@@ -554,12 +554,12 @@ static LoadOptions loadOrCreate(Consumer<ServerWorldProperties> loadCallback, Wo
554554
/**
555555
* Get the already loaded {@link ServerWorldProperties} or
556556
* attempt to load it from disk. If not found, create a new one
557-
* with the provided {@link WorldArchetypeType}.
557+
* with the provided {@link WorldArchetype}.
558558
*
559559
* @param worldArchetype The archetype to use for creation.
560560
* @return The load options.
561561
*/
562-
static LoadOptions getLoadOrCreate(WorldArchetypeType worldArchetype) {
562+
static LoadOptions getLoadOrCreate(WorldArchetype worldArchetype) {
563563
return LoadOptions.builder()
564564
.get()
565565
.load()
@@ -570,14 +570,14 @@ static LoadOptions getLoadOrCreate(WorldArchetypeType worldArchetype) {
570570
/**
571571
* Get the already loaded {@link ServerWorldProperties} or
572572
* attempt to load it from disk. If not found, create a new one
573-
* with the provided {@link WorldArchetypeType}.
573+
* with the provided {@link WorldArchetype}.
574574
*
575575
* @param worldArchetype The archetype to use for creation.
576576
* @param createCallback The consumer to call after successful
577577
* creation for additional configuration.
578578
* @return The load options.
579579
*/
580-
static LoadOptions getLoadOrCreate(WorldArchetypeType worldArchetype, Consumer<ServerWorldProperties> createCallback) {
580+
static LoadOptions getLoadOrCreate(WorldArchetype worldArchetype, Consumer<ServerWorldProperties> createCallback) {
581581
return LoadOptions.builder()
582582
.get()
583583
.load()
@@ -589,7 +589,7 @@ static LoadOptions getLoadOrCreate(WorldArchetypeType worldArchetype, Consumer<S
589589
/**
590590
* Get the already loaded {@link ServerWorldProperties} or
591591
* attempt to load it from disk. If not found, create a new one
592-
* with the provided {@link WorldArchetypeType}.
592+
* with the provided {@link WorldArchetype}.
593593
*
594594
* @param getCallback The consumer to call after successful
595595
* get operation for additional configuration.
@@ -600,7 +600,7 @@ static LoadOptions getLoadOrCreate(WorldArchetypeType worldArchetype, Consumer<S
600600
* creation for additional configuration.
601601
* @return The load options.
602602
*/
603-
static LoadOptions getLoadOrCreate(Consumer<ServerWorldProperties> getCallback, Consumer<ServerWorldProperties> loadCallback, WorldArchetypeType worldArchetype, Consumer<ServerWorldProperties> createCallback) {
603+
static LoadOptions getLoadOrCreate(Consumer<ServerWorldProperties> getCallback, Consumer<ServerWorldProperties> loadCallback, WorldArchetype worldArchetype, Consumer<ServerWorldProperties> createCallback) {
604604
return LoadOptions.builder()
605605
.get()
606606
.getCallback(getCallback)
@@ -613,23 +613,23 @@ static LoadOptions getLoadOrCreate(Consumer<ServerWorldProperties> getCallback,
613613

614614
/**
615615
* Create a new {@link ServerWorldProperties} with the given
616-
* {@link WorldArchetypeType} but do not attempt to load
616+
* {@link WorldArchetype} but do not attempt to load
617617
* it from disk or use the already loaded instance.
618618
*
619619
* <p>The operation fails if properties could not be created.</p>
620620
*
621621
* @param worldArchetype The archetype to use.
622622
* @return The load options.
623623
*/
624-
static LoadOptions create(WorldArchetypeType worldArchetype) {
624+
static LoadOptions create(WorldArchetype worldArchetype) {
625625
return LoadOptions.builder()
626626
.create(worldArchetype)
627627
.build();
628628
}
629629

630630
/**
631631
* Create a new {@link ServerWorldProperties} with the given
632-
* {@link WorldArchetypeType} but do not attempt to load
632+
* {@link WorldArchetype} but do not attempt to load
633633
* it from disk or use the already loaded instance.
634634
*
635635
* <p>The operation fails if properties could not be created.</p>
@@ -639,7 +639,7 @@ static LoadOptions create(WorldArchetypeType worldArchetype) {
639639
* creation for additional configuration.
640640
* @return The load options.
641641
*/
642-
static LoadOptions create(WorldArchetypeType worldArchetype, Consumer<ServerWorldProperties> createCallback) {
642+
static LoadOptions create(WorldArchetype worldArchetype, Consumer<ServerWorldProperties> createCallback) {
643643
return LoadOptions.builder()
644644
.create(worldArchetype)
645645
.createCallback(createCallback)
@@ -685,7 +685,7 @@ interface LoadOperation {
685685

686686
interface CreateOperation {
687687

688-
WorldArchetypeType worldArchetype();
688+
WorldArchetype worldArchetype();
689689

690690
Optional<Consumer<ServerWorldProperties>> createCallback();
691691
}
@@ -696,7 +696,7 @@ interface Builder extends org.spongepowered.api.util.Builder<LoadOptions, Builde
696696

697697
Builder.LoadStep load();
698698

699-
Builder.CreateStep create(WorldArchetypeType worldArchetype);
699+
Builder.CreateStep create(WorldArchetype worldArchetype);
700700

701701
interface GetStep extends Builder {
702702

0 commit comments

Comments
 (0)