Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 100.0.11 #1

Merged
merged 27 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a0cf061
Bump net.tnemc:Reserve from 0.1.5.0 to 0.1.5.4
dependabot[bot] Nov 27, 2023
7aa7196
Bump org.apache.logging.log4j:log4j-core from 2.21.1 to 2.22.0
dependabot[bot] Nov 27, 2023
ff2e0a7
Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.6.2 to 3.6.3
dependabot[bot] Dec 4, 2023
2346cca
Bump com.github.seeseemelk:MockBukkit-v1.20 from 3.47.0 to 3.56.0
dependabot[bot] Dec 4, 2023
b7a050d
- Add 2 utility methods to BlockLocation object.
LlmDl Dec 5, 2023
d922cf2
New Crowdin updates (#7105)
LlmDl Dec 5, 2023
f5dc9c4
Merge pull request #7109 from TownyAdvanced/dependabot/maven/org.apac…
LlmDl Dec 5, 2023
a54a244
Merge pull request #7111 from TownyAdvanced/dependabot/maven/org.apac…
LlmDl Dec 5, 2023
f916953
Merge pull request #7112 from TownyAdvanced/dependabot/maven/com.gith…
LlmDl Dec 5, 2023
d031b7e
Merge pull request #7108 from TownyAdvanced/dependabot/maven/net.tnem…
LlmDl Dec 5, 2023
8b39ca3
- Bump org.apache.logging.log4j:log4j-core from 2.21.1 to 2.22.0.
LlmDl Dec 5, 2023
d337060
- New PAPIPlaceholder: %townyadvanced_daily_resident_tax%
LlmDl Dec 6, 2023
a813d13
- New PAPIPlaceholder: %townyadvanced_daily_resident_tax_unformatted%
LlmDl Dec 6, 2023
27a852c
- Make the ASCII map legend use the symbols that are set in the
LlmDl Dec 11, 2023
39c0fb6
- Add automatic protection for the bottoms of glowberry plants being
LlmDl Dec 12, 2023
9fe7e79
New Crowdin updates (#7113)
LlmDl Dec 12, 2023
7d2d4b2
Prevent players without plot perms lighting campfires with flame arro…
LlmDl Dec 12, 2023
ab5f359
- Prevent players without plot perms lighting campfires with flame
LlmDl Dec 12, 2023
70e20bc
Add TODO with towny-server account's future UUID.
LlmDl Dec 15, 2023
f9d8c42
- Reset bolding/italics/etc and not just colours in formatted names
LlmDl Dec 17, 2023
1a4fa7b
- API: add getTownyObjectUUID utility method to TownyEconomyHandler.
LlmDl Dec 17, 2023
9993975
- Fix plot set outpost throwing an error on servers where
LlmDl Dec 19, 2023
51b893c
Enhance Nation Requires Proximity Feature (#7116)
LlmDl Dec 19, 2023
ddec1de
New Crowdin updates (#7121)
LlmDl Dec 19, 2023
c79ec6d
- Enhanced Nation Proximity Feature.
LlmDl Dec 19, 2023
eb6b081
Fix config migrator file formatting (#7128)
Warriorrrr Dec 20, 2023
7b680dc
- Fix config migrator file formatting, courtesy of Warrior with
LlmDl Dec 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Towny/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<artifactId>towny</artifactId>
<packaging>jar</packaging>
<version>0.100.0.8</version>
<version>0.100.0.11</version>

<licenses>
<license>
Expand Down Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>net.tnemc</groupId>
<artifactId>Reserve</artifactId>
<version>0.1.5.0</version>
<version>0.1.5.4</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -139,7 +139,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.21.1</version>
<version>2.22.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -256,7 +256,7 @@
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.20</artifactId>
<version>3.47.0</version>
<version>3.56.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -290,7 +290,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.2</version>
<version>3.6.3</version>
<executions>
<execution>
<id>install</id>
Expand Down
42 changes: 33 additions & 9 deletions Towny/src/main/java/com/palmergames/bukkit/config/ConfigNodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -950,14 +950,6 @@ public enum ConfigNodes {
"",
"# If set to true, if a nation is disbanded due to a lack of residents, the capital will be refunded the cost of nation creation."
),
GTOWN_SETTINGS_NATION_REQUIRES_PROXIMITY(
"global_town_settings.nation_requires_proximity",
"0.0",
"",
"# The maximum number of townblocks a town can be away from a nation capital,",
"# Automatically precludes towns from one world joining a nation in another world.",
"# If the number is 0, towns will not a proximity to a nation."
),
GTOWN_FARM_ANIMALS(
"global_town_settings.farm_animals",
"PIG,COW,CHICKEN,SHEEP,MOOSHROOM",
Expand Down Expand Up @@ -1313,7 +1305,38 @@ public enum ConfigNodes {
"-1",
"",
"# The maximum amount of allies that a nation can have, set to -1 to have no limit."),

GNATION_SETTINGS_PROXIMITY_ROOT(
"global_nation_settings.proximity", "", ""),
GNATION_SETTINGS_NATION_PROXIMITY_TO_CAPITAL(
"global_nation_settings.proximity.nation_proximity_to_capital_city",
"0.0",
"",
"# The maximum number of townblocks a town's homeblock can be away from their nation capital's homeblock.",
"# Automatically precludes towns from one world joining a nation in another world.",
"# If the number is 0, towns will not require a proximity to a nation."
),
GNATION_SETTINGS_NATION_PROXIMITY_TO_OTHER_NATION_TOWNS(
"global_nation_settings.proximity.nation_proximity_to_other_nation_towns",
"0.0",
"",
"# The maximum number of townblocks a town's homeblock can be away from other towns's homeblocks in the nation.",
"# This setting is only used when nation_proximity_to_capital_city is above 0.",
"# When used, and a town is out of range of their capital city, the remaining towns in the nation will be parsed,",
"# if one of those towns' homeblocks is close enough to the town's homeblock, the town can remain in the nation.",
"# Leave this setting at 0.0 in order to de-activate nations' towns granting further range for towns in the nation."
),
GNATION_SETTINGS_NATION_PROXIMITY_TO_CAPITAL_CAP(
"global_nation_settings.proximity.absolute_distance_from_capital",
"0.0",
"",
"# The maximum number of townblocks a town's homeblock can be away from their nation's capital's homeblock,",
"# when the town is being allowed to go further out from the capital because of the nation_proximity_to_other_nation_towns",
"# setting above.",
"# This setting is what will stop a nation being able to go incredibly wide due to towns 'chaining' together.",
"# This setting is only used when nation_proximity_to_capital_city is above 0.",
"# Leave this setting at 0.0 in order to allow nations to chain towns together to go as wide as they like."
),

GNATION_SETTINGS_ALLOW_NUMBERS_IN_NATION_NAME(
"global_nation_settings.allow_numbers_in_nation_name",
"true",
Expand Down Expand Up @@ -2231,6 +2254,7 @@ public enum ConfigNodes {
"600s",
"",
"# The time that the town and nation bank accounts' balances are cached for, in seconds.",
"# This time is also used for the resident tax-owing value.",
"# Default of 600s is equal to ten minutes. Requires the server to be stopped and started if you want to change this.",
"# Cached balances are used for PlaceholderAPI placeholders, town and nation lists."),
ECO_TOWN_PREFIX(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.TownBlock;
import com.palmergames.bukkit.towny.object.TownBlockType;
import com.palmergames.bukkit.towny.object.TownyWorld;
import com.palmergames.bukkit.util.BukkitTools;
import com.palmergames.bukkit.util.ChatTools;
Expand All @@ -41,13 +42,15 @@ public class TownyAsciiMap {
private static final int MAP_LOWER_BOUNDS = 7;
public static int lineWidth = sanitizeLineWidth(TownySettings.asciiMapWidth());
public static int halfLineWidth = lineWidth / 2;
public static String defaultSymbol = TownBlockType.RESIDENTIAL.getAsciiMapKey();
public static String forSaleSymbol = ConfigNodes.ASCII_MAP_SYMBOLS_FORSALE.getDefault();
public static String homeSymbol = ConfigNodes.ASCII_MAP_SYMBOLS_HOME.getDefault();
public static String outpostSymbol = ConfigNodes.ASCII_MAP_SYMBOLS_OUTPOST.getDefault();
public static String wildernessSymbol = ConfigNodes.ASCII_MAP_SYMBOLS_WILDERNESS.getDefault();

static {
TownySettings.addReloadListener(NamespacedKey.fromString("towny:ascii-map-symbols"), config -> {
defaultSymbol = TownBlockType.RESIDENTIAL.getAsciiMapKey();
forSaleSymbol = parseSymbol(TownySettings.forSaleMapSymbol());
homeSymbol = parseSymbol(TownySettings.homeBlockMapSymbol());
outpostSymbol = parseSymbol(TownySettings.outpostMapSymbol());
Expand All @@ -61,13 +64,13 @@ public static Component[] generateHelp(Player player) {
final Translator translator = Translator.locale(player);

return new Component[] {
text(" ").append(text("-", DARK_GRAY)).append(text(" = ", GRAY)).append(translator.component("towny_map_unclaimed").color(GRAY)),
text(" ").append(text("+", WHITE)).append(text(" = ", GRAY)).append(translator.component("towny_map_claimed").color(GRAY)),
text(" ").append(text("$", WHITE)).append(text(" = ", GRAY)).append(translator.component("towny_map_forsale").color(GRAY)),
text(" ").append(text("+", GREEN)).append(text(" = ", GRAY)).append(translator.component("towny_map_yourtown").color(GRAY)),
text(" ").append(text("+", YELLOW)).append(text(" = ", GRAY)).append(translator.component("towny_map_yourplot").color(GRAY)),
text(" ").append(text("+", DARK_GREEN)).append(text(" = ", GRAY)).append(translator.component("towny_map_ally").color(GRAY)),
text(" ").append(text("+", DARK_RED)).append(text(" = ", GRAY)).append(translator.component("towny_map_enemy").color(GRAY)),
text(" ").append(text(wildernessSymbol, DARK_GRAY)).append(text(" = ", GRAY)).append(translator.component("towny_map_unclaimed").color(GRAY)),
text(" ").append(text(defaultSymbol, WHITE)).append(text(" = ", GRAY)).append(translator.component("towny_map_claimed").color(GRAY)),
text(" ").append(text(forSaleSymbol, WHITE)).append(text(" = ", GRAY)).append(translator.component("towny_map_forsale").color(GRAY)),
text(" ").append(text(defaultSymbol, GREEN)).append(text(" = ", GRAY)).append(translator.component("towny_map_yourtown").color(GRAY)),
text(" ").append(text(defaultSymbol, YELLOW)).append(text(" = ", GRAY)).append(translator.component("towny_map_yourplot").color(GRAY)),
text(" ").append(text(defaultSymbol, DARK_GREEN)).append(text(" = ", GRAY)).append(translator.component("towny_map_ally").color(GRAY)),
text(" ").append(text(defaultSymbol, DARK_RED)).append(text(" = ", GRAY)).append(translator.component("towny_map_enemy").color(GRAY)),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@
import com.palmergames.bukkit.towny.event.economy.TownyPreTransactionEvent;
import com.palmergames.bukkit.towny.event.economy.TownyTransactionEvent;
import com.palmergames.bukkit.towny.object.economy.adapter.ReserveEconomyAdapter;
import com.palmergames.bukkit.towny.object.Nation;
import com.palmergames.bukkit.towny.object.Resident;
import com.palmergames.bukkit.towny.object.Town;
import com.palmergames.bukkit.towny.object.Transaction;
import com.palmergames.bukkit.towny.object.TransactionType;
import com.palmergames.bukkit.towny.object.economy.TownyServerAccount;
import com.palmergames.bukkit.towny.object.economy.adapter.EconomyAdapter;
import com.palmergames.bukkit.towny.object.economy.adapter.VaultEconomyAdapter;
import com.palmergames.bukkit.util.BukkitTools;
Expand All @@ -19,7 +23,9 @@
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;
import java.util.concurrent.Executor;

/**
Expand Down Expand Up @@ -52,6 +58,42 @@ public static String getServerAccount() {
return TownySettings.getString(ConfigNodes.ECO_CLOSED_ECONOMY_SERVER_ACCOUNT);
}

/**
* Method which can be used by Economy plugins in order to get a valid UUID from
* a Towny object, for use in making FakePlayer accounts.
*
* @param accountName String name which Towny uses when interacting with Vault's
* Economy class.
* @return the TownyObject's UUID or null if no Towny Object could be resolved.
*/
@Nullable
public static UUID getTownyObjectUUID(String accountName) {

if (accountName.equalsIgnoreCase(getServerAccount()))
return TownyServerAccount.getUUID();

String name;
if (accountName.startsWith(TownySettings.getNPCPrefix())) {
name = accountName.substring(TownySettings.getNPCPrefix().length());
Resident resident = TownyAPI.getInstance().getResident(name);
return resident != null ? resident.getUUID() : null;
}

if (accountName.startsWith(TownySettings.getTownAccountPrefix())) {
name = accountName.substring(TownySettings.getTownAccountPrefix().length());
Town town = TownyAPI.getInstance().getTown(name);
return town != null ? town.getUUID() : null;
}

if (accountName.startsWith(TownySettings.getNationAccountPrefix())) {
name = accountName.substring(TownySettings.getNationAccountPrefix().length());
Nation nation = TownyAPI.getInstance().getNation(name);
return nation != null ? nation.getUUID() : null;
}

return null;
}

public static void initialize(Towny plugin) {
TownyEconomyHandler.plugin = plugin;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ public static String getFormattedStrings(String prefix, List<String> list, int s
public static List<String> getFormattedTownyNames(List<TownyObject> objs) {
List<String> names = new ArrayList<>();
for (TownyObject obj : objs) {
names.add(Colors.translateColorCodes(objs.size() < 20 ? obj.getFormattedName() : obj.getName()) + Colors.White);
names.add(Colors.translateColorCodes(objs.size() < 20 ? obj.getFormattedName() : obj.getName()) + Colors.RESET);
}

return names;
Expand All @@ -1016,7 +1016,7 @@ public static List<String> getFormattedTownyNames(List<TownyObject> objs) {
public static String[] getFormattedNames(TownyObject[] objs) {
List<String> names = new ArrayList<>();
for (TownyObject obj : objs) {
names.add(Colors.translateColorCodes(obj.getFormattedName()) + Colors.White);
names.add(Colors.translateColorCodes(obj.getFormattedName()) + Colors.RESET);
}

return names.toArray(new String[0]);
Expand All @@ -1026,7 +1026,7 @@ public static List<String> getFormattedNames(Collection<? extends Nameable> obje
List<String> names = new ArrayList<>(objects.size());

for (Nameable object : objects)
names.add(Colors.translateColorCodes(object.getFormattedName()) + Colors.White);
names.add(Colors.translateColorCodes(object.getFormattedName()) + Colors.RESET);

return names;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3050,8 +3050,25 @@ public static boolean isRefundNationDisbandLowResidents() {
return getBoolean(ConfigNodes.GTOWN_SETTINGS_REFUND_DISBAND_LOW_RESIDENTS);
}

/**
* @deprecated since 0.100.0.9, use {@link #getNationProximityToCapital()} instead.
* @return getNationProximityToCapital()
*/
@Deprecated
public static double getNationRequiresProximity() {
return getDouble(ConfigNodes.GTOWN_SETTINGS_NATION_REQUIRES_PROXIMITY);
return getNationProximityToCapital();
}

public static double getNationProximityToCapital() {
return getDouble(ConfigNodes.GNATION_SETTINGS_NATION_PROXIMITY_TO_CAPITAL);
}

public static double getNationProximityToOtherNationTowns() {
return getDouble(ConfigNodes.GNATION_SETTINGS_NATION_PROXIMITY_TO_OTHER_NATION_TOWNS);
}

public static double getNationProximityAbsoluteMaximum() {
return getDouble(ConfigNodes.GNATION_SETTINGS_NATION_PROXIMITY_TO_CAPITAL_CAP);
}

public static List<String> getFarmAnimals() {
Expand Down
Loading