Skip to content

Commit

Permalink
Update to latest towny
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Sep 10, 2023
1 parent b913818 commit bbb3c42
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
Binary file removed libs/Towny.jar
Binary file not shown.
9 changes: 6 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>glaremasters repo</id>
<url>https://repo.glaremasters.me/repository/towny/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -96,9 +100,8 @@
</dependency>
<dependency>
<groupId>com.github.TownyAdvanced</groupId>
<artifactId>Towny</artifactId>
<version>0.97.2.14</version>
<!-- NOTE: 0.97.2.15 and higher no longer contain war features -->
<artifactId>towny</artifactId>
<version>0.99.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.palmergames.bukkit.towny.object.TownyPermission;
import com.palmergames.bukkit.towny.object.TownyWorld;
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
import com.palmergames.bukkit.towny.war.common.WarZoneConfig;
import net.tylers1066.movecrafttowny.movecrafttowny.MovecraftTowny;
import net.tylers1066.movecrafttowny.movecrafttowny.config.Config;
import net.tylers1066.movecrafttowny.movecrafttowny.localisation.I18nSupport;
Expand Down Expand Up @@ -39,14 +38,10 @@ public class TownyUtils {
@Nullable
public static TownyWorld getTownyWorld(World w) {
TownyWorld tw;
try {
tw = TownyUniverse.getInstance().getDataSource().getWorld(w.getName());
if(!tw.isUsingTowny())
return null;
}
catch (NotRegisteredException e) {
tw = TownyUniverse.getInstance().getWorld(w.getName());
if(tw == null || !tw.isUsingTowny())
return null;
}

return tw;
}

Expand Down Expand Up @@ -96,13 +91,8 @@ public static Location getTownSpawn(@Nullable TownBlock townBlock) {
}

public static boolean validateResident(Player player) {
try {
Resident resident = TownyUniverse.getInstance().getDataSource().getResident(player.getName());
return true;
}
catch (TownyException e) {
return false;
}
Resident resident = TownyUniverse.getInstance().getResident(player.getName());
return resident != null;
}

public static boolean validateCraftMoveEvent(Player player, Location loc, TownyWorld world) {
Expand All @@ -115,9 +105,7 @@ public static boolean validateCraftMoveEvent(Player player, Location loc, TownyW
return true;

PlayerCache playerCache = MovecraftTowny.getInstance().getTownyPlugin().getCache(player);
PlayerCache.TownBlockStatus status = playerCache.getStatus();

return !playerCache.hasBlockErrMsg() && status == PlayerCache.TownBlockStatus.WARZONE && WarZoneConfig.isAllowingSwitchesInWarZone();
return !playerCache.hasBlockErrMsg();
}

public static boolean validatePVP(TownBlock tb) {
Expand Down

0 comments on commit bbb3c42

Please sign in to comment.