mirror of
https://github.com/kiranhart/Auction-House.git
synced 2025-01-07 12:47:36 +01:00
❌ remove "middleware" checks for some admin commands
Took 7 minutes
This commit is contained in:
parent
0ddbe26647
commit
f124de2d6b
@ -51,7 +51,7 @@ public class CommandBan extends AbstractCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||||
Player player = (Player) sender;
|
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();
|
final AuctionHouse instance = AuctionHouse.getInstance();
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
@ -50,7 +50,7 @@ public class CommandFilter extends AbstractCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||||
final Player player = (Player) sender;
|
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();
|
final AuctionHouse instance = AuctionHouse.getInstance();
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
@ -48,7 +48,7 @@ public final class CommandMarkChest extends AbstractCommand {
|
|||||||
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) return ReturnType.FAILURE;
|
if (!ServerVersion.isServerVersionAtLeast(ServerVersion.V1_14)) return ReturnType.FAILURE;
|
||||||
final Player player = (Player) sender;
|
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);
|
final Block targetBlock = player.getTargetBlock(null, 10);
|
||||||
if (targetBlock.getType() != XMaterial.CHEST.parseMaterial()) return ReturnType.FAILURE;
|
if (targetBlock.getType() != XMaterial.CHEST.parseMaterial()) return ReturnType.FAILURE;
|
||||||
|
@ -48,7 +48,7 @@ public class CommandMinPrice extends AbstractCommand {
|
|||||||
@Override
|
@Override
|
||||||
protected ReturnType runCommand(CommandSender sender, String... args) {
|
protected ReturnType runCommand(CommandSender sender, String... args) {
|
||||||
final Player player = (Player) sender;
|
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();
|
final AuctionHouse instance = AuctionHouse.getInstance();
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package ca.tweetzy.auctionhouse.helpers;
|
package ca.tweetzy.auctionhouse.helpers;
|
||||||
|
|
||||||
|
import ca.tweetzy.auctionhouse.api.AuctionAPI;
|
||||||
import ca.tweetzy.core.compatibility.XMaterial;
|
import ca.tweetzy.core.compatibility.XMaterial;
|
||||||
import de.tr7zw.changeme.nbtapi.NBT;
|
import de.tr7zw.changeme.nbtapi.NBT;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@ -36,6 +37,20 @@ public final class BundleUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<ItemStack> extractBundleItems(@NonNull final ItemStack itemStack) {
|
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"));
|
final ItemStack[] bundledItems = NBT.get(itemStack, nbt -> nbt.getItemStackArray("AuctionBundleItems"));
|
||||||
return new ArrayList<>(Arrays.asList(bundledItems));
|
return new ArrayList<>(Arrays.asList(bundledItems));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user