Could you indent the code please? Press Control + Shift + FMaybe I just don't understand schedulers. But this is flashing an error message bruh and I can't diagnose that crap.
![]()
![]()
Change active = true to active == true for starters
Change active = true to active == true for starters
This should work, you had some useless if statements so I removed them.In this case it doesn't effect the functionality bruh[DOUBLEPOST=1560085077][/DOUBLEPOST]
Actually, it breaks it entirely.
View attachment 231102
if (!(sender instanceof Player)) return true;
Player player = (Player) sender;
if (!player.hasPermission("timedflight.15m")) return true;
if (!active) {
player.setAllowFlight(true);
player.setFlying(true);
player.sendMessage("asda");
active = true;
new BukkitRunnable() {
@Override
public void run() {
player.setFlying(false);
player.sendMessage("asda");
}
}.runTaskLater(plugin, 9000L);
} else {
if (player.getAllowFlight()) {
player.setAllowFlight(false);
player.sendMessage("");
}
}
He meant in the if statement, you hadIn this case it doesn't effect the functionality bruh[DOUBLEPOST=1560085077][/DOUBLEPOST]
Actually, it breaks it entirely.
View attachment 231102
if (active = true)
if (active == true)
if (active)
This should work, you had some useless if statements so I removed them.
EDIT: You shouldn't have a global boolean in the class because that can be changed by anyone. Use a HashMap<UUID, Boolean> to store the player's UUID and a boolean to see if they're flying or not.[DOUBLEPOST=1560085409][/DOUBLEPOST]Code:if (!(sender instanceof Player)) return true; Player player = (Player) sender; if (!player.hasPermission("timedflight.15m")) return true; if (!active) { player.setAllowFlight(true); player.setFlying(true); player.sendMessage("asda"); active = true; new BukkitRunnable() { @Override public void run() { player.setFlying(false); player.sendMessage("asda"); } }.runTaskLater(plugin, 9000L); } else { if (player.getAllowFlight()) { player.setAllowFlight(false); player.sendMessage(""); } }
He meant in the if statement, you hadwhich you need to change toCode:if (active = true)OR better, useCode:if (active == true)Code:if (active)
That gives this error:
yeah because you need to use your own plugin instance.
change plugin for this in the runnable bit.
Thought you meant the variable oops.
https://docs.oracle.com/javase/tutorial/i'm an actual tool.
https://docs.oracle.com/javase/tutorial/
Learn Java before coding with API's, it helps.
Well you're never going to learn by copying what other people write in YouTube tutorials.you think I have the effort or motivation to read through a million docs.
Well you're never going to learn by copying what other people write in YouTube tutorials.
Notice the word "copy". If you're not going to read through the docs and are going to watch YouTube videos, at least pause them and understand what the person is writing. Don't just copy or you won't learn anything.
Umm, you just repeated what’s already been said :tup: nice oneLine 32[DOUBLEPOST=1560086916][/DOUBLEPOST]Why are you doing if(active == true)? just change it to if(active) / if(!active)
