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

@@ -0,0 +1,34 @@
package noppes.npcs.constants;
import noppes.npcs.config.ConfigMarket;
/**
* Enum for auction log action types.
* Used by AuctionController.logAuction() for type-safe logging.
*/
public enum EnumAuctionLogAction {
CREATED,
BID,
BUYOUT,
SOLD,
EXPIRED,
CANCELLED,
CLAIMED,
CLAIM_EXPIRED;
/** Check if this action should be logged based on config settings */
public boolean shouldLog() {
if (!ConfigMarket.AuctionLoggingEnabled) return false;
switch (this) {
case CREATED: return ConfigMarket.LogAuctionCreated;
case BID: return ConfigMarket.LogAuctionBid;
case BUYOUT: return ConfigMarket.LogAuctionBuyout;
case SOLD: return ConfigMarket.LogAuctionSold;
case EXPIRED: return ConfigMarket.LogAuctionExpired;
case CANCELLED: return ConfigMarket.LogAuctionCancelled;
case CLAIMED:
case CLAIM_EXPIRED: return ConfigMarket.LogAuctionClaimed;
default: return false;
}
}
}
@@ -0,0 +1,30 @@
package noppes.npcs.constants;
import noppes.npcs.constants.EnumGuiType;
/**
* Enum for auction GUI page navigation.
* Maps page indices to GUI types for packet-based navigation.
*/
public enum EnumAuctionPage {
LISTINGS(EnumGuiType.PlayerAuction),
SELL(EnumGuiType.PlayerAuctionSell),
TRADES(EnumGuiType.PlayerAuctionTrades);
private final EnumGuiType guiType;
EnumAuctionPage(EnumGuiType guiType) {
this.guiType = guiType;
}
public EnumGuiType getGuiType() {
return guiType;
}
public static EnumAuctionPage fromOrdinal(int ordinal) {
if (ordinal >= 0 && ordinal < values().length) {
return values()[ordinal];
}
return LISTINGS;
}
}
@@ -137,7 +137,14 @@ public enum EnumScriptType {
ENERGY_BARRIER_SPAWNED("energyBarrierSpawned"),
ENERGY_BARRIER_TICK("energyBarrierTick"),
ENERGY_BARRIER_HIT("energyBarrierHit"),
ENERGY_BARRIER_DESTROYED("energyBarrierDestroyed");
ENERGY_BARRIER_DESTROYED("energyBarrierDestroyed"),
// Auction Events
AUCTION_CREATE("auctionCreate"),
AUCTION_BID("auctionBid"),
AUCTION_BUYOUT("auctionBuyout"),
AUCTION_CANCEL("auctionCancel"),
AUCTION_CLAIM("auctionClaim");
public String function;
@@ -0,0 +1,35 @@
package noppes.npcs.constants;
/**
* Enum for trade slot types in the player's auction trades view.
* Used by ContainerAuctionTrades to identify what each slot contains.
*/
public enum EnumTradeSlotType {
EMPTY,
SELLING,
BIDDING,
CLAIM;
public boolean isSelling() {
return this == SELLING;
}
public boolean isBidding() {
return this == BIDDING;
}
public boolean isClaim() {
return this == CLAIM;
}
public boolean isEmpty() {
return this == EMPTY;
}
public static EnumTradeSlotType fromOrdinal(int ordinal) {
if (ordinal >= 0 && ordinal < values().length) {
return values()[ordinal];
}
return EMPTY;
}
}
@@ -2,9 +2,11 @@ package noppes.npcs.constants;
import noppes.npcs.api.event.IAbilityEvent;
import noppes.npcs.api.event.IAnimationEvent;
import noppes.npcs.api.event.IAuctionEvent;
import noppes.npcs.api.event.IBlockEvent;
import noppes.npcs.api.event.ICustomGuiEvent;
import noppes.npcs.api.event.IDialogEvent;
import noppes.npcs.api.event.IEnergyBarrierEvent;
import noppes.npcs.api.event.IEnergyProjectileEvent;
import noppes.npcs.api.event.IFactionEvent;
import noppes.npcs.api.event.IForgeEvent;
@@ -57,6 +59,7 @@ public class ScriptContext {
INpcEvent.class,
IProjectileEvent.class,
IEnergyProjectileEvent.class,
IEnergyBarrierEvent.class,
IAbilityEvent.class,
IAnimationEvent.class
);
@@ -70,7 +73,9 @@ public class ScriptContext {
IFactionEvent.class,
ICustomGuiEvent.class,
IEnergyProjectileEvent.class,
IPlayerAbilityEvent.class
IEnergyBarrierEvent.class,
IPlayerAbilityEvent.class,
IAuctionEvent.class
);
public static final ScriptContext BLOCK = register("BLOCK", "block",