added command krakatao for testing
parent
1687594792
commit
34887d4a22
|
@ -12,8 +12,10 @@ import earth.krakatao.protocol.KraSocketClientProtocolStatus;
|
|||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import net.krakatoaapi.command.KrakataoCommand;
|
||||
import net.krakatoaapi.config.ConfigHandler;
|
||||
import net.krakatoaapi.listener.PlayerJoinListener;
|
||||
import net.krakatoaapi.listener.PlayerQuitListener;
|
||||
|
@ -76,6 +78,7 @@ public class KrakatoaAPI extends JavaPlugin {
|
|||
this.mongoManager.connect(this.configHandler.getMongodbDatabase());
|
||||
|
||||
loadListeners();
|
||||
loadCommands();
|
||||
|
||||
// call to proxy that the server is only for the auto restart system
|
||||
Bukkit.getScheduler().runTaskLaterAsynchronously(this, () -> {
|
||||
|
@ -106,4 +109,9 @@ public class KrakatoaAPI extends JavaPlugin {
|
|||
pluginManager.registerEvents(listener, this);
|
||||
});
|
||||
}
|
||||
|
||||
public void loadCommands() {
|
||||
Objects.requireNonNull(getCommand("krakatoa")).setExecutor(new KrakataoCommand());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package net.krakatoaapi.command;
|
||||
|
||||
import net.krakatoaapi.KrakatoaAPI;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class KrakataoCommand implements CommandExecutor {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command,
|
||||
@NotNull String label, @NotNull String[] args) {
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = ((Player) sender).getPlayer();
|
||||
|
||||
if (player != null) {
|
||||
player.sendMessage("§a" +
|
||||
KrakatoaAPI.getInstance().getKraSocketClientProtocol().getSendQueueMessages().size()
|
||||
+ " §7messages in §asend queue");
|
||||
player.sendMessage("§a" +
|
||||
KrakatoaAPI.getInstance().getKraSocketClientProtocol().getReceivedQueueMessages().size()
|
||||
+ " §7messages in §areceived queue");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -2,4 +2,6 @@ name: KrakatoaAPI
|
|||
version: 1.0
|
||||
author: AlexanderRoese
|
||||
main: net.krakatoaapi.KrakatoaAPI
|
||||
api-version: '1.17'
|
||||
api-version: '1.17'
|
||||
commands:
|
||||
krakatoa:
|
Loading…
Reference in New Issue