Skip to content

Commit

Permalink
Merge tag '0.96.2.0' into siegewar0.96.2.0
Browse files Browse the repository at this point in the history
Release contains:
- Towny 0.96.2.0
- TownyChat 0.71
- TownyNameUpdater 5.0

|Welcome to Towny 0.96.2.0.|
| ---- |
| This marks the second Minor Release post-0.96.0.0. Continuing with our
plan is to put out smaller releases more frequently so that it is easier
for server admins to update.|
| Please remember that when you're updating your config files, the only
changes you *must* make are directly below in the REQUIRED CHANGES
section. All of the rest of the config additions will be added
auto-magically by Towny with their default settings. Important links can
be found at the bottom of this page, along with the actual downloads in
the Assests list. |
| If you're upgrading from 0.96.1.0 there are 2 REQUIRED changes. |

----
<details open>
<summary> ⚠️ REQUIRED Changes</summary>

  - REQUIRED CHANGE: at protection.item_use_ids
    - add ,DIAMOND_AXE,GOLDEN_AXE,IRON_AXE,WOODEN_AXE,STONE_AXE
    - will prevent players from stripping logs in unwanted locations.
  - REQUIRED CONFIG CHANGE: add ,LEAD,SWEET_BERRY_BUSH to the end of the
protection.switch_ids list.
</details>

----
<details open>
<summary> ➕ Added</summary>

  - TownBlocks database refactor:
    - TownBlocks are no longer saved to a TownyWorld.
    - They are now saved to the Town.
    - This allows for much easier saving operations.
    - For flatfile databases: towny\data\townblocks.txt no longer used
(you may delete this after updating.)
    - When townblocks are unclaimed they are now moved to a
towny\data\townsblocks\WORLDNAME\deleted\TOWNNAME\ folder.
      - This allows for easy restoration of townblocks which do get
removed, whatever the cause.
    - This will hopefully end the occurance of disappearing townblocks
and fix the following tickets: TownyAdvanced#3783 TownyAdvanced#3796 TownyAdvanced#3813 TownyAdvanced#3821 TownyAdvanced#3844.
    - This refactor has been tested fairly thoroughly, but it is always
advised to back up your server before updating Towny.
  - New Feature: movement-cancels-spawn-warmup.
    - Will not affect players with the towny.admin node.
    - Removes essentials from the SpawnUtil.
    - Closes TownyAdvanced#3619.
  - Allow for other plugins to modify the TownPreClaim cancellation
message.
    - Closes TownyAdvanced#3814.
  - Add /ta unclaim & /plot unclaim tab completes.
    - Closes TownyAdvanced#3883.
  - Add ignoreCancelled=true to onPlayerTakeLecternBookEvent to prevent
Towny overriding plugins who've already stopped taking a book.
    - Closes TownyAdvanced#3894.
  - Add Placeholders:
    - %townyadvanced_town_ranks% - Displays either Mayor, or the various
town ranks a player has or nothing if they have none.
    - %townyadvanced_nation_ranks% - Displays either King, or the
various nation ranks a player has or nothing if they have none.
    - Closes TownyAdvanced#3695.
  - Added Placeholder: %townyadvanced_player_status%
    - Displays Nomad, Resident, Mayor or King, depending on what
position the player is in.
    - Closes TownyAdvanced#3907.
  - Added: For the nation-requires-proximity feature:
    - Moving homeblocks will now tell the mayor if their town will leave
their nation for moving too far from the homeblock.
    - Moving homeblocks will now tell the king if any of their towns
will leave their nation for moving their homeblock too far away.
    - Merging nations will now be made aware if any of the towns will
leave the prevailing nation when the two nations merge.
  - Add confirmations to town and nation renames if their costs are
higher than 0.
  - Add confirmations to /plot set type when costs are higher than 0.
  - Add confirmation to /town buy bonus command.
  - Add confirmation of cost for /plot claim command when plots are
priced higher than 0.
  - Add cost confirmations to /t new and /n new commands.
  - Added advice message to mayor when they create their town, advising
them about upkeep, depositing money and when the next upkeep will be
taken.
    - Closes TownyAdvanced#3843.
  - Unify code called when explosions are being reverted and
ProtectionRegenTasks are created.
  - Explosion code clean up.
  - Add Essentials to soft-depends.
  - Changed: Whether someone light a Nether Portal, they will now have
to be able to build NETHER_PORTAL blocks rather than OBSIDIAN blocks.
    - This means that servers who want players to be able to make nether
portals to a world where they do not grant towny.wild permissions will
be able to build a portal.
    - The node required to build a portal that would connect into the
wilderness would be towny.wild.build.NETHER_PORTAL.
    - This means servers that do not grant wild permissions do not have
to give towny.wild.build.OBSIDIAN, which would mean players could place
obsidian anywhere in the wild.
  - Changed: towns in the same nation now bypass the
min_distance_from_town_homeblock & min_plot_distance_from_town_plot
config values.
    - Allows for nations to connect seamlessly while still keeping towns
not in the same nation from claiming close to each other.
    - Closes TownyAdvanced#3913.
  - Add UUIDs to resident objects, for the day we need to convert
databases to UUIDs.
  - Add bstats metric to help track UUID gathering.

  - Make /ta reload more specific, courtesy of Siris with PR TownyAdvanced#3851.
    - Command now breaks into 5 subcommands: /ta reload
<database|perms|config|lang|all>
  - Add separate tax limits for towns, nations and townblocks, courtesy
of Siris with PR TownyAdvanced#3860.
    - The old max_tax_amount is removed.
  - Use Paperlib for Async Chunk Loading, courtesy of Siris with PR
    - Servers using Paper will benefit from faster chunk loading when
players are teleported via Towny.
  - Revamped Confirmation system, courtesy of Siris with PR TownyAdvanced#3892.
  - Add confirmation of cost for spawn commands when costs are higher
than 0, courtesy of Siris with PR TownyAdvanced#3861.
    - Closes TownyAdvanced#3828.
  - Cost confirmation added to /plot set outpost, courtesy of Siris with
PR TownyAdvanced#3900.
  - Clickable navigation arrows on /n list and /t list pages, courtesy
of Siris with PR TownyAdvanced#3937.
    - Requires using Spigot or Paper or equivalent.
    - Closes TownyAdvanced#3853.
  - Allow only language unicode, courtesy of Siris with PR TownyAdvanced#3943.
    - Stop players using emojis in their town and nation names.
    - New Configs will have the following regex, which you can add
manually or have Towny add it by itself by removing the regex section of
your config.yml.
    - New Default:
```
    regex:
      name_filter_regex: '[\\\/]'
      name_check_regex: ^[\p{L}a-zA-Z0-9._\[\]-]*$
      string_check_regex: ^[a-zA-Z0-9
\s._\[\]\#\?\!\@\$\%\^\&\*\-\,\*\(\)\{\}]*$
      name_remove_regex: '[^\P{M}a-zA-Z0-9\&._\[\]-]'
```
  - Add javadocs to maven, courtesy of Siris with PR TownyAdvanced#4049.
    - Use mvn clean install to build javadocs.
  - Taxpercent capping, courtesy of Siris with PR TownyAdvanced#3969.
    - Closes TownyAdvanced#3967.
  - Switch to JitPack and Remove GH packages dependencies, courtesy of
Siris with PR TownyAdvanced#4038.

  - Cleanup/Micro-optimization pull request, courtesy of Silverwolfg11
with PR TownyAdvanced#3866.

  - Cleanup and microperformance pull request, courtesy of Articdive
with PR TownyAdvanced#3802.

  - Added: Dynamic Nation Colours, courtesy of Goosius with PR TownyAdvanced#3869.
    - using /n set mapcolor, nations can set their own colour on
dynmap-towny webpages.
    - list of available colours to be used is set in the config.yml at
global_nation_settings.allowed_map_colors

  - Confirmation and invitations are now translatable, courtesy of
v3Monsta with PR TownyAdvanced#3938.
  - Allow TownyMessaging to use more than 54 characters per line,
courtesy of v3Monsta with PR TownyAdvanced#3946.

</details>

----
<details>
<summary>✨ New Commands</summary>

  - /t set taxpercentcap {amount}
    - Mayor command to set the maximum amount that can be taken when
taxpercent is enabled.
  - /n set mapcolor {color}
    - Used by a king to set their colour seen on dynmap-towny webpages.
  - /ta town [town] outlaw [add|remove] [name]
    - Allows admins to add/remove outlaws from a town.
    - Closes TownyAdvanced#3778.
  - /ta depositall [amount]
    - Adds amount to all towns' and all nations' banks.
    - Requires towny.command.townyadmin.depositall, which is a child
node of towny.command.townyadmin.*.
  - /ta nation [nationname] kick [towns...]
    - Allows admins to remove towns from a nation.
    - Closes TownyAdvanced#4050.
  - /ta town [townname] leavenation
    - Allows admins to make a town leave their nation.
</details>

----
<details>
<summary>✨ Changed Commands</summary>

  - /ta reload
    - /ta reload {database|db} - reloads the database.
    - /ta reload {perms|townyperms|permissions} - reloads townyperms.yml
    - /ta reload config - reloads the config & language file.
    - /ta reload lang - reloads the language file.
    - /ta reload all - reloads everything like /ta reload used to do.

</details>

----
<details>
<summary> 📕 New Config Options</summary>

  - max tax amounts
    - economy.daily_taxes.max_plot_tax_amount
      - default: 1000.0
      - Maximum tax amount allowed for townblocks sold to players.
    - economy.daily_taxes.max_town_tax_amount
      - default: 1000.0
      - Maximum tax amount allowed for towns when using flat taxes.
    - economy.daily_taxes.max_nation_tax_amount
      - default: 1000.0
      - Maximum tax amount allowed for nations when using flat taxes.
    - economy.daily_taxes.max_town_tax_percent
      - default: 25
      - Maximum tax percentage allowed when taxing by percentages for
towns.
  - global_town_settings.maximum_number_residents_without_nation
    - default: 0
    - When set above zero this is the largest number of residents a town
can support before they join/create a nation.
    - Do not set this value to an amount less than the
global_town_settings.required_number_residents_join_nation.
    - Do not set this value to an amount less than the
global_town_settings.required_number_residents_create_nation.
    - This will not remove residents from nation-less towns that are
already above the limit, they will not be able to invite more.
    - Closes TownyAdvanced#3720.
  - plugin.day_timer.delete_0_plot_towns
    - Default: false
    - Whether towns with no claimed townblocks should be deleted when
the new day is run.
    - Closes TownyAdvanced#3746.
  - global_town_settings.damage_cancels_spawn_warmup
    - Default: false
    - When set to true, if players are damaged in any way while in a
spawn warmup, their spawning will be cancelled.
    - Closes TownyAdvanced#3916.
  - global_town_settings.movement_cancels_spawn_warmup
    - Default: false
    - When set to true, if players are currently in a spawn warmup,
moving will cancel their spawn.
  - town.min_distances_ignored_for_towns_in_same_nation
    - default: true
    - If true, the below settings: min_plot_distance_from_town_plot and
min_distance_from_town_homeblock will be ignored for towns that are in
the same nation. Setting to false will keep all towns separated the
same.
    - Closes TownyAdvanced#3983.
  - economy.daily_taxes.max_town_tax_percent_amount
    - Default: 10000
    - Controls the highest amount of money that can be taken from a tax
percentage on a resident.
  - global_nation_settings.allowed_map_colors
    - default: aqua:00ffff, azure:f0ffff, beige:f5f5dc, black:000000,
blue:0000ff, brown:a52a2a, cyan:00ffff, darkblue:00008b,
darkcyan:008b8b, darkgrey:a9a9a9, darkgreen:006400, darkkhaki:bdb76b,
darkmagenta:8b008b, darkolivegreen:556b2f, darkorange:ff8c00,
darkorchid:9932cc, darkred:8b0000, darksalmon:e9967a, darkviolet:9400d3,
fuchsia:ff00ff, gold:ffd700, green:008000, indigo:4b0082, khaki:f0e68c,
lightblue:add8e6, lightcyan:e0ffff, lightgreen:90ee90, lightgrey:d3d3d3,
lightpink:ffb6c1, lightyellow:ffffe0, lime:00ff00, magenta:ff00ff,
maroon:800000, navy:000080, olive:808000, orange:ffa500, pink:ffc0cb,
purple:800080, violet:800080, red:ff0000, silver:c0c0c0, white:ffffff,
yellow:ffff00
    - This setting determines the list of allowed nation map colors.
    - The color codes are in hex format.
</details>

----
<details>
<summary> 📕 Changed Config Options</summary>

  - town.default_taxes.taxpercentage
    - Default value changed from false to true.
    - Will no affect existing configs.
    - New config files will have taxpercentage on by default, which
means new towns will start with taxpercent enabled.
  - Removed Config Option: economy.daily_taxes.max_tax_amount
    - Replaced by the above new config options.

</details>

----
<details>
<summary>🔑 Changed Permission Nodes</summary>

  - None.
</details>

----
<details>
<summary>🔑 New Permission Nodes</summary>

  - towny.command.nation.set.mapcolor
    - Child Node of towny.command.nation.set.*
    - Existing installs do not have to grant this node to Kings, they
will already inherit it as long as they have the above node.
  - towny.command.plot.group.*
    - Child Nodes:
    - towny.command.plot.group.add: true
    - towny.command.plot.group.remove: true
    - towny.command.plot.group.rename: true
    - towny.command.plot.group.set: true
    - towny.command.plot.group.toggle: true
    - towny.command.plot.group.forsale: true
    - towny.command.plot.group.notforsale: true
  - towny.admin.spawn
    - Grants admin spawn priviledges, without
cooldowns/warmups/spawncosts.
    - Child Node: towny.command.townyadmin.town.spawn.freecharge
    - Is itself a childnode of towny.admin.
    - Closes: TownyAdvanced#3936.
  - towny.command.town.set.taxpercentcap
    - Child node of towny.command.town.set.*
    - Required to use /town set taxpercentcap [amount]
</details>

----
<details>
<summary>🔑 Removed Permission Nodes</summary>

  - towny.command.townyadmin.town.spawn
  - towny.command.townyadmin.nation.spawn
  - Replaced by the towny.admin.spawn node.

</details>

----
<details>
<summary>💻 API Changes</summary>

  - API: Added to TownyAPI, hasNationZone(Location) and
hasNationZone(WorldCoord) which will return either
TownBlockStatus.UNCLAIMED_ZONE or TownBlockStatus.NATION_ZONE.
  - API: Added to TownyAPI, isNationZone(Location), returns true if it
is in a nation zone.
  - API: Added NationBonusCalculationEvent, courtesy of Silverworldg11
with PR TownyAdvanced#3873.
    - Allows plugins to modify the nation bonus returned by a nation.
    - This is a particularly useful if plugins want to add nation bonus
blocks based on their own specific criteria rather than what is
determined by Towny config.
  - API: new PlotPreChangeTypeEvent, courtesy of rebstew with PR TownyAdvanced#3995.
    - Cancellable event that plugins can use to stop players from
changing a plot type.

</details>

----
<details>
<summary>🔧 Fixed</summary>

  - Fix EventWar bug when winner_takes_ownership_of_townblocks is true.
    - Closes TownyAdvanced#3862.
  - Fix message output when a single town or nation is fallen because of
upkeep costs.
    - Closes TownyAdvanced#3856.
  - Fix SQL saveAllTownBlocks() returning false all of the time,
preventing a server from switching from flatfile to mysql storage.
    - Closes TownyAdvanced#3864.
  - Fix regression in PVP world settings.
    - It is now again possible to have PVP false in a world, but let the
town/townblock override that.
    - Closes TownyAdvanced#3863.
  - Fix /plot set TYPE, always trying to pay into the closed_economy
SERVER_ACCOUNT, even when closed_economy is false.
    - Closes TownyAdvanced#3870.
  - Fix onStructureGrow NPE seen in logs.
  - Fix negative upkeep feature not working any longer.
    - Closes TownyAdvanced#3874.
  - Fix some untranslatable strings in the PlayerCacheUtil.
  - Fix /plot set perm on|off not giving feedback and saving.
  - Fix /plot group commands missing their permission nodes.
  - Remove /town unclaim outpost from /town unclaim ?
  - Fix: nation-requires-proximity feature should be working much better
now.
  - Fix /t buy bonus command not working after cost confirmation added.
  - Fix some costs in confirmations not being formatted by the
TownyEconomyHandler.
  - Properly delete townblocks which belong to towns that no longer
exist.
    - This will clear up ghost-townblocks which appear as NPEs in
ChunkNotifications, as well as make some townblocks un-claimable.
    - Closes TownyAdvanced#3911, TownyAdvanced#3771.
  - Fix mysql DB's towns losing residents on load.
  - Fixed loading townblocks that do not use the config's current
town_block_size.
    - These townblocks will not be loaded into memory, but will remain
in the database in case someone switches their town_block_size without
realizing what it would do.
    - Closes TownyAdvanced#3924.
  - Fixed ChunkNotifications in the action_bar set to last for 3 or less
seconds causing NPEs.
    - Closes TownyAdvanced#3923.
  - Fix mysql DB's nation's losing many of their settings.
  - Fix german lang file.
  - Make sure clickable texts are using the full command and not
shortened versions.
  - Fix nations being able to kick towns from their nation during war.
    - To prevent nations not having to defend all of their towns in war.
  - Fix non-warring Towns from still being able to be considered as
attackers in Event war.
  - Fix flying players being able to count as townblock
attackers/defenders in Event war.
  - Fix resident's Town and Nation ranks being able to double up, which
caused rare issues with TownyNameUpdater.
    - Also catching the ConcurrentModificationException if it does
somehow occur again.
    - Closes TownyAdvanced#3912.
  - Fix movement-cancels-spawning showing cancel message when because
you waited patiently and spawned.
  - Fix out-dated comments in config re: spawning costs.
  - Fix missing command-feedback when using some towny commands in the
console, courtesy of Siris with PR TownyAdvanced#3961.
    - Closes TownyAdvanced#3957.
  - Fix newly-joined players not having their lastOnline value not set.
  - Fix residents.txt causing safemode for having a resident listed more
than once.
    - Also removes doubled up residents from the residents.txt when
saving.
  - Fix min_distance_between_homeblocks likely not working very well.
  - Fix DrawSmokeFactory offset to move smoke puffs up from inside the
blocks.
  - Fix ghost townblocks that are missing a town not being deleted at
startup.
  - Fix MobRemovalTask not appreciating when a world's worldmobs setting
is off.
  - Fix Slimes trampling on crops not abiding a world's
creaturetrampling setting.
    - Also cleans up croptrampling code from out of the
TownyPlayerListener & lets us drop the TownyWorld from the
onPlayerSwitchEvent.
  - Fix Ravagers breaking leaves/crops and what not when world's
creaturetrampling setting is off.
    - Closes TownyAdvanced#3975.
  - Fix underscores showing in title messages when entering and leaving
towns, as well as in PAPI placeholders.
    - Close TownyAdvanced#3985.
  - Fix /ta town NAME toggle not being friendly towards many /t toggle
subcommands.
    - Additionally commands should display proper feedback.
  - Fix regression in DisablePlayerTrampling which prevented crop
trampling being prevented.
  - Fix case in TownyPlayerListener that could result in an NPE.
    - Closes TownyAdvanced#4002.
  - Fix cost confirmation showing when new town or new nation prices are
set to 0.
  - Fix plot groups not showing the correct pvp setting when /plot group
set perm command is used.
    - Closes TownyAdvanced#4000.
  - Fix getTownBlockStatus that affect Citizens2 NPCs from displaying
"Failed to fetch resident: name" in the log.
  - Fix bad PlotBlockData preventing a town from being deleted.
  - Fix Leash_Hitches entities being unprotected from
right-click-removals.
    - Allowed outsiders to steal animals.
    - Closes TownyAdvanced#4028.
  - Fix Towny loading bad townyperms.yml files.
    - Towny will now enter safe mode if the townyperms.yml file will not
load correctly.
    - This step is being taken because under certain circumstances it
would cause Towny to harm it's own database when loading.
  - Fix Towny not refreshing the permissions of online players when /ta
reload perms is used.
  - Fix /res set perm command not applying the new /res perm line to all
unchanged resident-owned townblocks.
  - Fix board messages being able to set to strings longer than
TownyFormatter can display.
    - Closes TownyAdvanced#4039.
  - Fix /towny top land resident throwing an internal error.
    - Closes TownyAdvanced#4045.
  - Fix PlayerCacheUtil looking for a non-existant language string.
  - Fix Townblocks having their mob setting overridden by the Towns' mob
setting in scenarios where the town has mobs on, but the townblock has
mobs off.
    - Closes TownyAdvanced#4067.
  - Fix mayors and kings not paying the bail costs specified in the
config.
  - Fix friendly fire not being respected during wars.
  - Fix players being pulled around by fishing hooks in non-PVP plots.
    - Closes TownyAdvanced#4092.
  - Fix sentinalpvp bots causing NotRegisteredExceptions.
  - Fix friend and outlaw lists being able to be fed invalid resident
names.
    - Closes TownyAdvanced#4097.
  - Fix unhelpful getHomeBlock exception message.

  - Fix for Nation&TownSpawnEvents causing titles/chunknotifications
early, courtesy of Siris with PR TownyAdvanced#3872.
  - Fix for non-empty saving queues not finishing on shutdown, courtesy
of Siris with PR TownyAdvanced#3877.
    - Credit to Silverwolfg11 for finding above issue.
  - Fix overlapping confirmations properly cancelling previous ones,
courtesy of Siris with PR TownyAdvanced#3902.

  - Fix mysql DB's nation's not loading their registered date or
metadata, spotted by Silverwolfg11.
  - Fix for /plot set reset, courtesy of Silverwolfg11 with PR TownyAdvanced#4026.

  - Fix issue where a badly configured townyperms.yml causes DB failure,
courtesy of Goosius1 with PR TownyAdvanced#4003.

  - Fix "Modes set: " appearing when there are no modes to set, courtesy
of v3Monsta with PR TownyAdvanced#3941.
    - Closes TownyAdvanced#3857.

</details>

----
<details>
<summary>🌏 Language Updates</summary>

  - Language files bumped to 0.83.
  - polish.yml added courtesy of Martinez.

  - pt-br.yml updated to 0.77 courtesy of bane with PR TownyAdvanced#3865.
  - pt-br.yml updated to 0.83, courtesy of vsdepontes with PR TownyAdvanced#4029.
  - French.yml updated to 0.82, courtesy of Yldales with PR TownyAdvanced#3958.
  - russian.yml updated to 0.83 courtesy of Egor33345.
  - zh-tw.yml updated by shou692199 with PR TownyAdvanced#3999.

</details>

----
<details font-size:20>
<summary>💬 TownyChat Changes</summary>

  - Fix missing spaces from {title} & {surname} & {townypostfix}.
  - Allow for $ and \ to be used in the chat line.
    - Closes: TownyAdvanced#3960
  - People spying on chat will now see the chat formatted differently
from normal.
    - De-clutters the chat.
    - Closes: TownyAdvanced#2665
  - Bugfixes on the AsyncChatHookEvents, courtesy of Rebstew with PR
TownyAdvanced/TownyChat#26
  - Fix ConcurrentModificationException caused by spies.
    - Closes TownyAdvanced#4077
</details>

sponsor](https://github.com/sponsors/LlmDl)

| Important Links |
|:----:|
|<a title="Towny Changelog"
href="https://raw.githubusercontent.com/TownyAdvanced/Towny/master/resources/ChangeLog.txt"
target="_blank" rel="noopener">Click Here for a full changelog</a> |
|<a title="Install Guide"
href="https://github.com/TownyAdvanced/Towny/wiki/Installation">Towny
Install Guide</a>|
| <a title="Updating Towny"
href="https://github.com/TownyAdvanced/Towny/wiki/Updating-Towny">How to
Update an Existing Towny</a> |
| <a title="Permission Nodes"
href="https://github.com/TownyAdvanced/Towny/wiki/Towny-Permission-Nodes">Towny
Permission Nodes</a> |
| <a title="How Towny Works"
href="https://github.com/TownyAdvanced/Towny/wiki/How-Towny-Works">How
Towny Works</a> |
  • Loading branch information
Goosius1 committed Jun 29, 2020
2 parents 7fa396e + e9eef52 commit ae45614
Show file tree
Hide file tree
Showing 30 changed files with 379 additions and 154 deletions.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ It is the second-oldest land protection plugin to become popular for Minecraft,
___

### Current Recommended Versions
* [Latest Release](https://github.com/TownyAdvanced/Towny/releases/latest/) supports MC 1.14.* & 1.15.*.
* [Latest Pre-Release](https://github.com/TownyAdvanced/Towny/releases) <img src="https://img.shields.io/github/tag/townyadvanced/towny.svg?sort=semver&label="> supports MC 1.14.* & 1.15.*.
* [Latest Release](https://github.com/TownyAdvanced/Towny/releases/latest/) supports MC 1.14.* & 1.15.* & 1.16.*.
* [Latest Pre-Release](https://github.com/TownyAdvanced/Towny/releases) <img src="https://img.shields.io/github/tag/townyadvanced/towny.svg?sort=semver&label="> supports MC 1.14.* & 1.15.* & 1.16.*.

| Minecraft Version | Towny Version |
|:----:|:----:|
| MC 1.16.* | Use [0.96.1.0](https://github.com/TownyAdvanced/Towny/releases/tag/0.96.1.0) or the above Latest Pre-Release. |
| MC 1.15.* | Use [0.96.1.0](https://github.com/TownyAdvanced/Towny/releases/tag/0.96.1.0) or the above Latest Pre-Release. |
| MC 1.14.* | [0.96.1.0](https://github.com/TownyAdvanced/Towny/releases/tag/0.96.1.0) |
| MC 1.14.* | Use [0.96.1.0](https://github.com/TownyAdvanced/Towny/releases/tag/0.96.1.0) or the above Latest Pre-Release. |
| MC 1.13.2 | [0.96.1.0 for 1.13.2](https://github.com/TownyAdvanced/Towny/releases/tag/0.96.1.0for1.13.2) |
| MC 1.12.2 | [0.93.1.0 for 1.12.2](https://www.dropbox.com/s/v2e1uy6wip7rl3u/Towny_Advanced%200.93.1.0%20for%20MC%201.12.2.zip?dl=0) |
| MC 1.11.2 | [0.93.1.0 for 1.11.2](https://www.dropbox.com/s/cfpm4iy0sbzmti4/Towny_Advanced%200.93.1.0%20for%20MC%201.11.2.zip?dl=0) |
Expand Down Expand Up @@ -58,6 +59,12 @@ Here on github's [Issue Tracker](https://github.com/TownyAdvanced/Towny/issues)
If you still need help, join us in our [IRC channel #towny](http://webchat.esper.net/?channels=towny) on the Esper.net network, or on the [Discord server]( https://discord.gg/gnpVs5m ), where you can find cutting edge updates and discussion on the development of the plugin.

If you want to support the developer consider [becoming a Sponsor](https://github.com/sponsors/LlmDl).

___

### Video Tutorials
Courtesy of Major_Graft, we have a new series of Tutorial Videos [available on the Towny website.](https://townyadvanced.github.io/tutorials.html)

___

### Contributing
Expand All @@ -66,23 +73,29 @@ If you'd like to contribute to the Towny code, see the [Contributing.md](https:/
___

### Licensing

Towny is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0) License ](http://creativecommons.org/licenses/by-nc-nd/3.0/)

We don't object to you making your own forks and builds but we do object to people being selfish, which is why we specify No Derivative Works.
If you want to modify the code to add some nice feature the least you can do is ask and submit a pull request to allow everyone to benefit from it.

___

### Building
### Importing Towny for API use
[![](https://jitpack.io/v/TownyAdvanced/Towny.svg)](https://jitpack.io/#TownyAdvanced/Towny)

Developers who wish to use the Towny API in their plugins may read [the following instructions on adding Towny via a maven pom.xml.](https://github.com/TownyAdvanced/Towny/wiki/TownyAPI#getting-started-with-towny-and-your-ide)

___

### Building Towny
If you would like to build from a specific branch yourself, you can do so with either [Apache Ant](https://ant.apache.org/) or [Apache Maven](http://maven.apache.org/), depending on the age of the branch.

For building, open your terminal / command prompt and navigate to the Towny Directory (either extracted, or cloned).

- **Maven**

- Run `mvn clean package` to generate the plugin in the `target` directory, within the Towny folder.
- Developers who wish to use the Towny API in their plugins may read [the following instructions on adding Towny via a maven pom.xml.](https://github.com/TownyAdvanced/Towny/wiki/TownyAPI#getting-started-with-towny-and-your-ide)


- **Ant** (_Deprecated_)

Expand Down
12 changes: 10 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<packaging>jar</packaging>
<version>0.96.1.11</version>
<version>0.96.2.0</version>

<licenses>
<license>
Expand Down Expand Up @@ -80,7 +80,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -157,6 +157,14 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<phase>clean</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${java.version}</source>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions pom_deb.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<groupId>com.palmergames.bukkit.towny</groupId>
<artifactId>Towny</artifactId>
<packaging>jar</packaging>
<version>0.96.1.11</version>
<version>0.96.2.0</version>

<licenses>
<license>
Expand Down Expand Up @@ -85,7 +85,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
32 changes: 31 additions & 1 deletion resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4621,4 +4621,34 @@ v0.92.0.11:
- Closes #4039.
- REQUIRED CONFIG CHANGE: add ,SWEET_BERRY_BUSH to the end of the protection.switch_ids list.
- Closes #4032.
- Switch to JitPack and Remove GH packages dependencies, courtesy of Siris with PR #4038.
- Switch to JitPack and Remove GH packages dependencies, courtesy of Siris with PR #4038.
0.96.1.12:
- Fix /towny top land resident throwing an internal error.
- Closes #4045.
- Add javadocs to maven, courtesy of Siris with PR #4049.
- Use mvn clean install to build javadocs.
- New Command: /ta nation [nationname] kick [towns...]
- Allows admins to remove towns from a nation.
- Closes #4050.
- New Command: /ta town [townname] leavenation
- Allows admins to make a town leave their nation.
- API: Added to TownyAPI, hasNationZone(Location) and hasNationZone(WorldCoord) which will return either TownBlockStatus.UNCLAIMED_ZONE or TownBlockStatus.NATION_ZONE.
- API: Added to TownyAPI, isNationZone(Location), returns true if it is in a nation zone.
- Fix PlayerCacheUtil looking for a non-existant language string.
- Fix Townblocks having their mob setting overridden by the Towns' mob setting in scenarios where the town has mobs on, but the townblock has mobs off.
- Closes #4067.
- Fix mayors and kings not paying the bail costs specified in the config.
0.96.1.13:
- Fix friendly fire not being respected during wars.
- Fix players being pulled around by fishing hooks in non-PVP plots.
- Closes #4092.
- Fix sentinalpvp bots causing NotRegisteredExceptions.
- Fix friend and outlaw lists being able to be fed invalid resident names.
- Closes #4097.
- Fix unhelpful getHomeBlock exception message.
- Add UUIDs to resident objects, for the day we need to convert databases to UUIDs.
- Add bstats metric to help track UUID gathering.
0.96.1.14:
- Fix loading mysql databases with residents who have had a UUID gathered.
0.96.2.0:
- Bump version for release.
2 changes: 2 additions & 0 deletions src/com/palmergames/bukkit/towny/Towny.java
Original file line number Diff line number Diff line change
Expand Up @@ -854,5 +854,7 @@ else if (Bukkit.getServer().getName().equalsIgnoreCase("craftbukkit")) {
metrics.addCustomChart(new Metrics.SimplePie("database_type", () -> TownySettings.getSaveDatabase().toLowerCase()));

metrics.addCustomChart(new Metrics.SimplePie("town_block_size", () -> String.valueOf(TownySettings.getTownBlockSize())));

metrics.addCustomChart(new Metrics.SimplePie("resident_uuids_stored", () -> TownySettings.getUUIDPercent()));
}
}
95 changes: 94 additions & 1 deletion src/com/palmergames/bukkit/towny/TownyAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
import com.palmergames.bukkit.towny.exceptions.KeyAlreadyRegisteredException;
import com.palmergames.bukkit.towny.exceptions.NotRegisteredException;
import com.palmergames.bukkit.towny.exceptions.TownyException;
import com.palmergames.bukkit.towny.object.*;
import com.palmergames.bukkit.towny.object.Coord;
import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.ResidentList;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.WorldCoord;
import com.palmergames.bukkit.towny.object.PlayerCache.TownBlockStatus;
import com.palmergames.bukkit.towny.object.metadata.CustomDataField;
import com.palmergames.bukkit.towny.permissions.TownyPermissionSource;
import com.palmergames.bukkit.towny.tasks.TeleportWarmupTimerTask;
Expand Down Expand Up @@ -406,6 +413,92 @@ public void abortTeleportRequest(Resident resident) {
public void registerCustomDataField(CustomDataField field) throws KeyAlreadyRegisteredException {
townyUniverse.addCustomCustomDataField(field);
}

/**
* Method to figure out if a location is in a NationZone.
*
* @param location - Location to test.
* @return true if the location is in a NationZone.
*/
public boolean isNationZone(Location location) {
if (!isWilderness(location))
return false;
TownBlockStatus status = hasNationZone(location);
if (status.equals(TownBlockStatus.NATION_ZONE))
return true;

return false;
}
/**
* Method to figure out if a location in the wilderness is normal wilderness of nation zone.
* Recommended to use {@link TownyAPI#isWilderness(Location)} prior to using this, to confirm the location is not in a town.
*
* @param location - Location to test whether it is a nation zone or normal wilderness.
* @return returns either UNCLAIMED_ZONE or NATION_ZONE
*/
public TownBlockStatus hasNationZone(Location location) {

return hasNationZone(WorldCoord.parseWorldCoord(location));
}

/**
* Method to figure out if a worldcoord in the wilderness is normal wilderness of nation zone.
* Recommended to use {@link TownyAPI#isWilderness(WorldCoord)} prior to using this, to confirm the location is not in a town.
*
* @param worldCoord - WorldCoord to test whether it is a nation zone or normal wilderness.
* @return returns either UNCLAIMED_ZONE or NATION_ZONE
*/
public TownBlockStatus hasNationZone(WorldCoord worldCoord) {

Town nearestTown = null;
int distance;
try {
nearestTown = worldCoord.getTownyWorld().getClosestTownFromCoord(worldCoord.getCoord(), nearestTown);
if (nearestTown == null) {
return TownBlockStatus.UNCLAIMED_ZONE;
}

//If nearest town has an in-progress siege, and war disables config is true, nationzone is disabled.
if(TownySettings.getWarSiegeEnabled()
&& TownySettings.getNationZonesWarDisables()
&& nearestTown.hasSiege()
&& nearestTown.getSiege().getStatus().isActive()) {
return TownBlockStatus.UNCLAIMED_ZONE;
}

if (!nearestTown.hasNation()) {
return TownBlockStatus.UNCLAIMED_ZONE;
}
distance = worldCoord.getTownyWorld().getMinDistanceFromOtherTownsPlots(worldCoord.getCoord());
} catch (NotRegisteredException e1) {
// There will almost always be a town in any world where towny is enabled.
// If there isn't then we fall back on normal unclaimed zone status.
return TownBlockStatus.UNCLAIMED_ZONE;
}

// It is possible to only have nation zones surrounding nation capitals. If this is true, we treat this like a normal wilderness.
if (!nearestTown.isCapital() && TownySettings.getNationZonesCapitalsOnly()) {
return TownBlockStatus.UNCLAIMED_ZONE;
}

try {
int nationZoneRadius;
if (nearestTown.isCapital()) {
nationZoneRadius =
Integer.parseInt(TownySettings.getNationLevel(nearestTown.getNation()).get(TownySettings.NationLevel.NATIONZONES_SIZE).toString())
+ TownySettings.getNationZonesCapitalBonusSize();
} else {
nationZoneRadius = Integer.parseInt(TownySettings.getNationLevel(nearestTown.getNation()).get(TownySettings.NationLevel.NATIONZONES_SIZE).toString());
}

if (distance <= nationZoneRadius) {
return TownBlockStatus.NATION_ZONE;
}
} catch (NumberFormatException | NotRegisteredException ignored) {
}

return TownBlockStatus.UNCLAIMED_ZONE;
}

public static TownyAPI getInstance() {
if (instance == null) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/palmergames/bukkit/towny/TownyFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static List<String> getStatus(TownBlock townBlock) {
out.add(TownySettings.getLangString("status_pvp") + ((!preventPVP) ? TownySettings.getLangString("status_on"): TownySettings.getLangString("status_off")) +
TownySettings.getLangString("explosions") + ((world.isForceExpl() || townBlock.getPermissions().explosion) ? TownySettings.getLangString("status_on"): TownySettings.getLangString("status_off")) +
TownySettings.getLangString("firespread") + ((town.isFire() || world.isForceFire() || townBlock.getPermissions().fire) ? TownySettings.getLangString("status_on"):TownySettings.getLangString("status_off")) +
TownySettings.getLangString("mobspawns") + ((town.hasMobs() || world.isForceTownMobs() || townBlock.getPermissions().mobs) ? TownySettings.getLangString("status_on"): TownySettings.getLangString("status_off")));
TownySettings.getLangString("mobspawns") + ((world.isForceTownMobs() || townBlock.getPermissions().mobs) ? TownySettings.getLangString("status_on"): TownySettings.getLangString("status_off")));

if (townBlock.hasPlotObjectGroup())
out.add(String.format(TownySettings.getLangString("status_plot_group_name_and_size"), townBlock.getPlotObjectGroup().getName(), townBlock.getPlotObjectGroup().getTownBlocks().size()));
Expand Down
25 changes: 25 additions & 0 deletions src/com/palmergames/bukkit/towny/TownySettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public enum NationLevel {

// private static Pattern namePattern = null;
private static CommentedConfiguration config, newConfig, language, newLanguage, playermap;
private static int uuidCount;

private static final SortedMap<Integer, Map<TownySettings.TownLevel, Object>> configTownLevel = Collections.synchronizedSortedMap(new TreeMap<Integer, Map<TownySettings.TownLevel, Object>>(Collections.reverseOrder()));
private static final SortedMap<Integer, Map<TownySettings.NationLevel, Object>> configNationLevel = Collections.synchronizedSortedMap(new TreeMap<Integer, Map<TownySettings.NationLevel, Object>>(Collections.reverseOrder()));
Expand Down Expand Up @@ -2972,6 +2973,30 @@ public static Map<String,String> getNationColorsMap() {
return nationColorsMap;
}

public static String getUUIDPercent() {
double fraction = uuidCount / TownyUniverse.getInstance().getDataSource().getResidents().size();

if (fraction == 1.00)
return "100%";
if (fraction > 0.89)
return "90%+";
if (fraction > 0.79)
return "80%+";
if (fraction > 0.69)
return "70%+";
if (fraction > 0.59)
return "60%+";
if (fraction > 0.49)
return "50%+";

return "<50%";
}

public static void setUUIDCount(int hasUUID) {
uuidCount = hasUUID;

}

public static boolean isTownBankruptcyEnabled() {
return getBoolean(ConfigNodes.TOWN_BANKRUPTCY_ENABLED);
}
Expand Down
2 changes: 1 addition & 1 deletion src/com/palmergames/bukkit/towny/TownyUniverse.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public Map<String, CustomDataField> getRegisteredMetadata() {
*
* @param worldCoord we are testing for a townblock.
* @return townblock if it exists, otherwise null.
* @throws NotRegisteredException
* @throws NotRegisteredException if there is no homeblock to get.
*/
public TownBlock getTownBlock(WorldCoord worldCoord) throws NotRegisteredException {
if (hasTownBlock(worldCoord))
Expand Down
10 changes: 5 additions & 5 deletions src/com/palmergames/bukkit/towny/command/NationCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1771,10 +1771,10 @@ public void nationKick(Player player, String[] names) {
return;
}

nationKick(player, resident, nation, townyUniverse.getDataSource().getTowns(names));
nationKick(player, nation, townyUniverse.getDataSource().getTowns(names));
}

public void nationKick(Player player, Resident resident, Nation nation, List<Town> kicking) {
public static void nationKick(CommandSender sender, Nation nation, List<Town> kicking) {
TownyUniverse townyUniverse = TownyUniverse.getInstance();

ArrayList<Town> remove = new ArrayList<>();
Expand Down Expand Up @@ -1816,17 +1816,17 @@ public void nationKick(Player player, Resident resident, Nation nation, List<Tow
for (Town town : kicking) {
msg.append(town.getName()).append(", ");

TownyMessaging.sendPrefixedTownMessage(town, String.format(TownySettings.getLangString("msg_nation_kicked_by"), player.getName()));
TownyMessaging.sendPrefixedTownMessage(town, String.format(TownySettings.getLangString("msg_nation_kicked_by"), sender.getName()));
}

msg = new StringBuilder(msg.substring(0, msg.length() - 2));
msg = new StringBuilder(String.format(TownySettings.getLangString("msg_nation_kicked"), player.getName(), msg.toString()));
msg = new StringBuilder(String.format(TownySettings.getLangString("msg_nation_kicked"), sender.getName(), msg.toString()));
TownyMessaging.sendPrefixedNationMessage(nation, msg.toString());
townyUniverse.getDataSource().saveNation(nation);

plugin.resetCache();
} else
TownyMessaging.sendErrorMsg(player, TownySettings.getLangString("msg_invalid_name"));
TownyMessaging.sendErrorMsg(sender, TownySettings.getLangString("msg_invalid_name"));
}

private void nationAlly(Player player, String[] split) throws TownyException {
Expand Down
Loading

0 comments on commit ae45614

Please sign in to comment.