This repository has been archived by the owner on Nov 18, 2021. It is now read-only.
forked from MohistMC/Mohist
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2484da8
commit c0df81c
Showing
4 changed files
with
50 additions
and
4 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
43 changes: 43 additions & 0 deletions
43
src/main/java/net/minecraftforge/event/OnDatapackSyncEvent.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,43 @@ | ||
package net.minecraftforge.event; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
import net.minecraft.entity.player.ServerPlayerEntity; | ||
import net.minecraft.server.management.PlayerList; | ||
import net.minecraftforge.eventbus.api.Event; | ||
|
||
/** | ||
* Fires when a player joins the server or when the reload command is ran, | ||
* before tags and crafting recipes are sent to the client. Send datapack data | ||
* to clients when this event fires. | ||
*/ | ||
public class OnDatapackSyncEvent extends Event | ||
{ | ||
private final PlayerList playerList; | ||
@Nullable | ||
private final ServerPlayerEntity player; | ||
|
||
public OnDatapackSyncEvent(PlayerList playerList, @Nullable ServerPlayerEntity player) | ||
{ | ||
this.playerList = playerList; | ||
this.player = player; | ||
} | ||
|
||
/** | ||
* @return The server's player list to get a view of all players. | ||
*/ | ||
public PlayerList getPlayerList() | ||
{ | ||
return this.playerList; | ||
} | ||
|
||
/** | ||
* @return The player to sync datapacks to. Null when syncing for all players, | ||
* such as when the reload command runs. | ||
*/ | ||
@Nullable | ||
public ServerPlayerEntity getPlayer() | ||
{ | ||
return this.player; | ||
} | ||
} |