TownyPorts is a Towny addon that lets players travel between town-owned ports using /t port commands.
It is designed for long-distance worlds where overland travel can be slow, while still keeping travel balanced through:
- economy cost,
- warmup + cooldown,
- nation/enemy restrictions,
- and per-hop distance limits.
TownyPorts adds two Towny command branches:
/t port ...for travel and information,/t set port ...for configuring your town’s port.
A port is data attached to a Town (not a separate block/entity):
- port spawn location,
- port fee.
When a player travels, TownyPorts validates eligibility (town/nation/restrictions), calculates a valid route, charges the player, warms up the teleport, and applies cooldown after successful arrival.
- Paper/Spigot-compatible server (plugin targets Paper API 1.21.x).
- Towny (hard dependency).
- Vault + economy plugin (soft dependency). If Vault economy is present, TownyPorts checks player affordability using Vault before teleport.
- Java 17 build/runtime target.
- Build the plugin JAR:
mvn clean package
- Put the built JAR in your server
plugins/folder. - Start/restart server.
- Ensure Towny is loaded first.
TownyPorts registers subcommands under Towny’s addon API:
/t port/t set port
A port belongs to a Town. The plugin stores metadata directly on the Town:
townyPorts_portLocationtownyPorts_portPrice
If a town has location metadata but no price metadata, the port uses default-port-fee from config.
This means data persists with Towny objects and can be queried globally from all towns.
When a player runs /t port <destinationTown>:
-
Destination validation
- Destination town must exist.
- Destination town must have a configured port.
-
Eligibility checks
- Sender must be a player.
- Player must belong to a town.
- Player’s town must belong to a nation.
- Player cannot start in wilderness unless they have
townyports.bypass.wilderness. - If enemy denial is enabled, player cannot travel to enemy nation ports.
- Player must stand in a valid port chunk (same chunk as that town’s configured port).
-
Vehicle checks
- If mounted, only certain vehicle classes are allowed (horse-like, boats, pigs, striders, etc.).
-
Route planning
- TownyPorts builds a route from origin town port to destination using all known ports.
- Hops are only allowed if the chunk-distance between two port chunks is within
maximum-port-distance-in-chunks. - Route cost is cumulative sum of stop fees.
- If no legal route exists, travel is denied.
-
Cost + affordability
- Total route cost is computed.
- If Vault economy is available, balance check is performed before teleport.
-
Warmup teleport
- Teleport starts with configurable warmup (
port-travel-warmup-in-ticks). - Movement during warmup cancels teleport (configured in teleporter behavior).
- Destination safety checks are enabled.
- Teleport starts with configurable warmup (
-
Arrival and cooldown
- On successful arrival, cooldown is applied (
port-travel-cooldown-in-seconds). - If route had intermediary stops, destination town account redistributes per-stop payouts to intermediary towns.
- On successful arrival, cooldown is applied (
- The pre-teleport transaction charges total route cost.
- Intermediary payouts are attempted after successful arrival.
- Redistribution failures are intentionally non-fatal to avoid cancelling successful player travel.
/t port <town>— travel to a town’s port./t port list [page]— list active ports./t port price <town>— show fee for a town port./t port info [town]— show your town port info or another town./t port here— verify whether your current chunk is a town’s port chunk./t port reload— reload TownyPorts config (permission/op required)./t port help— show clickable help menu.
/t set port spawn— set your town’s port spawn to current location./t set port price <amount>— set your town’s fee./t set port remove— remove your town’s port metadata.
Defined in plugin.yml:
townyports.bypass.wildernesstownyports.set.spawntownyports.reload
Also used in command checks:
townyports.port.listtownyports.port.pricetownyports.set.price
If your permission plugin setup is strict, explicitly grant the command permissions above to your intended staff/player groups.
config.yml keys (reloadable):
-
uses-economy(bool, defaulttrue)- Enables economy-dependent price setting behavior.
-
currency-sign(string, defaultGold)- Display text used in messages.
-
minimum-port-fee(int, default1) -
maximum-port-fee(int, default100)- Bounds for
/t set port price.
- Bounds for
-
default-port-fee(int, default10)- Used when a town has port location but no explicit stored fee.
-
maximum-port-distance-in-chunks(int, default2750)- Maximum allowed distance per hop between ports in routing.
-
enable-port-arrival-alert(bool, defaultfalse)- Config node exists; listener hook is currently a placeholder in main class.
-
port-travel-warmup-in-ticks(long, default200)- Warmup before teleport (200 ticks = 10 seconds).
-
port-travel-cooldown-in-seconds(long, default60)- Cooldown after successful travel.
-
port-travel-denies-for-enemies(bool, defaulttrue)- Blocks travel to enemy nation ports.
After edits, reload with:
/t port reload- Set clear fee policy: Keep min/max realistic for your economy.
- Tune distance cap: Larger map = larger
maximum-port-distance-in-chunks. - Use cooldown to prevent spam: Keep travel meaningful.
- Train staff on
/t port here: Great for diagnosing “why can’t I travel?” cases. - Remember chunk rule: Players must stand in the same chunk as a configured port spawn (unless your policy grants bypass behavior via permissions).
- Player is not in a valid origin port chunk.
- Use
/t port here. - Confirm town has a port:
/t port info.
- Destination town exists but no port metadata is set.
- Town staff should run
/t set port spawn.
- Vault economy is active and player balance is insufficient.
uses-economyis false; price setting is blocked by validation logic.
- Check console for config parsing errors.
- Main plugin bootstrap:
PortsMain - Command handlers:
PortBaseCommand(/t portsubcommands)PortCommand(actual travel)PortSetCommand(/t set port ...)
- Data:
PortrecordPortDAOmetadata read/write
- Utility:
Msgcomponent messaging helpersHelpMenuclickable command helpVehicleRegistrymounted vehicle allowlist
mvn clean package- Towny API for towns/residents/nations + command addon registration.
- earthPolLib for config handler, cooldown manager, teleporter, and helpers.
- Vault API used for affordability checks when provider is present.
This section is for regular players.
If you only care about using ports, read this part.
A port is a town travel point. If your server has TownyPorts, you can fast-travel between towns with ports.
- Stand in a valid port chunk (usually your town’s port area).
- Run:
/t port <townName> - Don’t move during warmup.
- You arrive at that town’s port.
Use this to travel to another town’s port.
Example:
/t port Oakvale
What it does:
- Checks if Oakvale has a port.
- Checks if you are currently standing in a valid port chunk.
- Shows route and total fee.
- Starts a warmup, then teleports you if you do not move.
Use this to check the fee before traveling.
Example:
/t port price Oakvale
What it does:
- Shows the configured price for that town’s port.
- Helps you avoid failed teleports from not having enough money.
Use this to browse all towns that currently have ports.
Examples:
/t port list
/t port list 2
What it does:
- Lists active ports with fee and location info.
- Lets you click town names in chat (on supported clients) to run travel commands quickly.
Use this when travel fails and you are not sure why.
Example:
/t port here
What it does:
- Tells you whether your current chunk is the town’s official port chunk.
- If you are not in the right chunk, it shows where the port spawn is.
Town staff command to set your town’s port location.
Example:
/t set port spawn
What it does:
- Saves your current location as your town port spawn.
- Must be used inside your own town and at a safe location.
Town staff command to set your town’s travel fee.
Example:
/t set port price 25
What it does:
- Sets how much players are charged to use your town’s port as part of a route.
- Amount must be inside the server’s configured min/max range.
Town staff command to disable your town’s port.
Example:
/t set port remove
What it does:
- Removes both the stored spawn and fee for your town’s port.
- Your town will no longer appear as an active destination until reconfigured.
Sometimes the destination is too far for one direct hop.
If the server has maximum-port-distance-in-chunks: 1000, then each jump between ports must be 1000 chunks or less.
Example:
- Your town A to destination D is 2400 chunks apart.
- Direct A → D is blocked (too far for one hop).
- If towns B and C have ports, a valid route might be:
- A → B (900 chunks)
- B → C (800 chunks)
- C → D (700 chunks)
Because each hop is under 1000 chunks, the trip is allowed.
- You pay the total route cost shown before teleport.
- The total is built from the stop fees in that route.
- This is why long-distance travel can cost more than a short direct trip.
- You are not in a port chunk.
- Your town (or you) does not meet nation/travel rules.
- Destination has no port.
- You don’t have enough money.
- You are on cooldown.
- Run
/t port here. - Run
/t port list. - Check fee with
/t port price <town>. - Make sure you can pay.
- Try again after cooldown.
- Set port location where you stand:
/t set port spawn - Set fee:
/t set port price <amount>
That’s it—you don’t need to know the backend details to use it effectively.