-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move events out of server player event
- Loading branch information
1 parent
74ea0f6
commit 1a3027a
Showing
13 changed files
with
142 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/net/neoforged/neoforge/event/entity/player/PlayerChangeGameModeEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.event.entity.player; | ||
|
||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.level.GameType; | ||
import net.neoforged.bus.api.ICancellableEvent; | ||
|
||
/** | ||
* Fired when the game type of a server player is changed to a different value than what it was previously. Eg Creative to Survival, not Survival to Survival. | ||
* If the event is cancelled the game mode of the player is not changed and the value of <code>newGameMode</code> is ignored. | ||
*/ | ||
public class PlayerChangeGameModeEvent extends ServerPlayerEvent implements ICancellableEvent { | ||
private final GameType currentGameMode; | ||
private GameType newGameMode; | ||
|
||
public PlayerChangeGameModeEvent(ServerPlayer player, GameType currentGameMode, GameType newGameMode) { | ||
super(player); | ||
this.currentGameMode = currentGameMode; | ||
this.newGameMode = newGameMode; | ||
} | ||
|
||
public GameType getCurrentGameMode() { | ||
return currentGameMode; | ||
} | ||
|
||
public GameType getNewGameMode() { | ||
return newGameMode; | ||
} | ||
|
||
/** | ||
* Sets the game mode the player will be changed to if this event is not cancelled. | ||
*/ | ||
public void setNewGameMode(GameType newGameMode) { | ||
this.newGameMode = newGameMode; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/net/neoforged/neoforge/event/entity/player/PlayerChangedDimensionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.event.entity.player; | ||
|
||
import net.minecraft.resources.ResourceKey; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import net.minecraft.world.level.Level; | ||
|
||
public class PlayerChangedDimensionEvent extends ServerPlayerEvent { | ||
private final ResourceKey<Level> originalDimension; | ||
private final ResourceKey<Level> newDimension; | ||
public PlayerChangedDimensionEvent(ServerPlayer player, ResourceKey<Level> originalDimension, ResourceKey<Level> newDimension) { | ||
super(player); | ||
this.originalDimension = originalDimension; | ||
this.newDimension = newDimension; | ||
} | ||
|
||
public ResourceKey<Level> getOriginalDimension() { | ||
return originalDimension; | ||
} | ||
|
||
public ResourceKey<Level> getNewDimension() { | ||
return newDimension; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/net/neoforged/neoforge/event/entity/player/PlayerLoggedInEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.event.entity.player; | ||
|
||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class PlayerLoggedInEvent extends ServerPlayerEvent { | ||
public PlayerLoggedInEvent(ServerPlayer player) { | ||
super(player); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/net/neoforged/neoforge/event/entity/player/PlayerLoggedOutEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.event.entity.player; | ||
|
||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class PlayerLoggedOutEvent extends ServerPlayerEvent { | ||
public PlayerLoggedOutEvent(ServerPlayer entity) { | ||
super(entity); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/net/neoforged/neoforge/event/entity/player/PlayerRespawnEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.event.entity.player; | ||
|
||
import net.minecraft.server.level.ServerPlayer; | ||
|
||
public class PlayerRespawnEvent extends ServerPlayerEvent { | ||
private final boolean endConquered; | ||
|
||
public PlayerRespawnEvent(ServerPlayer player, boolean endConquered) { | ||
super(player); | ||
this.endConquered = endConquered; | ||
} | ||
|
||
/** | ||
* Did this respawn event come from the player conquering the end? | ||
* | ||
* @return if this respawn was because the player conquered the end | ||
*/ | ||
public boolean isEndConquered() { | ||
return this.endConquered; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.