Clean repo for open source release
Remove build artifacts, dev tool configs, unused dependencies, and third-party source dumps. Add proper README, update .gitignore, clean up Makefile.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,223 @@
|
||||
package com.tiedup.remake.commands.subcommands;
|
||||
|
||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.tiedup.remake.commands.CommandHelper;
|
||||
import com.tiedup.remake.prison.PrisonerManager;
|
||||
import com.tiedup.remake.prison.RansomRecord;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
/**
|
||||
* Debt management sub-commands for /tiedup.
|
||||
* Handles: debt show, debt set, debt add, debt remove
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
public class DebtSubCommand {
|
||||
|
||||
public static void register(LiteralArgumentBuilder<CommandSourceStack> root) {
|
||||
// /tiedup debt <player> [set|add|remove <amount>]
|
||||
root.then(
|
||||
Commands.literal("debt")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.then(
|
||||
Commands.argument("player", EntityArgument.player())
|
||||
// /tiedup debt <player> -> show debt
|
||||
.executes(DebtSubCommand::debtShow)
|
||||
// /tiedup debt <player> set <amount>
|
||||
.then(
|
||||
Commands.literal("set").then(
|
||||
Commands.argument(
|
||||
"amount",
|
||||
IntegerArgumentType.integer(0)
|
||||
).executes(DebtSubCommand::debtSet)
|
||||
)
|
||||
)
|
||||
// /tiedup debt <player> add <amount>
|
||||
.then(
|
||||
Commands.literal("add").then(
|
||||
Commands.argument(
|
||||
"amount",
|
||||
IntegerArgumentType.integer(0)
|
||||
).executes(DebtSubCommand::debtAdd)
|
||||
)
|
||||
)
|
||||
// /tiedup debt <player> remove <amount>
|
||||
.then(
|
||||
Commands.literal("remove").then(
|
||||
Commands.argument(
|
||||
"amount",
|
||||
IntegerArgumentType.integer(0)
|
||||
).executes(DebtSubCommand::debtRemove)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// Command Implementations
|
||||
// ========================================
|
||||
|
||||
private static int debtShow(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer target = EntityArgument.getPlayer(context, "player");
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
PrisonerManager manager = PrisonerManager.get(level);
|
||||
RansomRecord ransom = manager.getRansomRecord(target.getUUID());
|
||||
|
||||
if (ransom == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
target.getName().getString() +
|
||||
" has no debt record."
|
||||
),
|
||||
false
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int total = ransom.getTotalDebt();
|
||||
int paid = ransom.getAmountPaid();
|
||||
int remaining = ransom.getRemainingDebt();
|
||||
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
target.getName().getString() +
|
||||
" \u2014 Debt: " +
|
||||
total +
|
||||
" | Paid: " +
|
||||
paid +
|
||||
" | Remaining: " +
|
||||
remaining +
|
||||
" emeralds"
|
||||
),
|
||||
false
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int debtSet(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer target = EntityArgument.getPlayer(context, "player");
|
||||
int amount = IntegerArgumentType.getInteger(context, "amount");
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
PrisonerManager manager = PrisonerManager.get(level);
|
||||
RansomRecord ransom = manager.getRansomRecord(target.getUUID());
|
||||
|
||||
if (ransom == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " has no debt record."
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ransom.setTotalDebt(amount);
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Set " +
|
||||
target.getName().getString() +
|
||||
"'s total debt to " +
|
||||
amount +
|
||||
" emeralds."
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int debtAdd(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer target = EntityArgument.getPlayer(context, "player");
|
||||
int amount = IntegerArgumentType.getInteger(context, "amount");
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
PrisonerManager manager = PrisonerManager.get(level);
|
||||
RansomRecord ransom = manager.getRansomRecord(target.getUUID());
|
||||
|
||||
if (ransom == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " has no debt record."
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ransom.increaseDebt(amount);
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Added " +
|
||||
amount +
|
||||
" emeralds to " +
|
||||
target.getName().getString() +
|
||||
"'s debt. Remaining: " +
|
||||
ransom.getRemainingDebt()
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int debtRemove(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer target = EntityArgument.getPlayer(context, "player");
|
||||
int amount = IntegerArgumentType.getInteger(context, "amount");
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
PrisonerManager manager = PrisonerManager.get(level);
|
||||
RansomRecord ransom = manager.getRansomRecord(target.getUUID());
|
||||
|
||||
if (ransom == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal(
|
||||
target.getName().getString() + " has no debt record."
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ransom.addPayment(amount, null);
|
||||
boolean paid = ransom.isPaid();
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Removed " +
|
||||
amount +
|
||||
" emeralds from " +
|
||||
target.getName().getString() +
|
||||
"'s debt. Remaining: " +
|
||||
ransom.getRemainingDebt() +
|
||||
(paid ? " (PAID OFF!)" : "")
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.tiedup.remake.commands.subcommands;
|
||||
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.tiedup.remake.cells.ConfiscatedInventoryRegistry;
|
||||
import com.tiedup.remake.commands.CommandHelper;
|
||||
import com.tiedup.remake.core.SystemMessageManager;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
/**
|
||||
* Inventory management sub-commands for /tiedup.
|
||||
* Handles: returnstuff
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
public class InventorySubCommand {
|
||||
|
||||
public static void register(LiteralArgumentBuilder<CommandSourceStack> root) {
|
||||
// /tiedup returnstuff <player>
|
||||
root.then(
|
||||
Commands.literal("returnstuff")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.then(
|
||||
Commands.argument("player", EntityArgument.player())
|
||||
.executes(InventorySubCommand::returnstuff)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// Command Implementations
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* /tiedup returnstuff <player>
|
||||
*
|
||||
* Restore a player's confiscated inventory from the NBT backup.
|
||||
* Items are given directly to the player, bypassing the chest.
|
||||
*/
|
||||
private static int returnstuff(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer targetPlayer = EntityArgument.getPlayer(context, "player");
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
|
||||
ConfiscatedInventoryRegistry registry =
|
||||
ConfiscatedInventoryRegistry.get(level);
|
||||
|
||||
if (!registry.hasConfiscatedInventory(targetPlayer.getUUID())) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal(
|
||||
targetPlayer.getName().getString() +
|
||||
" has no confiscated inventory to restore"
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean restored = registry.restoreInventory(targetPlayer);
|
||||
|
||||
if (restored) {
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"\u00a7aRestored confiscated inventory to " +
|
||||
targetPlayer.getName().getString()
|
||||
),
|
||||
true
|
||||
);
|
||||
SystemMessageManager.sendToPlayer(
|
||||
targetPlayer,
|
||||
SystemMessageManager.MessageCategory.INFO,
|
||||
"Your confiscated items have been returned!"
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal(
|
||||
"Failed to restore inventory for " +
|
||||
targetPlayer.getName().getString()
|
||||
)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
package com.tiedup.remake.commands.subcommands;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.tiedup.remake.commands.CommandHelper;
|
||||
import com.tiedup.remake.entities.EntityMaster;
|
||||
import com.tiedup.remake.entities.ModEntities;
|
||||
import com.tiedup.remake.entities.ai.master.MasterState;
|
||||
import com.tiedup.remake.state.PlayerBindState;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
|
||||
/**
|
||||
* Master/pet-play test sub-commands for /tiedup.
|
||||
* Handles: mastertest, masterchair, mastertask
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
public class MasterTestSubCommand {
|
||||
|
||||
public static void register(LiteralArgumentBuilder<CommandSourceStack> root) {
|
||||
// /tiedup mastertest
|
||||
root.then(
|
||||
Commands.literal("mastertest")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.executes(MasterTestSubCommand::mastertest)
|
||||
);
|
||||
// /tiedup masterchair
|
||||
root.then(
|
||||
Commands.literal("masterchair")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.executes(MasterTestSubCommand::masterchair)
|
||||
);
|
||||
// /tiedup mastertask <task>
|
||||
root.then(
|
||||
Commands.literal("mastertask")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.then(
|
||||
Commands.argument("task", StringArgumentType.word())
|
||||
.suggests((ctx, builder) -> {
|
||||
for (MasterState s : MasterState.values()) {
|
||||
builder.suggest(s.name().toLowerCase());
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(MasterTestSubCommand::mastertask)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// Command Implementations
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* /tiedup mastertest
|
||||
*
|
||||
* Spawn a Master NPC nearby and immediately become its pet.
|
||||
* For testing the pet play system without going through capture.
|
||||
*/
|
||||
private static int mastertest(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
ServerLevel level = context.getSource().getLevel();
|
||||
|
||||
double x = player.getX() + player.getLookAngle().x * 2;
|
||||
double y = player.getY();
|
||||
double z = player.getZ() + player.getLookAngle().z * 2;
|
||||
|
||||
EntityMaster master = ModEntities.MASTER.get().create(level);
|
||||
if (master == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal("Failed to create Master entity")
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
master.moveTo(x, y, z, player.getYRot() + 180F, 0.0F);
|
||||
master.finalizeSpawn(
|
||||
level,
|
||||
level.getCurrentDifficultyAt(master.blockPosition()),
|
||||
MobSpawnType.COMMAND,
|
||||
null,
|
||||
null
|
||||
);
|
||||
level.addFreshEntity(master);
|
||||
|
||||
master.setPetPlayer(player);
|
||||
master.putPetCollar(player);
|
||||
|
||||
CommandHelper.syncPlayerState(player, PlayerBindState.getInstance(player));
|
||||
|
||||
String masterName = master.getNpcName();
|
||||
if (masterName == null || masterName.isEmpty()) masterName = "Master";
|
||||
|
||||
String finalName = masterName;
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Spawned Master '" +
|
||||
finalName +
|
||||
"' \u2014 you are now their pet."
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* /tiedup masterchair
|
||||
*
|
||||
* Force the nearest Master NPC into HUMAN_CHAIR state.
|
||||
* Requires the player to be that Master's pet.
|
||||
*/
|
||||
private static int masterchair(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
EntityMaster master = findNearestMaster(player);
|
||||
|
||||
if (master == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal("No Master NPC found within 20 blocks")
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!master.hasPet()) {
|
||||
master.setPetPlayer(player);
|
||||
master.putPetCollar(player);
|
||||
CommandHelper.syncPlayerState(player, PlayerBindState.getInstance(player));
|
||||
}
|
||||
|
||||
master.setMasterState(MasterState.HUMAN_CHAIR);
|
||||
|
||||
String masterName = master.getNpcName();
|
||||
if (masterName == null || masterName.isEmpty()) masterName = "Master";
|
||||
String finalName = masterName;
|
||||
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Forced " + finalName + " into HUMAN_CHAIR state"
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* /tiedup mastertask <state>
|
||||
*
|
||||
* Force the nearest Master NPC into any MasterState.
|
||||
* Useful for testing specific master behaviors.
|
||||
*/
|
||||
private static int mastertask(CommandContext<CommandSourceStack> context)
|
||||
throws CommandSyntaxException {
|
||||
ServerPlayer player = context.getSource().getPlayerOrException();
|
||||
String taskName = StringArgumentType.getString(context, "task");
|
||||
|
||||
MasterState targetState;
|
||||
try {
|
||||
targetState = MasterState.valueOf(taskName.toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal("Unknown MasterState: " + taskName)
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
EntityMaster master = findNearestMaster(player);
|
||||
if (master == null) {
|
||||
context
|
||||
.getSource()
|
||||
.sendFailure(
|
||||
Component.literal("No Master NPC found within 20 blocks")
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!master.hasPet()) {
|
||||
master.setPetPlayer(player);
|
||||
master.putPetCollar(player);
|
||||
CommandHelper.syncPlayerState(player, PlayerBindState.getInstance(player));
|
||||
}
|
||||
|
||||
master.setMasterState(targetState);
|
||||
|
||||
String masterName = master.getNpcName();
|
||||
if (masterName == null || masterName.isEmpty()) masterName = "Master";
|
||||
String finalName = masterName;
|
||||
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Forced " +
|
||||
finalName +
|
||||
" into " +
|
||||
targetState.name() +
|
||||
" state"
|
||||
),
|
||||
true
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the nearest EntityMaster within 20 blocks of a player.
|
||||
*/
|
||||
@javax.annotation.Nullable
|
||||
private static EntityMaster findNearestMaster(ServerPlayer player) {
|
||||
var masters = player
|
||||
.level()
|
||||
.getEntitiesOfClass(
|
||||
EntityMaster.class,
|
||||
player.getBoundingBox().inflate(20.0),
|
||||
m -> m.isAlive()
|
||||
);
|
||||
if (masters.isEmpty()) return null;
|
||||
return masters
|
||||
.stream()
|
||||
.min((a, b) ->
|
||||
Double.compare(a.distanceToSqr(player), b.distanceToSqr(player))
|
||||
)
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package com.tiedup.remake.commands.subcommands;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.tiedup.remake.commands.CommandHelper;
|
||||
import com.tiedup.remake.network.ModNetwork;
|
||||
import com.tiedup.remake.network.sync.PacketPlayTestAnimation;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.EntityArgument;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
||||
/**
|
||||
* Test animation sub-commands for /tiedup.
|
||||
* Handles: testanim <animId> [player], testanim stop [player]
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
public class TestAnimSubCommand {
|
||||
|
||||
public static void register(LiteralArgumentBuilder<CommandSourceStack> root) {
|
||||
// /tiedup testanim <animId> [player]
|
||||
// /tiedup testanim stop [player]
|
||||
root.then(
|
||||
Commands.literal("testanim")
|
||||
.requires(CommandHelper.REQUIRES_OP)
|
||||
.then(
|
||||
Commands.literal("stop")
|
||||
.executes(ctx -> testAnimStop(ctx, null))
|
||||
.then(
|
||||
Commands.argument("player", EntityArgument.player())
|
||||
.executes(ctx ->
|
||||
testAnimStop(
|
||||
ctx,
|
||||
EntityArgument.getPlayer(ctx, "player")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
.then(
|
||||
Commands.argument("animId", StringArgumentType.string())
|
||||
.executes(ctx -> testAnim(ctx, null))
|
||||
.then(
|
||||
Commands.argument("player", EntityArgument.player())
|
||||
.executes(ctx ->
|
||||
testAnim(
|
||||
ctx,
|
||||
EntityArgument.getPlayer(ctx, "player")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// Command Implementations
|
||||
// ========================================
|
||||
|
||||
/**
|
||||
* /tiedup testanim <animId> [player]
|
||||
* Play an animation from player_animation/ on a player.
|
||||
*/
|
||||
private static int testAnim(
|
||||
CommandContext<CommandSourceStack> context,
|
||||
ServerPlayer target
|
||||
) throws CommandSyntaxException {
|
||||
if (target == null) {
|
||||
target = context.getSource().getPlayerOrException();
|
||||
}
|
||||
String animId = StringArgumentType.getString(context, "animId");
|
||||
|
||||
ModNetwork.sendToAllTrackingAndSelf(
|
||||
new PacketPlayTestAnimation(target.getUUID(), animId),
|
||||
target
|
||||
);
|
||||
|
||||
final String name = target.getName().getString();
|
||||
final String anim = animId;
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() ->
|
||||
Component.literal(
|
||||
"Playing animation '" + anim + "' on " + name
|
||||
),
|
||||
false
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* /tiedup testanim stop [player]
|
||||
* Stop animation on a player.
|
||||
*/
|
||||
private static int testAnimStop(
|
||||
CommandContext<CommandSourceStack> context,
|
||||
ServerPlayer target
|
||||
) throws CommandSyntaxException {
|
||||
if (target == null) {
|
||||
target = context.getSource().getPlayerOrException();
|
||||
}
|
||||
|
||||
ModNetwork.sendToAllTrackingAndSelf(
|
||||
new PacketPlayTestAnimation(target.getUUID(), ""),
|
||||
target
|
||||
);
|
||||
|
||||
final String name = target.getName().getString();
|
||||
context
|
||||
.getSource()
|
||||
.sendSuccess(
|
||||
() -> Component.literal("Stopped animation on " + name),
|
||||
false
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user