mirror of
https://github.com/MovingBlocks/Terasology
synced 2026-05-24 09:28:22 +00:00
fix(DiscordRPC): NPE on shutdown (#4723)
This commit is contained in:
parent
20aeb826ff
commit
f8022aeee2
1 changed files with 7 additions and 5 deletions
|
|
@ -71,20 +71,22 @@ public void postBegin() {
|
|||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
if (delayManager.hasPeriodicAction(player.getClientEntity(), UPDATE_PARTY_SIZE_ID)) {
|
||||
delayManager.cancelPeriodicAction(player.getClientEntity(), UPDATE_PARTY_SIZE_ID);
|
||||
if (player != null) {
|
||||
EntityRef client = player.getClientEntity();
|
||||
if (delayManager != null && delayManager.hasPeriodicAction(client, UPDATE_PARTY_SIZE_ID)) {
|
||||
delayManager.cancelPeriodicAction(client, UPDATE_PARTY_SIZE_ID);
|
||||
}
|
||||
}
|
||||
|
||||
DiscordRPCSubSystem.reset();
|
||||
DiscordRPCSubSystem.setState("In Main Menu");
|
||||
DiscordRPCSubSystem.setStartTimestamp(null);
|
||||
}
|
||||
|
||||
@ReceiveEvent
|
||||
public void onPlayerInitialized(LocalPlayerInitializedEvent event, EntityRef player) {
|
||||
public void onPlayerInitialized(LocalPlayerInitializedEvent event, EntityRef localPlayer) {
|
||||
/* Adds the periodic action when the player is hosting or playing online to update party size */
|
||||
if (networkSystem.getMode() != NetworkMode.NONE) {
|
||||
delayManager.addPeriodicAction(player, UPDATE_PARTY_SIZE_ID, 0, UPDATE_PARTY_SIZE_PERIOD);
|
||||
delayManager.addPeriodicAction(localPlayer, UPDATE_PARTY_SIZE_ID, 0, UPDATE_PARTY_SIZE_PERIOD);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue