commands output reliable return values and new result for run if not run directly
This commit is contained in:
1 parent
31968bb5d2
commit
07de4fb4a5
4 files changed
+31
-13
No files matched your search
@@ -83,6 +83,7 @@ public class ServerNetworkHandler
|
||||
String id = commandData.getString("id");
|
||||
List<Component> output = new ArrayList<>();
|
||||
Component[] error = {null};
|
||||
int[] returnValue = {0};
|
||||
if (player.getServer() == null)
|
||||
{
|
||||
error[0] = Component.literal("No Server");
|
||||
@@ -90,7 +91,7 @@ public class ServerNetworkHandler
|
||||
else
|
||||
{
|
||||
player.getServer().getCommands().performPrefixedCommand(
|
||||
new SnoopyCommandSource(player, error, output), command
|
||||
new SnoopyCommandSource(player, error, output, returnValue), command
|
||||
);
|
||||
}
|
||||
CompoundTag result = new CompoundTag();
|
||||
@@ -99,6 +100,7 @@ public class ServerNetworkHandler
|
||||
{
|
||||
result.putString("error", error[0].getContents().toString());
|
||||
}
|
||||
result.putInt("return", returnValue[0]);
|
||||
ListTag outputResult = new ListTag();
|
||||
for (Component line : output)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user