Skip to content

Commit

Permalink
Made the plugin working for the newest paper build (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
TimeCodings authored Sep 27, 2023
1 parent 5f27838 commit d0231a3
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
29 changes: 17 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@
</properties>

<repositories>
<!-- for spigot -->
<repository>
<id>spigotmc</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

<!-- for vault -->
<repository>
<id>codemc-repo</id>
Expand All @@ -42,7 +36,7 @@
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
</repository>

<!-- for mockbukkit -->
<!-- for mockbukkit & paper -->
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
Expand All @@ -56,13 +50,20 @@
</repositories>

<dependencies>
<!-- Minecraft plugin -->
<!-- Paper Dependency -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.5-R0.1-SNAPSHOT</version>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.18.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- MockBukkit Dependency -->
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.18</artifactId>
<version>2.85.2</version>
<scope>test</scope>
</dependency>
<!-- HTTP Server -->
<dependency>
<groupId>io.javalin</groupId>
Expand Down Expand Up @@ -134,6 +135,11 @@
<version>2.0.9</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
Expand Down Expand Up @@ -191,7 +197,6 @@
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
Expand Down
38 changes: 37 additions & 1 deletion src/main/java/io/servertap/utils/ServerExecCommandSender.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,34 @@

import io.servertap.Constants;
import io.servertap.ServerTapMain;
import net.kyori.adventure.text.Component;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.command.RemoteConsoleCommandSender;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.*;

public class ServerExecCommandSender implements RemoteConsoleCommandSender {
public class ServerExecCommandSender implements ConsoleCommandSender {

private static final ScheduledThreadPoolExecutor EXECUTOR = new ScheduledThreadPoolExecutor(1);
private static final ConsoleCommandSender CONSOLE_COMMAND_SENDER = Bukkit.getConsoleSender();
Expand Down Expand Up @@ -149,6 +156,31 @@ public Server getServer() {
return CONSOLE_COMMAND_SENDER.getServer();
}

@Override
public boolean isConversing() {
return CONSOLE_COMMAND_SENDER.isConversing();
}

@Override
public void acceptConversationInput(@NotNull String input) {
CONSOLE_COMMAND_SENDER.acceptConversationInput(input);
}

@Override
public boolean beginConversation(@NotNull Conversation conversation) {
return CONSOLE_COMMAND_SENDER.beginConversation(conversation);
}

@Override
public void abandonConversation(@NotNull Conversation conversation) {
CONSOLE_COMMAND_SENDER.abandonConversation(conversation);
}

@Override
public void abandonConversation(@NotNull Conversation conversation, @NotNull ConversationAbandonedEvent details) {
CONSOLE_COMMAND_SENDER.abandonConversation(conversation, details);
}

public void sendRawMessage(String raw) {
CONSOLE_COMMAND_SENDER.sendRawMessage(raw);
}
Expand All @@ -168,4 +200,8 @@ public CommandSender.Spigot spigot() {
}
}

@Override
public @NotNull Component name() {
return CONSOLE_COMMAND_SENDER.name();
}
}
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: ServerTap
main: io.servertap.ServerTapMain
version: 0.5.4-SNAPSHOT
description: ServerTap is a REST API for Bukkit/Spigot/PaperMC Minecraft servers.
authors: [phybros, ATechAdventurer, c1oneman, Earlh21, Scarsz, au5ton, Aberdeener, Hedlund01, matteoturini, Diddyy, Velyn-N, srmullaney]
authors: [phybros, ATechAdventurer, c1oneman, Earlh21, Scarsz, au5ton, Aberdeener, Hedlund01, matteoturini, Diddyy, Velyn-N, srmullaney, TimeCoding]
load: STARTUP
website: https://servertap.io
api-version: 1.16
Expand Down

0 comments on commit d0231a3

Please sign in to comment.