mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-23 10:45:51 +01:00
Remove LazyLocation and declare that Tasks are not Utils.
This commit is contained in:
parent
9a8f2071e0
commit
bc0a8da76f
@ -53,9 +53,9 @@ public class ConfServer extends SimpleConfig
|
||||
public static double powerPerHourOffline = 0.0;
|
||||
|
||||
// players will no longer lose power from being offline once their power drops to this amount or less
|
||||
public static double powerLimitGainOnline = 0.0;
|
||||
public static double powerLimitGainOnline = 10.0;
|
||||
public static double powerLimitGainOffline = 0.0;
|
||||
public static double powerLimitLossOnline = 0.0;
|
||||
public static double powerLimitLossOnline = -10.0;
|
||||
public static double powerLimitLossOffline = 0.0;
|
||||
|
||||
public static boolean scaleNegativePower = false; // Power regeneration rate increase as power decreases
|
||||
|
@ -16,8 +16,8 @@ import com.massivecraft.factions.listeners.FactionsChatListener;
|
||||
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||
import com.massivecraft.factions.listeners.FactionsExploitListener;
|
||||
import com.massivecraft.factions.listeners.FactionsPlayerListener;
|
||||
import com.massivecraft.factions.util.AutoLeaveTask;
|
||||
import com.massivecraft.factions.util.EconLandRewardTask;
|
||||
import com.massivecraft.factions.task.AutoLeaveTask;
|
||||
import com.massivecraft.factions.task.EconLandRewardTask;
|
||||
|
||||
import com.massivecraft.mcore.MPlugin;
|
||||
import com.massivecraft.mcore.xlib.gson.GsonBuilder;
|
||||
|
@ -4,7 +4,7 @@ import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.Faction;
|
||||
import com.massivecraft.factions.Perm;
|
||||
import com.massivecraft.factions.cmd.arg.ARFaction;
|
||||
import com.massivecraft.factions.util.SpiralTask;
|
||||
import com.massivecraft.factions.task.SpiralTask;
|
||||
import com.massivecraft.mcore.cmd.arg.ARInteger;
|
||||
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
|
||||
import com.massivecraft.mcore.cmd.req.ReqIsPlayer;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.factions.util;
|
||||
package com.massivecraft.factions.task;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.FPlayerColl;
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.factions.util;
|
||||
package com.massivecraft.factions.task;
|
||||
|
||||
import com.massivecraft.factions.ConfServer;
|
||||
import com.massivecraft.factions.FactionColl;
|
@ -1,4 +1,4 @@
|
||||
package com.massivecraft.factions.util;
|
||||
package com.massivecraft.factions.task;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
@ -1,107 +0,0 @@
|
||||
package com.massivecraft.factions.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
/*
|
||||
* This class provides a lazy-load Location, so that World doesn't need to be initialized
|
||||
* yet when an object of this class is created, only when the Location is first accessed.
|
||||
*/
|
||||
|
||||
public class LazyLocation
|
||||
{
|
||||
private Location location = null;
|
||||
private String worldName;
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private float pitch;
|
||||
private float yaw;
|
||||
|
||||
public LazyLocation(Location loc)
|
||||
{
|
||||
setLocation(loc);
|
||||
}
|
||||
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z)
|
||||
{
|
||||
this(worldName, x, y, z, 0, 0);
|
||||
}
|
||||
|
||||
public LazyLocation(final String worldName, final double x, final double y, final double z, final float yaw, final float pitch)
|
||||
{
|
||||
this.worldName = worldName;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.yaw = yaw;
|
||||
this.pitch = pitch;
|
||||
}
|
||||
|
||||
// This returns the actual Location
|
||||
public final Location getLocation()
|
||||
{
|
||||
// make sure Location is initialized before returning it
|
||||
initLocation();
|
||||
return location;
|
||||
}
|
||||
|
||||
// change the Location
|
||||
public final void setLocation(Location loc)
|
||||
{
|
||||
this.location = loc;
|
||||
this.worldName = loc.getWorld().getName();
|
||||
this.x = loc.getX();
|
||||
this.y = loc.getY();
|
||||
this.z = loc.getZ();
|
||||
this.yaw = loc.getYaw();
|
||||
this.pitch = loc.getPitch();
|
||||
}
|
||||
|
||||
|
||||
// This initializes the Location
|
||||
private void initLocation()
|
||||
{
|
||||
// if location is already initialized, simply return
|
||||
if (location != null) return;
|
||||
|
||||
// get World; hopefully it's initialized at this point
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) return;
|
||||
|
||||
// store the Location for future calls, and pass it on
|
||||
location = new Location(world, x, y, z, yaw, pitch);
|
||||
}
|
||||
|
||||
|
||||
public final String getWorldName()
|
||||
{
|
||||
return worldName;
|
||||
}
|
||||
|
||||
public final double getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
public final double getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
public final double getZ()
|
||||
{
|
||||
return z;
|
||||
}
|
||||
|
||||
public final double getPitch()
|
||||
{
|
||||
return pitch;
|
||||
}
|
||||
|
||||
public final double getYaw()
|
||||
{
|
||||
return yaw;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user