Skip to content

Commit 1d95a9c

Browse files
committed
0.8.15
1 parent b88a25f commit 1d95a9c

3 files changed

Lines changed: 17 additions & 2 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ mod_name=Area Control
3434
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
3535
mod_license=BSD-3-Clause
3636
# The mod version. See https://semver.org/
37-
mod_version=0.8.14
37+
mod_version=0.8.15
3838
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
3939
# This should match the base package used for the mod sources.
4040
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

src/main/java/org/teacon/areacontrol/AreaControlCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.teacon.areacontrol.impl.command.arguments.AreaPropertyArgument;
3434
import org.teacon.areacontrol.impl.command.arguments.DirectionArgument;
3535
import org.teacon.areacontrol.impl.command.arguments.GroupArgument;
36+
import org.teacon.areacontrol.impl.seizer.AreaControlBorderControl;
3637
import org.teacon.areacontrol.impl.seizer.ConfiscationInvMenuProvider;
3738
import org.teacon.areacontrol.mixin.CommandSourceStackAccessor;
3839
import org.teacon.areacontrol.network.ACNetworking;
@@ -162,12 +163,21 @@ public AreaControlCommand(CommandDispatcher<CommandSourceStack> dispatcher) {
162163
.then(Commands.literal("mark").requires(OWNER_OR_ADMIN).then(
163164
Commands.argument("pos", Vec3Argument.vec3()).executes(AreaControlCommand::mark)))
164165
.then(Commands.literal("unclaim").requires(OWNER_OR_ADMIN).executes(AreaControlCommand::unclaim))
165-
.then(Commands.literal("safe").executes(AreaControlCommand::openConfiscatedItemInv))
166+
.then(Commands.literal("safe")
167+
.then(Commands.literal("clear").executes(AreaControlCommand::clearConfiscatedItemInv)
168+
)
169+
.executes(AreaControlCommand::openConfiscatedItemInv))
166170
)
167171
)
168172
);
169173
}
170174

175+
private static int clearConfiscatedItemInv(CommandContext<CommandSourceStack> context) throws CommandSyntaxException{
176+
var player = context.getSource().getPlayerOrException();
177+
player.getData(AreaControlBorderControl.CONFISCATION_INV.get()).clear();
178+
return Command.SINGLE_SUCCESS;
179+
}
180+
171181
private static int openConfiscatedItemInv(CommandContext<CommandSourceStack> context) throws CommandSyntaxException{
172182
var player = context.getSource().getPlayerOrException();
173183
player.openMenu(new ConfiscationInvMenuProvider());

src/main/java/org/teacon/areacontrol/impl/seizer/ConfiscationInv.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import net.neoforged.neoforge.common.util.INBTSerializable;
1212
import org.jetbrains.annotations.NotNull;
1313

14+
import java.util.Collections;
1415
import java.util.Optional;
1516

1617
public class ConfiscationInv implements INBTSerializable<CompoundTag> {
@@ -61,6 +62,10 @@ public void add(ItemStack seized) {
6162
}
6263
}
6364

65+
public void clear() {
66+
Collections.fill(this.seizedItems, ItemStack.EMPTY);
67+
}
68+
6469
final class ContainerWrapper implements Container {
6570

6671
@Override

0 commit comments

Comments
 (0)