-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #6
- Loading branch information
Showing
4 changed files
with
56 additions
and
7 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
33 changes: 33 additions & 0 deletions
33
bungee/src/main/java/io/mystiflow/catalogue/CatalogueListener.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,33 @@ | ||
package io.mystiflow.catalogue; | ||
|
||
import net.md_5.bungee.api.connection.ProxiedPlayer; | ||
import net.md_5.bungee.api.event.PlayerDisconnectEvent; | ||
import net.md_5.bungee.api.event.ServerSwitchEvent; | ||
import net.md_5.bungee.api.plugin.Listener; | ||
import net.md_5.bungee.event.EventHandler; | ||
|
||
public class CatalogueListener implements Listener { | ||
|
||
private final CataloguePlugin plugin; | ||
|
||
public CatalogueListener(CataloguePlugin plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
@EventHandler | ||
public void onDisconnect(PlayerDisconnectEvent event) { | ||
cancelDelays(event.getPlayer()); | ||
} | ||
|
||
@EventHandler | ||
public void onServerSwitch(ServerSwitchEvent event) { | ||
cancelDelays(event.getPlayer()); | ||
} | ||
|
||
private void cancelDelays(ProxiedPlayer player) { | ||
plugin.getCatalogue().getMessages() | ||
.forEach(message -> message.getActions() | ||
.forEach(action -> action.getActiveDelays().remove("$" + player.getName()))); | ||
|
||
} | ||
} |
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