remove "middleware" checks for some admin commands

Took 7 minutes
This commit is contained in:
Kiran Hart 2023-06-20 18:42:46 -04:00
parent 0ddbe26647
commit f124de2d6b
No known key found for this signature in database
GPG Key ID: 5F36C7BC79D3EBC3
5 changed files with 19 additions and 4 deletions

View File

@ -51,7 +51,7 @@ public class CommandBan extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
Player player = (Player) sender;
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
// if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
final AuctionHouse instance = AuctionHouse.getInstance();
if (args.length == 0) {

View File

@ -50,7 +50,7 @@ public class CommandFilter extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
final Player player = (Player) sender;
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
// if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
final AuctionHouse instance = AuctionHouse.getInstance();
if (args.length == 0) {

View File

@ -48,7 +48,7 @@ public final class CommandMarkChest extends AbstractCommand {
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) return ReturnType.FAILURE;
final Player player = (Player) sender;
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
// if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
final Block targetBlock = player.getTargetBlock(null, 10);
if (targetBlock.getType() != XMaterial.CHEST.parseMaterial()) return ReturnType.FAILURE;

View File

@ -48,7 +48,7 @@ public class CommandMinPrice extends AbstractCommand {
@Override
protected ReturnType runCommand(CommandSender sender, String... args) {
final Player player = (Player) sender;
if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
// if (CommandMiddleware.handle(player) == ReturnType.FAILURE) return ReturnType.FAILURE;
final AuctionHouse instance = AuctionHouse.getInstance();
if (args.length == 0) {

View File

@ -18,6 +18,7 @@
package ca.tweetzy.auctionhouse.helpers;
import ca.tweetzy.auctionhouse.api.AuctionAPI;
import ca.tweetzy.core.compatibility.XMaterial;
import de.tr7zw.changeme.nbtapi.NBT;
import lombok.NonNull;
@ -36,6 +37,20 @@ public final class BundleUtil {
}
public List<ItemStack> extractBundleItems(@NonNull final ItemStack itemStack) {
final List<ItemStack> items = new ArrayList<>();
final int totalBundledItems = NBT.get(itemStack, nbt -> nbt.getInteger("AuctionBundleItem"));
for (int i = 0; i < totalBundledItems; i++) {
int finalI = i;
if (NBT.get(itemStack, nbt -> nbt.hasTag("AuctionBundleItem-" + finalI)))
items.add(AuctionAPI.getInstance().deserializeItem(NBT.get(itemStack, nbt -> nbt.getByteArray("AuctionBundleItem-" + finalI))));
}
if (!items.isEmpty())
return items;
final ItemStack[] bundledItems = NBT.get(itemStack, nbt -> nbt.getItemStackArray("AuctionBundleItems"));
return new ArrayList<>(Arrays.asList(bundledItems));
}