Large Auction Cleanup + Auction Events

- Auction Enums
- Better Notification Handling
- Auction Cancelation Events
- Lang Key Cleanup
This commit is contained in:
Kam committed 2026-02-18 04:55:03 -05:00
1 parent 0512588a7a
commit 4510b3bbd1
31 files changed
+889 -578

No files matched your search

@@ -20,6 +20,7 @@ import static kamkeel.npcs.util.ColorUtil.sendMessage;
import static kamkeel.npcs.util.ColorUtil.sendResult;
public class AuctionCommand extends CommandKamkeelBase {
private static final int COMMAND_PAGE_SIZE = 10;
public AuctionCommand() {
super();
@@ -62,9 +63,10 @@ public class AuctionCommand extends CommandKamkeelBase {
}
}
List<AuctionListing> listings = controller.getActiveListings(null, page - 1, 10);
page = Math.max(1, page);
List<AuctionListing> listings = controller.getActiveListings(null, page - 1, COMMAND_PAGE_SIZE);
int total = controller.getTotalActiveListings(null);
int totalPages = Math.max(1, (int) Math.ceil((double) total / 10));
int totalPages = Math.max(1, (int) Math.ceil((double) total / COMMAND_PAGE_SIZE));
if (listings.isEmpty()) {
sendMessage(sender, "\u00A77No active auctions found");
@@ -98,6 +100,10 @@ public class AuctionCommand extends CommandKamkeelBase {
return;
}
if (args.length < 1) {
throw new CommandException("Usage: /auction view <player>");
}
String playername = args[0];
List<PlayerData> dataList = PlayerDataController.Instance.getPlayersData(sender, playername);
@@ -17,6 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.NoppesUtilServer;
import noppes.npcs.config.ConfigMarket;
import noppes.npcs.constants.EnumAuctionPage;
import noppes.npcs.constants.EnumGuiType;
import noppes.npcs.constants.EnumRoleType;
import noppes.npcs.controllers.AuctionController;
@@ -315,13 +316,8 @@ public class AuctionActionPacket extends AbstractPacket {
private void handleOpenPage(ByteBuf in, EntityPlayerMP player) {
int page = in.readInt();
EnumGuiType guiType;
switch (page) {
case 0: guiType = EnumGuiType.PlayerAuction; break;
case 1: guiType = EnumGuiType.PlayerAuctionSell; break;
case 2: guiType = EnumGuiType.PlayerAuctionTrades; break;
default: guiType = EnumGuiType.PlayerAuction; break;
}
EnumAuctionPage auctionPage = EnumAuctionPage.fromOrdinal(page);
EnumGuiType guiType = auctionPage.getGuiType();
NoppesUtilServer.sendOpenGui(player, guiType, npc);
// Send trades data when opening the trades page
@@ -481,6 +477,9 @@ public class AuctionActionPacket extends AbstractPacket {
} else {
// Need only part of stack
stack.splitStack(needed);
if (stack.stackSize <= 0) {
player.inventory.setInventorySlotContents(i, null);
}
needed = 0;
}
}