Skip to content

Commit

Permalink
show commands
Browse files Browse the repository at this point in the history
  • Loading branch information
michaljaz committed Dec 30, 2023
1 parent aee9726 commit 8eab8e8
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,20 @@ public void onEnable() {
socket = new WebSocketClient(URI.create(serverURI)) {
@Override
public void onOpen(ServerHandshake handshakedata) {
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "ShopMC connection opened");
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[ShopMC] connection opened");
}

@Override
public void onMessage(String commands) {
Bukkit.getConsoleSender().sendMessage(ChatColor.GREEN + "[ShopMC] Received commands: " + ChatColor.RESET + commands);
for (String command : commands.split("\n")) {
Bukkit.getScheduler().runTask(_this, () -> Bukkit.dispatchCommand(getServer().getConsoleSender(), command));
}
}

@Override
public void onClose(int code, String reason, boolean remote) {
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "ShopMC connection closed");
Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "[ShopMC] connection closed");
new BukkitRunnable() {
@Override
public void run() {
Expand Down

0 comments on commit 8eab8e8

Please sign in to comment.