1234567891011121314151617181920212223242526272829303132333435 |
- package me.kcm;
- import java.util.function.Consumer;
- import net.minecraft.server.dedicated.DedicatedPlayerList;
- import net.minecraft.server.dedicated.DedicatedServer;
- public class Hooks
- {
- private static Consumer<DedicatedServer> playerListFunction = null;
- public static void setPlayerListFunction(Consumer<DedicatedServer> c)
- {
- playerListFunction = c;
- }
- public static void setPlayerList(DedicatedServer server)
- {
- if(playerListFunction != null)
- {
- playerListFunction.accept(server);
- }
- else
- {
- try
- {
- server.setPlayerList(new DedicatedPlayerList(server));
- }
- catch(Exception ex)
- {
- // this is stupid and should not be needed
- ex.printStackTrace();
- }
- }
- }
- }
|