From 7d7f2dd14a82d90c31a7e023d7c5a2188450dfc4 Mon Sep 17 00:00:00 2001 From: Here's Johnny Date: Fri, 9 Dec 2022 17:04:28 -0600 Subject: [PATCH] fixed null error and added missing permisson --- src/main/java/flysystem/hj320/fly_system.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/flysystem/hj320/fly_system.java b/src/main/java/flysystem/hj320/fly_system.java index 37e2630..201a600 100644 --- a/src/main/java/flysystem/hj320/fly_system.java +++ b/src/main/java/flysystem/hj320/fly_system.java @@ -26,8 +26,10 @@ public void run() { if(player.isOnline() == true){ String mode = player.getGameMode().toString(); if (mode == "CREATIVE" || mode == "SPECTATOR") {player.setAllowFlight(true);} else { - if(isplayerinflyon(player) == true && player.hasPermission("hj320.fly")){ - if (Integer.parseInt(getplayershours(player)) <= Integer.parseInt(geconfigram())) {player.setAllowFlight(false);} else { + if(isplayerinflyon(player) == true && player.hasPermission("hj320.fly")||isplayerinflyon(player) == true && player.hasPermission("hj320.fly.req")){ + if(getplayershours(player) == null)return; + if(geconfigram() == null)return; + if (Integer.parseInt(getplayershours(player)) <= Integer.parseInt(geconfigram())) {player.setAllowFlight(false);} else { if (Integer.parseInt(getplayershours(player)) >= Integer.parseInt(geconfigram())) {player.setAllowFlight(true);} if (player.isFlying()|| player.isGliding()) { if(isplayerinparton(player) == true && player.hasPermission("hj320.particles")){ @@ -48,7 +50,7 @@ public void run() { for (Player player : Bukkit.getServer().getOnlinePlayers()) { if(player.isOnline() == true){ int up5 = Integer.parseInt(storeplayerhours.get(player.getUniqueId()))+5; - + // System.out.println("player = "+player.getName()); // System.out.println("up5 set to "+up5); // System.out.println("is player fly on = "+isplayerinflyon(player)); @@ -77,11 +79,11 @@ public static boolean isplayerinparton(Player p) { return false; } public static String geconfigram() { - if(getconfigloadinram.get("hj320hourconfig") == null)return null; + if(getconfigloadinram.get("hj320hourconfig") == null)return "0"; return getconfigloadinram.get("hj320hourconfig"); } public static String getplayershours(Player p) { - if(storeplayerhours.get(p.getUniqueId()) == null)return null; + if(storeplayerhours.get(p.getUniqueId()) == null)return "0"; return storeplayerhours.get(p.getUniqueId()); } }