Skip to main content

Nexal Towers

A survival-friendly tower defense system with 10 tower types. Offensive towers attack enemies, support towers heal and feed you and your team, and utility towers farm, collect items and XP, and warn you about intruders. Each tower has its own upgrades bought with Vault money, uses themed ammo that server owners can switch off per tower, and drops as an item with its ammo, upgrades and stored items when it is broken.

Features​

  1. 10 Tower Types - Arrow, Tesla, Laser, Slow, Regen, Food, Alert, Crop, Collector and XP
  2. Per-Tower Upgrades - Two or three upgrades per tower, bought with Vault money at prices set in config or in game
  3. Toggleable Ammo - Arrows, redstone, glowstone dust, soul sand, golden apples, bread and bone meal; switch ammo off per tower
  4. Owner-Only Towers - Only the owner opens a tower's menu or breaks it (nexaltowers.bypass.break for staff)
  5. State Preservation - Breaking a tower drops it as an item that keeps its ammo, upgrades and stored items
  6. Explosion Protection - TNT, creepers and other explosions leave towers standing; pistons, fire, water and endermen cannot move or remove them either
  7. Collector That Keeps Items Intact - Collected items keep their names, enchantments and contents; shop display items are left alone
  8. Alert Tower - Warns the owner (and optionally their team) in game when an enemy comes near, and posts to a Discord webhook
  9. Team Integration - Factions, Towny and BetterTeams: towers never attack allies, support towers only help them
  10. Safe Targeting - Creative, spectator and vanished players are never targeted
  11. Craftable Towers - Shaped recipes for every tower, toggled and edited in game with a 3x3 editor
  12. Admin Hub - Settings, ranges, upgrade prices, giving towers, recipes and data export in one GUI
  13. Tower Limit - Cap the towers per player
  14. Holograms - Live stats above each tower, text set in messages.yml
  15. Dual JSON/SQL Storage - data.json or MySQL/MariaDB, with export and import to move between them
  16. Chunk-Based Activation - Only towers in loaded chunks run; towers in worlds that load later are kept and placed when the world loads

Technologies​

  • Paper API 1.20.1+ (Spigot compatible) - Minecraft server API
  • Utilizer - Configuration, messages, GUIs, tasks, holograms
  • ACF - Command framework
  • nexal-core - JSON and SQL persistence (MariaDB/MySQL), help menu
  • Vault - Economy for upgrades (optional)
  • Factions, Towny, BetterTeams - Team detection (optional)

Tower Types​

Offensive Towers​

TowerBlockRangeAmmoUpgrades (default price)
ArrowDispenser20ArrowsFire Rate ($1,000), Flaming Arrows ($2,000), Homing Arrows ($3,000)
TeslaLightning Rod20RedstoneChain Lightning ($1,500), Damage Boost ($2,500)
LaserRedstone Lamp25Glowstone DustTarget Count ($2,000), Piercing ($3,000)
SlowSoul Sand15Soul SandEffect Duration ($1,000), Weakness ($2,000)

Support Towers​

TowerBlockRangeAmmoUpgrades (default price)
RegenBeacon15Golden ApplesHeal Boost ($1,500), Cleanse ($2,500)
FoodHay Block15BreadFeed Boost ($1,000), Saturation Boost ($2,000)

Utility Towers​

TowerBlockRangeAmmoUpgrades (default price)
AlertBell25NoneHealth Scanner ($1,500), Gear Scanner ($2,500), Visual Tracker ($3,500)
CropComposter10Bone Meal (off by default)Harvest Speed ($1,000), Auto Bone Meal ($2,000)
CollectorHopper10NonePickup Speed ($1,500), Auto Sort ($3,000)
XPEnchanting Table15NoneXP Multiplier ($2,000), Mending Aura ($4,000)

Arrow and Slow towers can target players, hostile mobs or both (set in their menu). Tesla and Laser towers target players only.

Ranges and prices are the defaults; both can be changed in game or in config.yml.

Commands​

Player Commands​

CommandDescriptionPermission
/towersShow the help menuNone
/towers help [page]Show the help menuNone
/towers listList all tower typesnexaltowers.list
/towers infoInfo about the tower you are looking atnexaltowers.info

Admin Commands​

CommandDescriptionPermission
/towers adminOpen the admin hub (console: list the admin commands)nexaltowers.admin
/towers admin help [page]List the admin commands in chatnexaltowers.admin
/towers admin giveOpen the tower give menunexaltowers.admin
/towers admin give \<player> \<type>Give a tower to a playernexaltowers.admin
/towers admin recipesManage crafting recipesnexaltowers.admin
/towers admin exportExport every tower to export/towers_placed.jsonnexaltowers.admin
/towers admin importImport towers from export/towers_placed.jsonnexaltowers.admin
/towers admin reloadReload config, messages and recipesnexaltowers.admin

Permissions​

PermissionDescriptionDefault
nexaltowers.listList all tower typestrue
nexaltowers.infoView tower informationtrue
nexaltowers.adminAdmin hub and all /towers admin commandsop
nexaltowers.bypass.breakBreak towers owned by other playersop
nexaltowers.bypass.limitPlace more towers than towers.max_per_playerop
nexaltowers.*All permissionsop

Configuration​

config.yml​

storage:
type: json # json or sql
sql:
host: localhost
port: 3306
database: minecraft
username: root
password: ""

towers:
max_per_player: 0 # 0 = unlimited
auto_save_interval: 5 # minutes between saves of ammo use and statistics
damage_owner: false # offensive towers also attack their owner
work_while_owner_offline: true # towers keep working while the owner is offline

ammo: # requires_ammo: false lets a tower work without ammo
arrow:
requires_ammo: true
tesla:
requires_ammo: true
laser:
requires_ammo: true
slow:
requires_ammo: true
regen:
requires_ammo: true
food:
requires_ammo: true
crop:
requires_ammo: false

ranges: # blocks each tower reaches
arrow: 20
tesla: 20
laser: 25
slow: 15
regen: 15
food: 15
alert: 25
crop: 10
collector: 10
xp: 15

upgrades: # upgrade prices, paid with Vault money
arrow:
fire_rate: 1000
flaming_arrows: 2000
homing_arrows: 3000
# ... one section per tower, see the bundled config.yml

economy:
price-format: "$%amount%"
number-format: "#,##0.00"
hide-zero-decimals: true # $1,000 rather than $1,000.00

Purchases, deposits, withdrawals, placing and breaking are saved at once; ammo use and statistics every auto_save_interval minutes and on shutdown.

Settings GUI​

/towers admin → Configuration sets ammo per tower, the tower limit, owner damage, offline owners, the auto-save interval, every tower range (Ranges) and every upgrade price (Upgrade Prices), without editing YAML.

messages.yml​

Every message, the hologram text above each tower (holograms.\<type>) and the list output are customizable with MiniMessage gradients, & codes and &#RRGGBB hex, plus sounds and titles. Messages added in an update are used from the plugin's own copy until you add them to your file, so an older messages.yml keeps working.

recipes.yml​

A shaped recipe per tower plus a master switch. Changes to the file apply without a restart.

Database Schema​

With storage.type: sql the plugin creates one table. With JSON storage the same records live under towers_placed in data.json.

towers_placed​

ColumnTypeKeyDescription
idVARCHAR(36)PKTower UUID
worldVARCHAR(64)World name
x, y, zDOUBLEBlock position
yaw, pitchFLOATStored rotation
ownerVARCHAR(36)Owner UUID
tower_typeVARCHAR(32)Tower type ID (arrow, collector, ...)
placed_timeBIGINTWhen it was first placed (epoch ms)
stateMEDIUMTEXTAmmo, upgrades, statistics and stored items as JSON

Key Legend: PK = Primary Key

Towers from versions up to 1.0.2 (towers.json) are moved into the configured storage on the first start, and the old file is renamed to towers.json.migrated.

Installation​

  1. Download the plugin JAR
  2. Place it in the plugins folder (Vault and an economy plugin are needed for upgrades)
  3. Start or restart the server
  4. Adjust config.yml or use /towers admin → Configuration
  5. Apply file changes with /towers admin reload

To move from JSON to SQL: /towers admin export, set storage.type: sql and the connection, restart, then /towers admin import.

How It Works​

Obtaining and Placing Towers​

  • Craft them (every tower has a recipe), or get them from /towers admin give
  • Place the tower block; it starts working at once
  • A protection plugin that blocks the placement also blocks the tower

Using a Tower​

  • Right-click your tower to open its menu: deposit and withdraw ammo, switch it on or off, set its targets, and open its upgrades
  • Only plain items count as ammo; renamed or custom items of the same material are never taken
  • Withdrawing gives only what fits in your inventory; the rest stays in the tower

Breaking a Tower​

  • Only the owner (or a player with nexaltowers.bypass.break) can break it
  • It drops as an item that keeps its ammo, upgrades and stored items; placing it restores them
  • An open menu on a broken tower closes, so nothing can be taken out twice
  • Explosions leave towers standing
  • Pistons, fire, flowing water or lava and endermen cannot move or remove a tower block
  • If a tower's block disappears some other way (WorldEdit, another plugin), the tower drops as its item within a second