Skip to content

Commit b8c5a38

Browse files
committed
Add ChunkEvent.Unload.Pre and Post
Also cleanup targetChunk to chunk as it is self explanatory. Signed-off-by: Chris Sanders <[email protected]>
1 parent 4f58aeb commit b8c5a38

File tree

1 file changed

+37
-19
lines changed

1 file changed

+37
-19
lines changed

src/main/java/org/spongepowered/api/event/world/chunk/ChunkEvent.java

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,62 +36,80 @@
3636
public interface ChunkEvent extends Event {
3737

3838
/**
39-
* Gets the position of the {@link Chunk}, in chunk co-ordinates.
39+
* Gets the position of the {@link Chunk chunk}, in chunk co-ordinates.
4040
*
4141
* @return the position
4242
*/
4343
Vector3i chunkPosition();
4444

4545
/**
46-
* Represents an event that has knowledge about the {@link ServerWorld} that
46+
* Represents an event that has knowledge about the {@link ServerWorld world} that
4747
* is being operated upon.
4848
*/
4949
@NoFactoryMethod
5050
interface WorldScoped extends ChunkEvent {
5151

5252
/**
53-
* Gets the {@link ResourceKey} of the {@link WorldScoped} that the
54-
* {@link WorldChunk} resides in.
53+
* Gets the {@link ResourceKey key} of the {@link WorldScoped} that the
54+
* {@link WorldChunk chunk} resides in.
5555
*
56-
* <p>Be careful when retrieving the {@link ServerWorld} within this
56+
* <p>Be careful when retrieving the {@link ServerWorld world} within this
5757
* event as some events may not fire on the main thread and such world
5858
* access is not thread safe.</p>
5959
*
60-
* @return The world's {@link ResourceKey}
60+
* @return The world's {@link ResourceKey key}
6161
*/
6262
ResourceKey worldKey();
63-
6463
}
6564

6665
/**
67-
* Called when a {@link WorldChunk} was unloaded.
66+
* Called when a {@link WorldChunk chunk} was unloaded.
6867
*/
6968
interface Unload extends WorldScoped {
7069

70+
/**
71+
* Called before the {@link WorldChunk chunk} is unloaded.
72+
*/
73+
interface Pre extends Unload {
74+
75+
/**
76+
* Gets the {@link WorldChunk chunk} being changed.
77+
*
78+
* @return The chunk
79+
*/
80+
WorldChunk chunk();
81+
}
82+
83+
/**
84+
* Called after the {@link WorldChunk chunk} is unloaded.
85+
*/
86+
interface Post extends Unload {
87+
88+
}
7189
}
7290

7391
/**
74-
* Called when a {@link WorldChunk} is performing a save.
92+
* Called when a {@link WorldChunk chunk} is performing a save.
7593
*/
7694
interface Save extends WorldScoped {
7795

7896
/**
79-
* Called before the {@link WorldChunk} is saved. Cancelling this will prevent any of
97+
* Called before the {@link WorldChunk chunk} is saved. Cancelling this will prevent any of
8098
* the chunk's data being written to it's storage container.
8199
*/
82100
interface Pre extends Save, Cancellable {
83101

84102
/**
85-
* Gets the {@link WorldChunk} being changed.
103+
* Gets the {@link WorldChunk chunk} being changed.
86104
*
87-
* @return The Chunk
105+
* @return The chunk
88106
*/
89-
WorldChunk targetChunk();
107+
WorldChunk chunk();
90108

91109
}
92110

93111
/**
94-
* Called after the {@link WorldChunk} is saved. Guaranteed to exist in the chunk's
112+
* Called after the {@link WorldChunk chunk} is saved. Guaranteed to exist in the chunk's
95113
* storage container.
96114
*
97115
* Depending on the implementation, this event may be called off-thread.
@@ -100,22 +118,22 @@ interface Post extends Save {}
100118
}
101119

102120
/**
103-
* Called when a new {@link WorldChunk} was generated.
121+
* Called when a new {@link WorldChunk chunk} was generated.
104122
*/
105123
interface Generated extends WorldScoped {
106124

107125
}
108126

109127
/**
110-
* Called when a {@link WorldChunk} is done loading.
128+
* Called when a {@link WorldChunk chunk} is done loading.
111129
*/
112130
interface Load extends WorldScoped {
113131

114132
/**
115-
* Gets the {@link WorldChunk} being changed.
133+
* Gets the {@link WorldChunk chunk} being changed.
116134
*
117-
* @return The Chunk
135+
* @return The chunk
118136
*/
119-
WorldChunk targetChunk();
137+
WorldChunk chunk();
120138
}
121139
}

0 commit comments

Comments
 (0)