Created
August 23, 2019 05:04
-
-
Save aurorapar/fc05bb8945670d3760ae908c3d2b262d to your computer and use it in GitHub Desktop.
HotSun plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hotsun; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public class HotSun extends JavaPlugin | |
{ | |
@Override | |
public void onEnable() | |
{ | |
Timers.timer(this); | |
} | |
@Override | |
public void onDisable() | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hotsun; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Location; | |
import org.bukkit.block.Block; | |
import org.bukkit.entity.Player; | |
import org.bukkit.plugin.Plugin; | |
public class Timers | |
{ | |
public static void timer(Plugin plugin) | |
{ | |
for(Player player : plugin.getServer().getOnlinePlayers()) | |
{ | |
if(!player.isDead()) | |
{ | |
Location location = player.getLocation(); | |
location.setY(location.getY()+1); | |
Block block = location.getBlock(); | |
if(block.getLightFromSky() > 10 && block.getLightLevel() > 9) | |
{ | |
player.setFireTicks(60); | |
} | |
} | |
} | |
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { | |
public void run() { | |
timer(plugin); | |
} | |
}, 20L);// 60 L == 3 sec, 20 ticks == 1 sec | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment