Accessing the API
Code (Java):
import
dev.zonely.whiteeffect.api.ZonelyCoreAPI
;
public
final
class MyAddon
{
private ZonelyCoreAPI api
;
public
void onEnable
(
)
{
api
= ZonelyCoreAPI.
get
(
)
;
// safe once ZonelyCore is enabled
}
}
Checking Module Toggles
Code (Java):
if
(
!api.
areVouchersEnabled
(
)
)
{
getLogger
(
).
warning
(
"Vouchers module disabled, skipping custom voucher logic."
)
;
}
if
(api.
areLastCreditsEnabled
(
)
)
{
getLogger
(
).
info
(
"Last Credits module active — holograms and GUI calls are safe."
)
;
}
Cash API (credits)
getBalance(name|player) returns the current credit total (offline-safe).
addBalance,
withdraw,
setBalance return the updated balance and throw
CreditOperationException on failure (insufficient funds, DB issues, validation errors).
isCached /
invalidateCache let you manage the in-memory cache after manual DB edits.
Async helpers (
addBalanceAsync,
withdrawAsync,
setBalanceAsync) complete on a
CompletableFuture<Long> so you can stay off the main thread.
Code (Java):
import
dev.zonely.whiteeffect.api.cash.CashAPI
;
import
dev.zonely.whiteeffect.api.cash.CreditOperationException
;
import
org.bukkit.Bukkit
;
import
org.bukkit.entity.Player
;
// 'plugin' below should be your JavaPlugin instance
CashAPI cash
= api.
cash
(
)
;
try
{
long updated
= cash.
addBalance
(
"PlayerOne",
500
)
;
long remaining
= cash.
withdraw
(
"PlayerTwo",
250
)
;
cash.
setBalance
(
"PlayerVIP",
10_000
)
;
getLogger
(
).
info
(
"Balances updated: "
+ updated
+
" / "
+ remaining
)
;
}
catch
(CreditOperationException ex
)
{
getLogger
(
).
warning
(
"Credit operation failed: "
+ ex.
getMessage
(
)
)
;
}
cash.
addBalanceAsync
(
"AsyncGuy",
1000
).
thenAccept
(newBalance
->
Bukkit.
getScheduler
(
).
runTask
(plugin,
(
)
->
{
Player player
= Bukkit.
getPlayerExact
(
"AsyncGuy"
)
;
if
(player
!=
null
)
{
player.
sendMessage
(
"Your new balance: "
+ newBalance
)
;
}
}
)
)
;
Voucher API
issueVoucher(issuer, target, amount) deducts credits and returns a
VoucherIssueResult (item + metadata).
parseVoucher(item) inspects items safely,
redeemVoucher(details|item) credits the target.
Throws
CreditOperationException for validation problems (e.g., insufficient funds).
Code (Java):
import
dev.zonely.whiteeffect.api.voucher.VoucherAPI
;
import
dev.zonely.whiteeffect.api.voucher.VoucherIssueResult
;
import
dev.zonely.whiteeffect.api.cash.CreditOperationException
;
// assumes 'player' is available
VoucherAPI vouchers
= api.
vouchers
(
)
;
try
{
VoucherIssueResult voucher
= vouchers.
issueVoucher
(
"Staff",
"PlayerTwo",
250
)
;
player.
getInventory
(
).
addItem
(voucher.
getVoucherItem
(
)
)
;
vouchers.
redeemVoucher
(voucher.
getDetails
(
)
)
;
}
catch
(CreditOperationException ex
)
{
getLogger
(
).
warning
(
"Voucher error: "
+ ex.
getMessage
(
)
)
;
}
Deliveries API
listDeliveries() exposes configured reward entries.
getStatus(player, delivery) describes permission/cooldown;
claim(player, delivery) performs the reward (throws
CreditOperationException on profile load failures).
Code (Java):
import
dev.zonely.whiteeffect.api.cash.CreditOperationException
;
// assumes 'player' is available
api.
deliveries
(
).
listDeliveries
(
).
forEach
(delivery
->
{
api.
deliveries
(
).
getStatus
(player, delivery
).
ifPresent
(status
->
{
if
(status.
canClaimNow
(
)
)
{
try
{
api.
deliveries
(
).
claim
(player, delivery
)
;
}
catch
(CreditOperationException ex
)
{
player.
sendMessage
(
"Delivery failed: "
+ ex.
getMessage
(
)
)
;
}
}
}
)
;
}
)
;
Last Credits API (leaderboard & menu)
getLeaderboard(category) returns cached entries (RECENT, ALL_TIME, YEARLY, MONTHLY, DAILY).
getLastLeaderboardRefresh(category) exposes snapshot freshness.
getRecentTopups() mirrors the PlaceholderAPI cache.
getViewerCategory(player) /
setViewerCategory(player, category) keep holograms & GUI aligned per player.
openMenu(player, category) honors the viewer’s active category (pass
getViewerCategory to stay in sync).
Code (Java):
import
dev.zonely.whiteeffect.menu.lastcredits.LastCreditsMenuManager
;
// assumes 'player' is available
var recent
= api.
lastCredits
(
).
getLeaderboard
(LastCreditsMenuManager.
Category.
RECENT
)
;
recent.
forEach
(entry
->
Bukkit.
getLogger
(
).
info
(entry.
getPosition
(
)
+
". "
+ entry.
getUsername
(
)
+
" -> "
+ entry.
getFormattedAmount
(
)
)
)
;
LastCreditsMenuManager.
Category active
= api.
lastCredits
(
).
getViewerCategory
(player
)
;
api.
lastCredits
(
).
openMenu
(player, active
)
;
Secure Socket API
Controlled via
config.yml (
web-token,
socket-port); module toggle must be enabled.
start(),
stop(),
restart() manage the listener;
isActive() and
getPort() expose runtime state.
Code (Java):
if
(api.
isSocketEnabled
(
)
)
{
if
(
!api.
socket
(
).
isActive
(
)
)
{
if
(
!api.
socket
(
).
start
(
)
)
{
getLogger
(
).
warning
(
"Secure socket could not start. Check config.yml."
)
;
}
}
else
{
api.
socket
(
).
restart
(
)
;
}
}
Auction API
openMainMenu,
openSoldMenu,
openPurchasedMenu,
openPurchaseMenu are safe from async threads (manager switches back to Bukkit).
getMenuManager() exposes the GUI controller;
getDao() grants direct DB access for custom workflows.
Check
api.areAuctionsEnabled() before exposing custom commands.
Code (Java):
import
dev.zonely.whiteeffect.api.auction.AuctionDao
;
// assumes 'player' is available
if
(api.
areAuctionsEnabled
(
)
)
{
api.
auctions
(
).
openMainMenu
(player
)
;
AuctionDao dao
= api.
auctions
(
).
getDao
(
)
;
if
(dao
!=
null
)
{
dao.
listByCreator
(dao.
fetchUserId
(player.
getName
(
)
)
)
.
forEach
(item
-> getLogger
(
).
info
(item.
getCustomTitle
(
)
)
)
;
}
}
else
{
player.
sendMessage
(
"Auctions are disabled on this server."
)
;
}