Encapsulate some more variables

Refactor Settings class a bit and move header straight to the file
This commit is contained in:
Daniil Z committed 2021-03-01 19:27:01 +03:00
1 parent ca0ac7c13e
commit b05a5bfb8d
30 files changed
+248 -255

No files matched your search

@@ -151,11 +151,11 @@ public class Home extends TeleportationPoint {
try {
return Integer.parseInt(permission.split("\\.")[2]);
} catch(Exception e) {
return HuskHomes.settings.getMaximumHomes();
return HuskHomes.getSettings().getMaximumHomes();
}
}
}
return HuskHomes.settings.getMaximumHomes();
return HuskHomes.getSettings().getMaximumHomes();
}
// Returns the number of set homes a player can set for free
@@ -166,10 +166,10 @@ public class Home extends TeleportationPoint {
try {
return Integer.parseInt(permission.split("\\.")[2]);
} catch(Exception e) {
return HuskHomes.settings.getFreeHomeSlots();
return HuskHomes.getSettings().getFreeHomeSlots();
}
}
}
return HuskHomes.settings.getFreeHomeSlots();
return HuskHomes.getSettings().getFreeHomeSlots();
}
}
@@ -27,10 +27,10 @@ public class RandomPoint extends TeleportationPoint {
private static final int MAX_RANDOM_ATTEMPTS = 8;
public RandomPoint(Player player) {
super(player.getLocation(), HuskHomes.settings.getServerID());
super(player.getLocation(), HuskHomes.getSettings().getServerID());
Location randomLocation = getRandomLocation(player.getWorld());
if (randomLocation != null) {
setLocation(randomLocation, HuskHomes.settings.getServerID());
setLocation(randomLocation, HuskHomes.getSettings().getServerID());
} else {
MessageManager.sendMessage(player, "error_rtp_randomization_timeout");
}
@@ -47,7 +47,7 @@ public class RandomPoint extends TeleportationPoint {
double blockCenterZ = 0.5;
// The furthest distance at which a player can be teleported to
int rtpRange = HuskHomes.settings.getRtpRange();
int rtpRange = HuskHomes.getSettings().getRtpRange();
// Calculate random X and Z coords
x = random.nextInt(rtpRange);