Minor warning tweaks

This commit is contained in:
Aubri Seebauer committed 2023-04-03 20:51:21 -04:00
1 parent a6ce6ae042
commit cb43d34be5
2 files changed
+28 -28

No files matched your search

+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>org.aubrithehuman</groupId> <groupId>org.aubrithehuman</groupId>
<artifactId>TownyRangeLimit</artifactId> <artifactId>TownyRangeLimit</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0.1</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>TownyRangeLimit</name> <name>TownyRangeLimit</name>
@@ -77,7 +77,7 @@
<dependency> <dependency>
<groupId>com.github.LlmDl</groupId> <groupId>com.github.LlmDl</groupId>
<artifactId>Towny</artifactId> <artifactId>Towny</artifactId>
<version>0.98.3.3</version> <version>0.98.6.0</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
@@ -110,9 +110,9 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
/** /**
* Finds the shortest distance (in townblocks) between two towns * Finds the shortest distance (in townblocks) between two towns
* @param town1 * @param town1 town1
* @param town2 * @param town2 town1
* @return * @return shortest distance
*/ */
private static int shortestDistance(Town town1, Town town2) { private static int shortestDistance(Town town1, Town town2) {
//max possible range (60M*sqrt2) //max possible range (60M*sqrt2)
@@ -143,7 +143,7 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
} }
} }
//if we didnt find anything for some reason? idk its worth putting //if we didn't find anything for some reason? IDK its worth putting
if(nearestInviter == null) { if(nearestInviter == null) {
return dist; return dist;
} }
@@ -177,9 +177,9 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
/** /**
* Finds the shortest distance (in townblocks) between a town and a nation * Finds the shortest distance (in townblocks) between a town and a nation
* @param town * @param town town
* @param nation * @param nation nation
* @return * @return shortest distance
*/ */
private static int shortestDistance(Town town, Nation nation) { private static int shortestDistance(Town town, Nation nation) {
//max possible range (60M*sqrt2) //max possible range (60M*sqrt2)
@@ -190,10 +190,10 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
ArrayList<WorldCoord> clusterInvited = getCluster(town.getHomeBlock().getWorldCoord()); ArrayList<WorldCoord> clusterInvited = getCluster(town.getHomeBlock().getWorldCoord());
WorldCoord invitedHomeblock = town.getHomeBlock().getWorldCoord(); WorldCoord invitedHomeblock = town.getHomeBlock().getWorldCoord();
//Grab all of the towns in the nation //Grab all the towns in the nation
List<Town> nation1Towns = nation.getTowns(); List<Town> nation1Towns = nation.getTowns();
ArrayList<ArrayList<WorldCoord>> clustersInviter = new ArrayList<ArrayList<WorldCoord>>(); ArrayList<ArrayList<WorldCoord>> clustersInviter = new ArrayList<>();
ArrayList<WorldCoord> inviterHomeblocks = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> inviterHomeblocks = new ArrayList<>();
for (Town t : nation1Towns) { for (Town t : nation1Towns) {
clustersInviter.add(getCluster(nation.getCapital().getHomeBlock().getWorldCoord())); clustersInviter.add(getCluster(nation.getCapital().getHomeBlock().getWorldCoord()));
//grab homeblocks //grab homeblocks
@@ -221,7 +221,7 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
} }
} }
//if we didnt find anything for some reason? idk its worth putting //if we didn't find anything for some reason? IDK its worth putting
if(nearestInvited == null) { if(nearestInvited == null) {
return dist; return dist;
} }
@@ -255,9 +255,9 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
/** /**
* Finds the shortest distance (in townblocks) between two nations * Finds the shortest distance (in townblocks) between two nations
* @param nation1 * @param nation1 nation1
* @param nation2 * @param nation2 nation2
* @return * @return shortest distance
*/ */
private static int shortestDistance(Nation nation1, Nation nation2) { private static int shortestDistance(Nation nation1, Nation nation2) {
@@ -267,20 +267,20 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
if (nation1 != null && nation2 != null) { if (nation1 != null && nation2 != null) {
try { try {
//Grab all of the towns in the nation //Grab all the towns in the nation
List<Town> nation1Towns = nation1.getTowns(); List<Town> nation1Towns = nation1.getTowns();
ArrayList<ArrayList<WorldCoord>> clustersInviter = new ArrayList<ArrayList<WorldCoord>>(); ArrayList<ArrayList<WorldCoord>> clustersInviter = new ArrayList<>();
ArrayList<WorldCoord> inviterHomeblocks = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> inviterHomeblocks = new ArrayList<>();
for (Town t : nation1Towns) { for (Town t : nation1Towns) {
clustersInviter.add(getCluster(nation1.getCapital().getHomeBlock().getWorldCoord())); clustersInviter.add(getCluster(nation1.getCapital().getHomeBlock().getWorldCoord()));
inviterHomeblocks.add(t.getHomeBlock().getWorldCoord()); inviterHomeblocks.add(t.getHomeBlock().getWorldCoord());
} }
//Grab all of the towns in the nation //Grab all the towns in the nation
List<Town> nation2Towns = nation2.getTowns(); List<Town> nation2Towns = nation2.getTowns();
ArrayList<ArrayList<WorldCoord>> clustersInvited = new ArrayList<ArrayList<WorldCoord>>(); ArrayList<ArrayList<WorldCoord>> clustersInvited = new ArrayList<>();
ArrayList<WorldCoord> invitedHomeblocks = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> invitedHomeblocks = new ArrayList<>();
for (Town t : nation2Towns) { for (Town t : nation2Towns) {
clustersInvited.add(getCluster(nation2.getCapital().getHomeBlock().getWorldCoord())); clustersInvited.add(getCluster(nation2.getCapital().getHomeBlock().getWorldCoord()));
invitedHomeblocks.add(t.getHomeBlock().getWorldCoord()); invitedHomeblocks.add(t.getHomeBlock().getWorldCoord());
@@ -288,7 +288,7 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
} }
//This may take forever :skull: at like multiple 900 size towns it takes like 1mil iterations????? //This may take forever :skull: at like multiple 900 size towns it takes like 1mil iterations?????
//idk how tf else to check this //IDK how tf else to check this
//find nearest block to invited homeblock //find nearest block to invited homeblock
WorldCoord nearestInvited1 = null; WorldCoord nearestInvited1 = null;
@@ -368,12 +368,12 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
/** /**
* *
* @param worldCoord * @param worldCoord worldCoord
* @return * @return List of connected chunks
* @author NinjaMandalorian * @author NinjaMandalorian
*/ */
private static ArrayList<WorldCoord> getAdjCells(WorldCoord worldCoord) { private static ArrayList<WorldCoord> getAdjCells(WorldCoord worldCoord) {
ArrayList<WorldCoord> ReturnList = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> ReturnList = new ArrayList<>();
int[][] XZarray = new int[][]{ int[][] XZarray = new int[][]{
{-1, 0}, {-1, 0},
@@ -399,8 +399,8 @@ public final class TownyRangeLimit extends JavaPlugin implements Listener {
*/ */
public static ArrayList<WorldCoord> getCluster(WorldCoord chunkCoord){ public static ArrayList<WorldCoord> getCluster(WorldCoord chunkCoord){
// WCoordList is the returning array, SearchList is the to-search list. // WCoordList is the returning array, SearchList is the to-search list.
ArrayList<WorldCoord> WCoordList = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> WCoordList = new ArrayList<>();
ArrayList<WorldCoord> SearchList = new ArrayList<WorldCoord>(); ArrayList<WorldCoord> SearchList = new ArrayList<>();
SearchList.add(chunkCoord); // Adds 1st chunk to list SearchList.add(chunkCoord); // Adds 1st chunk to list
// Iterates through SearchList, to create a full list of every adjacent cell. // Iterates through SearchList, to create a full list of every adjacent cell.