Skip to content

Instantly share code, notes, and snippets.

@aurorapar
Created August 23, 2019 05:04
Show Gist options
  • Save aurorapar/fc05bb8945670d3760ae908c3d2b262d to your computer and use it in GitHub Desktop.
Save aurorapar/fc05bb8945670d3760ae908c3d2b262d to your computer and use it in GitHub Desktop.
HotSun plugin
package hotsun;
import org.bukkit.plugin.java.JavaPlugin;
public class HotSun extends JavaPlugin
{
@Override
public void onEnable()
{
Timers.timer(this);
}
@Override
public void onDisable()
{
}
}
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