Skip to content

Commit

Permalink
fixed null error and added missing permisson
Browse files Browse the repository at this point in the history
  • Loading branch information
HeresJohnny320 committed Dec 9, 2022
1 parent ca1c799 commit 7d7f2dd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/flysystem/hj320/fly_system.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")){
Expand All @@ -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));
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 7d7f2dd

Please sign in to comment.