Skip to content

Commit c848b1b

Browse files
committed
Clarify documentation on Players joining events
Previously it was expected a SpawnEntityEvent would be thrown for a Player connecting to the server, but the nature of cancellations doesn't work with Players being added to the world. In relation to SpongePowered/Sponge#2412.
1 parent de39155 commit c848b1b

File tree

3 files changed

+14
-43
lines changed

3 files changed

+14
-43
lines changed

src/main/java/org/spongepowered/api/event/entity/SpawnEntityEvent.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@
3838
*
3939
* <p>Note: To determine the {@link Cause}, refer to package
4040
* org.spongepowered.api.event.cause.entity.spawn.</p>
41-
*
42-
* <p>For players, this event is fired before they have fully
43-
* joined the world. {@link ServerSideConnectionEvent} is the
44-
* recommended event to interact with connecting players.</p>
4541
*/
4642
@GenerateFactoryMethod
4743
@ImplementedBy(value = AbstractSpawnEntityEvent.class, priority = 2)

src/main/java/org/spongepowered/api/event/network/ServerSideConnectionEvent.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,17 @@
4747
/**
4848
* Represents an event fired during the login process.
4949
*
50-
* <p>Together with {@link SpawnEntityEvent}, these events represent the
51-
* progression of a {@link ServerPlayer player} from first authenticating, to being fully
52-
* loaded in the world.</p>
50+
* <p>These events represent the progression of a {@link ServerPlayer player}
51+
* from first authenticating, to being fully loaded in the world.</p>
5352
*
5453
* <p>The events are fired in the following order:</p>
5554
*
56-
* <p>#Auth -&gt; #Handshake -&gt; #Login -&gt; {@link SpawnEntityEvent} -&gt; #Join</p>
55+
* <p>#Auth -&gt; #Handshake -&gt; #Login -&gt; #Join</p>
5756
*
58-
* <p>{@link SpawnEntityEvent} is still fired for players, for consistency.
59-
* However, the player is not at a well-defined state at that point. It's
60-
* recommended to use the event's subinterfaces to interact with the player
61-
* at well-defined moments during the connection process.</p>
57+
* <p>Traditionally one could consider a {@link SpawnEntityEvent} to be thrown,
58+
* but due to the nature of cancellations, a {@link ServerPlayer player} joining
59+
* a world after {@link Login login} would be inadvisable to cancel due to the
60+
* inconsistent state of both the player and the player's client.</p>
6261
*/
6362
public interface ServerSideConnectionEvent extends Event {
6463

@@ -182,11 +181,13 @@ interface Login extends ServerSideConnectionEvent, MessageEvent, Event, Cancella
182181
}
183182

184183
/**
185-
* Called when a {@link ServerPlayer player} joins the game within a {@link ServerWorld world} for the first
186-
* time after initial connection.
187-
*
188-
* <p>The {@link SpawnEntityEvent} for the {@link ServerPlayer player} is fired after the
189-
* #Login event. This event is fired after both.</p>
184+
* Called when a {@link ServerPlayer player} joins the game within a
185+
* {@link ServerWorld world} for the first time after initial connection.
186+
* Fired after {@link Login} once the {@link ServerPlayer player} has been
187+
* properly added to the {@link ServerWorld}. If data is wanted to be
188+
* modified that could affect a player's representation (such as vanishing),
189+
* it's recommended to modify such data in the logging in
190+
* {@link Login#user() User} instead.
190191
*/
191192
interface Join extends ServerSideConnectionEvent, AudienceMessageEvent, MessageCancellable {
192193

src/main/java/org/spongepowered/api/world/chunk/ChunkState.java

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,6 @@
2222
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
* THE SOFTWARE.
2424
*/
25-
/*
26-
/*
27-
* This file is part of Sponge, licensed under the MIT License (MIT).
28-
*
29-
* Copyright (c) SpongePowered.org <http://www.spongepowered.org>
30-
* Copyright (c) contributors
31-
*
32-
* Permission is hereby granted, free of charge, to any person obtaining a copy
33-
* of this software and associated documentation files (the "Software"), to deal
34-
* in the Software without restriction, including without limitation the rights
35-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
36-
* copies of the Software, and to permit persons to whom the Software is
37-
* furnished to do so, subject to the following conditions:
38-
*
39-
* The above copyright notice and this permission notice shall be included in
40-
* all copies or substantial portions of the Software.
41-
*
42-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
43-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
44-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
45-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
46-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
47-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
48-
* THE SOFTWARE.
49-
*/
50-
5125
package org.spongepowered.api.world.chunk;
5226

5327
import org.spongepowered.api.registry.DefaultedRegistryValue;

0 commit comments

Comments
 (0)