Skip to content

Commit

Permalink
Update towny dependency version
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr committed Apr 8, 2024
1 parent efaf777 commit e2e2120
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# TownyMenus
An easy-to-use and accessible way for players to use Towny commands.

Requires [Towny](https://github.com/TownyAdvanced/Towny) version 0.99.0.6 or above.
Requires [Towny](https://github.com/TownyAdvanced/Towny) version 0.100.2.0 or above.

## About
TownyMenus is a plugin that adds lots of inventory menus that trivializes interfacing with Towny. Instead of having to scour through documentation, commands are just a mouseclick away.
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[libraries]
spigot = { group = "org.spigotmc", name = "spigot-api", version = "1.19.4-R0.1-SNAPSHOT" }
towny = { group = "com.palmergames.bukkit.towny", name = "towny", version = "0.100.0.18" }
towny = { group = "com.palmergames.bukkit.towny", name = "towny", version = "0.100.2.1" }
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version = "24.0.1" }
anvilgui = { group = "net.wesjd", name = "anvilgui", version = "1.9.2-SNAPSHOT" }
jabel = { group = "com.github.bsideup.jabel", name = "jabel-javac-plugin", version = "1.0.0" }
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

public class TownyMenus extends JavaPlugin implements Listener {

private static final Version requiredTownyVersion = Version.fromString("0.99.0.8");
private static final Version requiredTownyVersion = Version.fromString("0.100.2.0");
private static TownyMenus plugin;
private final Object scheduler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import com.palmergames.bukkit.towny.permissions.PermissionNodes;
import com.palmergames.bukkit.towny.utils.PermissionGUIUtil;
import com.palmergames.bukkit.towny.utils.PermissionGUIUtil.SetPermissionType;
import com.palmergames.bukkit.util.NameValidation;
import io.github.townyadvanced.townymenus.gui.MenuHelper;
import io.github.townyadvanced.townymenus.gui.MenuHistory;
import io.github.townyadvanced.townymenus.gui.MenuInventory;
Expand Down Expand Up @@ -182,18 +181,16 @@ else if (!isOwner)
return AnvilResponse.close();
}

String newName = completion.getText().replaceAll(" ", "_");
String newName = completion.getText().replaceAll(" ", "_");

if (NameValidation.isBlacklistName(newName)) {
TownyMessaging.sendErrorMsg(player, of("msg_invalid_name"));
MenuHistory.last(player);
return AnvilResponse.close();
}

townBlock.setName(newName);
townBlock.save();
plotCommand().ifPresent(command -> {
try {
command.parsePlotSetName(player, new String[]{ newName }, townBlock);
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
}
});

TownyMessaging.sendMsg(player, of("msg_plot_name_set_to", townBlock.getName()));
MenuHistory.last(player);
return AnvilResponse.close();
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,11 @@ else if (player.getUniqueId().equals(resident.getUUID()))
if (town == null || !TownyUniverse.getInstance().hasTown(town.getUUID()) || !town.hasResident(resident))
return;

TownCommand.townKickResidents(player, TownyAPI.getInstance().getResident(player), town, Collections.singletonList(resident));
try {
TownCommand.townKick(player, new String[]{ resident.getName() });
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
}
})))
.build())
.addItem(ResidentMenu.formatResidentInfo(resident, player)
Expand All @@ -302,7 +306,7 @@ else if (player.getUniqueId().equals(resident.getUUID()))
.action(!player.hasPermission(PermissionNodes.TOWNY_COMMAND_TOWN_SET_TITLE.getNode()) ? ClickAction.NONE : ClickAction.leftClick(ClickAction.userInput(of("town-menu-management-resident-enter-new-title").toString(), completion -> {
try {
BaseCommand.checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_TOWN_SET_TITLE.getNode());
TownCommand.townSetTitle(player, resident, completion.getText(), false);
TownCommand.townSetTitle(player, new String[]{ resident.getName(), completion.getText() }, false);
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
return AnvilResponse.text(e.getMessage(player));
Expand All @@ -314,7 +318,7 @@ else if (player.getUniqueId().equals(resident.getUUID()))
.action(!player.hasPermission(PermissionNodes.TOWNY_COMMAND_TOWN_SET_TITLE.getNode()) ? ClickAction.NONE : ClickAction.rightClick(ClickAction.run(() -> {
try {
BaseCommand.checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_TOWN_SET_TITLE.getNode());
TownCommand.townSetTitle(player, resident, "", false);
TownCommand.townSetTitle(player, new String[]{ resident.getName(), "" }, false);
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
}
Expand All @@ -333,7 +337,7 @@ else if (player.getUniqueId().equals(resident.getUUID()))
.action(!player.hasPermission(PermissionNodes.TOWNY_COMMAND_TOWN_SET_SURNAME.getNode()) ? ClickAction.NONE : ClickAction.leftClick(ClickAction.userInput(of("town-menu-management-resident-enter-new-surname").toString(), completion -> {
try {
BaseCommand.checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_TOWN_SET_SURNAME.getNode());
TownCommand.townSetSurname(player, resident, completion.getText(), false);
TownCommand.townSetSurname(player, new String[]{ resident.getName(), completion.getText() }, false);
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
return AnvilResponse.text(e.getMessage(player));
Expand All @@ -345,7 +349,7 @@ else if (player.getUniqueId().equals(resident.getUUID()))
.action(!player.hasPermission(PermissionNodes.TOWNY_COMMAND_TOWN_SET_SURNAME.getNode()) ? ClickAction.NONE : ClickAction.rightClick(ClickAction.run(() -> {
try {
BaseCommand.checkPermOrThrow(player, PermissionNodes.TOWNY_COMMAND_TOWN_SET_SURNAME.getNode());
TownCommand.townSetSurname(player, resident, "", false);
TownCommand.townSetSurname(player, new String[]{ resident.getName(), "" }, false);
} catch (TownyException e) {
TownyMessaging.sendErrorMsg(player, e.getMessage(player));
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/resources/Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,6 @@
- Prevented snapshotting of the clicked inventory holder, however useful that may be.
- Updated AnvilGUI to version 1.9.0-SNAPSHOT for 1.20.2 support.
- Fixed translations not being re-added when Towny reloads them.
- Updated AnvilGUI to version 1.9.2-SNAPSHOT for 1.20.4 support.
- Updated AnvilGUI to version 1.9.2-SNAPSHOT for 1.20.4 support.
0.0.8:
- Fix compatability with Towny versions 0.100.2.0 and up

0 comments on commit e2e2120

Please sign in to comment.