Rename task classes to correspond to config values and use minutes as the unit for human readability and thinking.
This commit is contained in:
parent
825d937c84
commit
cb1926c5c1
@ -34,9 +34,9 @@ import com.massivecraft.factions.listeners.FactionsListenerMain;
|
|||||||
import com.massivecraft.factions.listeners.TodoFactionsPlayerListener;
|
import com.massivecraft.factions.listeners.TodoFactionsPlayerListener;
|
||||||
import com.massivecraft.factions.mixin.PowerMixin;
|
import com.massivecraft.factions.mixin.PowerMixin;
|
||||||
import com.massivecraft.factions.mixin.PowerMixinDefault;
|
import com.massivecraft.factions.mixin.PowerMixinDefault;
|
||||||
import com.massivecraft.factions.task.RemovePlayerDataTask;
|
import com.massivecraft.factions.task.TaskPlayerDataRemove;
|
||||||
import com.massivecraft.factions.task.EconRewardTask;
|
import com.massivecraft.factions.task.TaskEconLandReward;
|
||||||
import com.massivecraft.factions.task.PowerUpdateTask;
|
import com.massivecraft.factions.task.TaskPlayerPowerUpdate;
|
||||||
|
|
||||||
import com.massivecraft.mcore.MPlugin;
|
import com.massivecraft.mcore.MPlugin;
|
||||||
import com.massivecraft.mcore.usys.Aspect;
|
import com.massivecraft.mcore.usys.Aspect;
|
||||||
@ -136,9 +136,9 @@ public class Factions extends MPlugin
|
|||||||
getServer().getPluginManager().registerEvents(this.playerListener, this);
|
getServer().getPluginManager().registerEvents(this.playerListener, this);
|
||||||
|
|
||||||
// Schedule recurring non-tps-dependent tasks
|
// Schedule recurring non-tps-dependent tasks
|
||||||
PowerUpdateTask.get().schedule(this);
|
TaskPlayerPowerUpdate.get().schedule(this);
|
||||||
RemovePlayerDataTask.get().schedule(this);
|
TaskPlayerDataRemove.get().schedule(this);
|
||||||
EconRewardTask.get().schedule(this);
|
TaskEconLandReward.get().schedule(this);
|
||||||
|
|
||||||
// Register built in chat modifiers
|
// Register built in chat modifiers
|
||||||
ChatModifierLc.get().register();
|
ChatModifierLc.get().register();
|
||||||
|
@ -9,7 +9,6 @@ import org.bukkit.event.EventPriority;
|
|||||||
|
|
||||||
import com.massivecraft.factions.listeners.FactionsListenerChat;
|
import com.massivecraft.factions.listeners.FactionsListenerChat;
|
||||||
import com.massivecraft.mcore.store.Entity;
|
import com.massivecraft.mcore.store.Entity;
|
||||||
import com.massivecraft.mcore.util.TimeUnit;
|
|
||||||
|
|
||||||
public class MConf extends Entity<MConf>
|
public class MConf extends Entity<MConf>
|
||||||
{
|
{
|
||||||
@ -38,9 +37,9 @@ public class MConf extends Entity<MConf>
|
|||||||
// TASKS
|
// TASKS
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
public long taskPowerMillis = TimeUnit.MILLIS_PER_MINUTE;
|
public double taskPlayerPowerUpdateMinutes = 1;
|
||||||
public long taskEconMillis = 20 * TimeUnit.MILLIS_PER_MINUTE;
|
public double taskPlayerDataRemoveMinutes = 5;
|
||||||
public long taskAutoLeaveMillis = 5 * TimeUnit.MILLIS_PER_MINUTE;
|
public double taskEconLandRewardMinutes = 20;
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// REMOVE DATA
|
// REMOVE DATA
|
||||||
|
@ -4,15 +4,16 @@ import com.massivecraft.factions.entity.FactionColl;
|
|||||||
import com.massivecraft.factions.entity.FactionColls;
|
import com.massivecraft.factions.entity.FactionColls;
|
||||||
import com.massivecraft.factions.entity.MConf;
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.mcore.ModuloRepeatTask;
|
import com.massivecraft.mcore.ModuloRepeatTask;
|
||||||
|
import com.massivecraft.mcore.util.TimeUnit;
|
||||||
|
|
||||||
public class EconRewardTask extends ModuloRepeatTask
|
public class TaskEconLandReward extends ModuloRepeatTask
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static EconRewardTask i = new EconRewardTask();
|
private static TaskEconLandReward i = new TaskEconLandReward();
|
||||||
public static EconRewardTask get() { return i; }
|
public static TaskEconLandReward get() { return i; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE: MODULO REPEAT TASK
|
// OVERRIDE: MODULO REPEAT TASK
|
||||||
@ -21,13 +22,13 @@ public class EconRewardTask extends ModuloRepeatTask
|
|||||||
@Override
|
@Override
|
||||||
public long getDelayMillis()
|
public long getDelayMillis()
|
||||||
{
|
{
|
||||||
return MConf.get().taskEconMillis;
|
return (long) (MConf.get().taskEconLandRewardMinutes * TimeUnit.MILLIS_PER_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDelayMillis(long delayMillis)
|
public void setDelayMillis(long delayMillis)
|
||||||
{
|
{
|
||||||
MConf.get().taskEconMillis = delayMillis;
|
MConf.get().taskEconLandRewardMinutes = delayMillis / (double) TimeUnit.MILLIS_PER_MINUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -4,15 +4,16 @@ import com.massivecraft.factions.entity.MConf;
|
|||||||
import com.massivecraft.factions.entity.UPlayerColl;
|
import com.massivecraft.factions.entity.UPlayerColl;
|
||||||
import com.massivecraft.factions.entity.UPlayerColls;
|
import com.massivecraft.factions.entity.UPlayerColls;
|
||||||
import com.massivecraft.mcore.ModuloRepeatTask;
|
import com.massivecraft.mcore.ModuloRepeatTask;
|
||||||
|
import com.massivecraft.mcore.util.TimeUnit;
|
||||||
|
|
||||||
public class RemovePlayerDataTask extends ModuloRepeatTask
|
public class TaskPlayerDataRemove extends ModuloRepeatTask
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static RemovePlayerDataTask i = new RemovePlayerDataTask();
|
private static TaskPlayerDataRemove i = new TaskPlayerDataRemove();
|
||||||
public static RemovePlayerDataTask get() { return i; }
|
public static TaskPlayerDataRemove get() { return i; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE: MODULO REPEAT TASK
|
// OVERRIDE: MODULO REPEAT TASK
|
||||||
@ -21,13 +22,13 @@ public class RemovePlayerDataTask extends ModuloRepeatTask
|
|||||||
@Override
|
@Override
|
||||||
public long getDelayMillis()
|
public long getDelayMillis()
|
||||||
{
|
{
|
||||||
return MConf.get().taskAutoLeaveMillis;
|
return (long) (MConf.get().taskPlayerDataRemoveMinutes * TimeUnit.MILLIS_PER_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDelayMillis(long delayMillis)
|
public void setDelayMillis(long delayMillis)
|
||||||
{
|
{
|
||||||
MConf.get().taskAutoLeaveMillis = delayMillis;
|
MConf.get().taskPlayerDataRemoveMinutes = delayMillis / (double) TimeUnit.MILLIS_PER_MINUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -10,14 +10,14 @@ import com.massivecraft.factions.event.FactionsEventPowerChange.PowerChangeReaso
|
|||||||
import com.massivecraft.mcore.ModuloRepeatTask;
|
import com.massivecraft.mcore.ModuloRepeatTask;
|
||||||
import com.massivecraft.mcore.util.TimeUnit;
|
import com.massivecraft.mcore.util.TimeUnit;
|
||||||
|
|
||||||
public class PowerUpdateTask extends ModuloRepeatTask
|
public class TaskPlayerPowerUpdate extends ModuloRepeatTask
|
||||||
{
|
{
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// INSTANCE & CONSTRUCT
|
// INSTANCE & CONSTRUCT
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
|
||||||
private static PowerUpdateTask i = new PowerUpdateTask();
|
private static TaskPlayerPowerUpdate i = new TaskPlayerPowerUpdate();
|
||||||
public static PowerUpdateTask get() { return i; }
|
public static TaskPlayerPowerUpdate get() { return i; }
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// OVERRIDE: MODULO REPEAT TASK
|
// OVERRIDE: MODULO REPEAT TASK
|
||||||
@ -26,13 +26,13 @@ public class PowerUpdateTask extends ModuloRepeatTask
|
|||||||
@Override
|
@Override
|
||||||
public long getDelayMillis()
|
public long getDelayMillis()
|
||||||
{
|
{
|
||||||
return MConf.get().taskPowerMillis;
|
return (long) (MConf.get().taskPlayerPowerUpdateMinutes * TimeUnit.MILLIS_PER_MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDelayMillis(long delayMillis)
|
public void setDelayMillis(long delayMillis)
|
||||||
{
|
{
|
||||||
MConf.get().taskPowerMillis = delayMillis;
|
MConf.get().taskPlayerPowerUpdateMinutes = delayMillis / (double) TimeUnit.MILLIS_PER_MINUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in New Issue
Block a user