Java Code Examples for org.bukkit.World#getTime()

The following examples show how to use org.bukkit.World#getTime() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EvtAtTime.java    From Skript with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void register(final Trigger t) {
	this.t = t;
	for (final World w : worlds) {
		EvtAtInfo i = triggers.get(w);
		if (i == null) {
			triggers.put(w, i = new EvtAtInfo());
			i.lastTick = (int) w.getTime() - 1;
		}
		i.list.add(this);
		Collections.sort(i.list);
	}
	registerListener();
}
 
Example 2
Source File: TimeEvent.java    From BetonQuest with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected Void execute(String playerID) {
    World world = PlayerConverter.getPlayer(playerID).getWorld();
    long time = amount;
    if (add) {
        time += world.getTime();
    }
    world.setTime(time % 24000);
    return null;
}
 
Example 3
Source File: ArmorTask.java    From Slimefun4 with GNU General Public License v3.0 5 votes vote down vote up
private boolean hasSunlight(Player p) {
    World world = p.getWorld();

    if (world.getEnvironment() != Environment.NORMAL) {
        // The End and Nether have no sunlight
        return false;
    }

    return (world.getTime() < 12300 || world.getTime() > 23850) && p.getEyeLocation().getBlock().getLightFromSky() == 15;
}
 
Example 4
Source File: Checker.java    From Harbor with MIT License 4 votes vote down vote up
private boolean isNight(final World world) {
    return world.getTime() > 12950 || world.getTime() < 23950;
}