Cleanup CTZ/ServerStore

This commit is contained in:
ceikry
2021-08-09 19:03:09 -05:00
parent edf5b0738c
commit 7859c87565
2 changed files with 4 additions and 1 deletions
@@ -263,7 +263,7 @@ public final class ChaosTunnelZone extends MapZone implements Plugin<Object> {
* @param player The player. * @param player The player.
*/ */
private void commenceBorkBattle(Player player) { private void commenceBorkBattle(Player player) {
if (ServerStore.INSTANCE.getBoolean(getStoreFile(), player.getUsername().toLowerCase()) && GameWorld.getSettings().isHosted()) { if (ServerStore.getBoolean(getStoreFile(), player.getUsername().toLowerCase()) && GameWorld.getSettings().isHosted()) {
player.getPacketDispatch().sendMessage("The portal's magic is too weak to teleport you right now."); player.getPacketDispatch().sendMessage("The portal's magic is too weak to teleport you right now.");
return; return;
} }
@@ -100,14 +100,17 @@ object ServerStore {
} }
} }
@JvmStatic
fun JSONObject.getString(key: String): String { fun JSONObject.getString(key: String): String {
return this[key] as? String ?: "nothing" return this[key] as? String ?: "nothing"
} }
@JvmStatic
fun JSONObject.getLong(key: String): Long { fun JSONObject.getLong(key: String): Long {
return this[key] as? Long ?: 0L return this[key] as? Long ?: 0L
} }
@JvmStatic
fun JSONObject.getBoolean(key: String): Boolean { fun JSONObject.getBoolean(key: String): Boolean {
return this[key] as? Boolean ?: false return this[key] as? Boolean ?: false
} }