mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-10 12:30:29 +01:00
Change PowerMixin to newer setup
This commit is contained in:
parent
6e20e810f7
commit
dc1118e328
@ -1,9 +1,5 @@
|
|||||||
package com.massivecraft.factions;
|
package com.massivecraft.factions;
|
||||||
|
|
||||||
import com.massivecraft.factions.cmd.type.TypeFactionChunkChangeType;
|
|
||||||
import com.massivecraft.factions.cmd.type.TypeRel;
|
|
||||||
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
|
||||||
import com.massivecraft.massivecore.command.type.RegistryType;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
|
||||||
import com.massivecraft.factions.adapter.BoardAdapter;
|
import com.massivecraft.factions.adapter.BoardAdapter;
|
||||||
@ -25,6 +21,8 @@ import com.massivecraft.factions.chat.tag.ChatTagRoleprefix;
|
|||||||
import com.massivecraft.factions.chat.tag.ChatTagRoleprefixforce;
|
import com.massivecraft.factions.chat.tag.ChatTagRoleprefixforce;
|
||||||
import com.massivecraft.factions.chat.tag.ChatTagTitle;
|
import com.massivecraft.factions.chat.tag.ChatTagTitle;
|
||||||
import com.massivecraft.factions.cmd.CmdFactions;
|
import com.massivecraft.factions.cmd.CmdFactions;
|
||||||
|
import com.massivecraft.factions.cmd.type.TypeFactionChunkChangeType;
|
||||||
|
import com.massivecraft.factions.cmd.type.TypeRel;
|
||||||
import com.massivecraft.factions.engine.EngineCanCombatHappen;
|
import com.massivecraft.factions.engine.EngineCanCombatHappen;
|
||||||
import com.massivecraft.factions.engine.EngineChat;
|
import com.massivecraft.factions.engine.EngineChat;
|
||||||
import com.massivecraft.factions.engine.EngineChunkChange;
|
import com.massivecraft.factions.engine.EngineChunkChange;
|
||||||
@ -55,13 +53,13 @@ import com.massivecraft.factions.entity.MConfColl;
|
|||||||
import com.massivecraft.factions.entity.MFlagColl;
|
import com.massivecraft.factions.entity.MFlagColl;
|
||||||
import com.massivecraft.factions.entity.MPermColl;
|
import com.massivecraft.factions.entity.MPermColl;
|
||||||
import com.massivecraft.factions.entity.MPlayerColl;
|
import com.massivecraft.factions.entity.MPlayerColl;
|
||||||
|
import com.massivecraft.factions.event.EventFactionsChunkChangeType;
|
||||||
import com.massivecraft.factions.integration.V19.IntegrationV19;
|
import com.massivecraft.factions.integration.V19.IntegrationV19;
|
||||||
import com.massivecraft.factions.integration.herochat.IntegrationHerochat;
|
import com.massivecraft.factions.integration.herochat.IntegrationHerochat;
|
||||||
import com.massivecraft.factions.integration.lwc.IntegrationLwc;
|
import com.massivecraft.factions.integration.lwc.IntegrationLwc;
|
||||||
import com.massivecraft.factions.integration.spigot.IntegrationSpigot;
|
import com.massivecraft.factions.integration.spigot.IntegrationSpigot;
|
||||||
import com.massivecraft.factions.integration.worldguard.IntegrationWorldGuard;
|
import com.massivecraft.factions.integration.worldguard.IntegrationWorldGuard;
|
||||||
import com.massivecraft.factions.mixin.PowerMixin;
|
import com.massivecraft.factions.mixin.PowerMixin;
|
||||||
import com.massivecraft.factions.mixin.PowerMixinDefault;
|
|
||||||
import com.massivecraft.factions.task.TaskEconLandReward;
|
import com.massivecraft.factions.task.TaskEconLandReward;
|
||||||
import com.massivecraft.factions.task.TaskFlagPermCreate;
|
import com.massivecraft.factions.task.TaskFlagPermCreate;
|
||||||
import com.massivecraft.factions.task.TaskPlayerDataRemove;
|
import com.massivecraft.factions.task.TaskPlayerDataRemove;
|
||||||
@ -71,6 +69,7 @@ import com.massivecraft.massivecore.Aspect;
|
|||||||
import com.massivecraft.massivecore.AspectColl;
|
import com.massivecraft.massivecore.AspectColl;
|
||||||
import com.massivecraft.massivecore.MassivePlugin;
|
import com.massivecraft.massivecore.MassivePlugin;
|
||||||
import com.massivecraft.massivecore.Multiverse;
|
import com.massivecraft.massivecore.Multiverse;
|
||||||
|
import com.massivecraft.massivecore.command.type.RegistryType;
|
||||||
import com.massivecraft.massivecore.util.MUtil;
|
import com.massivecraft.massivecore.util.MUtil;
|
||||||
import com.massivecraft.massivecore.xlib.gson.Gson;
|
import com.massivecraft.massivecore.xlib.gson.Gson;
|
||||||
import com.massivecraft.massivecore.xlib.gson.GsonBuilder;
|
import com.massivecraft.massivecore.xlib.gson.GsonBuilder;
|
||||||
@ -120,9 +119,8 @@ public class Factions extends MassivePlugin
|
|||||||
public boolean isDatabaseInitialized() { return this.databaseInitialized; }
|
public boolean isDatabaseInitialized() { return this.databaseInitialized; }
|
||||||
|
|
||||||
// Mixins
|
// Mixins
|
||||||
private PowerMixin powerMixin = null;
|
@Deprecated public PowerMixin getPowerMixin() { return PowerMixin.get(); }
|
||||||
public PowerMixin getPowerMixin() { return this.powerMixin == null ? PowerMixinDefault.get() : this.powerMixin; }
|
@Deprecated public void setPowerMixin(PowerMixin powerMixin) { PowerMixin.get().setInstance(powerMixin); }
|
||||||
public void setPowerMixin(PowerMixin powerMixin) { this.powerMixin = powerMixin; }
|
|
||||||
|
|
||||||
// Gson without preprocessors
|
// Gson without preprocessors
|
||||||
public final Gson gsonWithoutPreprocessors = this.getGsonBuilderWithoutPreprocessors().create();
|
public final Gson gsonWithoutPreprocessors = this.getGsonBuilderWithoutPreprocessors().create();
|
||||||
|
@ -22,6 +22,7 @@ import com.massivecraft.factions.event.EventFactionsDisband;
|
|||||||
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
import com.massivecraft.factions.event.EventFactionsMembershipChange;
|
||||||
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
|
import com.massivecraft.factions.event.EventFactionsRemovePlayerMillis;
|
||||||
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
import com.massivecraft.factions.event.EventFactionsMembershipChange.MembershipChangeReason;
|
||||||
|
import com.massivecraft.factions.mixin.PowerMixin;
|
||||||
import com.massivecraft.factions.util.RelationUtil;
|
import com.massivecraft.factions.util.RelationUtil;
|
||||||
import com.massivecraft.massivecore.mixin.MixinSenderPs;
|
import com.massivecraft.massivecore.mixin.MixinSenderPs;
|
||||||
import com.massivecraft.massivecore.mixin.MixinTitle;
|
import com.massivecraft.massivecore.mixin.MixinTitle;
|
||||||
@ -428,27 +429,27 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
|
|||||||
|
|
||||||
public double getPowerMaxUniversal()
|
public double getPowerMaxUniversal()
|
||||||
{
|
{
|
||||||
return Factions.get().getPowerMixin().getMaxUniversal(this);
|
return PowerMixin.get().getMaxUniversal(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPowerMax()
|
public double getPowerMax()
|
||||||
{
|
{
|
||||||
return Factions.get().getPowerMixin().getMax(this);
|
return PowerMixin.get().getMax(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPowerMin()
|
public double getPowerMin()
|
||||||
{
|
{
|
||||||
return Factions.get().getPowerMixin().getMin(this);
|
return PowerMixin.get().getMin(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPowerPerHour()
|
public double getPowerPerHour()
|
||||||
{
|
{
|
||||||
return Factions.get().getPowerMixin().getPerHour(this);
|
return PowerMixin.get().getPerHour(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getPowerPerDeath()
|
public double getPowerPerDeath()
|
||||||
{
|
{
|
||||||
return Factions.get().getPowerMixin().getPerDeath(this);
|
return PowerMixin.get().getPerDeath(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MIXIN: FINER
|
// MIXIN: FINER
|
||||||
|
@ -1,12 +1,46 @@
|
|||||||
package com.massivecraft.factions.mixin;
|
package com.massivecraft.factions.mixin;
|
||||||
|
|
||||||
|
import com.massivecraft.factions.entity.MConf;
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
import com.massivecraft.factions.entity.MPlayer;
|
||||||
|
import com.massivecraft.massivecore.mixin.Mixin;
|
||||||
|
|
||||||
public interface PowerMixin
|
public class PowerMixin extends Mixin
|
||||||
{
|
{
|
||||||
public double getMaxUniversal(MPlayer mplayer);
|
// -------------------------------------------- //
|
||||||
public double getMax(MPlayer mplayer);
|
// INSTANCE & CONSTRUCT
|
||||||
public double getMin(MPlayer mplayer);
|
// -------------------------------------------- //
|
||||||
public double getPerHour(MPlayer mplayer);
|
|
||||||
public double getPerDeath(MPlayer mplayer);
|
private static PowerMixin d = new PowerMixin();
|
||||||
|
private static PowerMixin i = d;
|
||||||
|
public static PowerMixin get() { return i; }
|
||||||
|
|
||||||
|
// -------------------------------------------- //
|
||||||
|
// METHODS
|
||||||
|
// -------------------------------------------- //
|
||||||
|
|
||||||
|
public double getMaxUniversal(MPlayer mplayer)
|
||||||
|
{
|
||||||
|
return this.getMax(mplayer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMax(MPlayer mplayer)
|
||||||
|
{
|
||||||
|
return MConf.get().powerMax + mplayer.getPowerBoost();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getMin(MPlayer mplayer)
|
||||||
|
{
|
||||||
|
return MConf.get().powerMin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPerHour(MPlayer mplayer)
|
||||||
|
{
|
||||||
|
return MConf.get().powerPerHour;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPerDeath(MPlayer mplayer)
|
||||||
|
{
|
||||||
|
return MConf.get().powerPerDeath;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
package com.massivecraft.factions.mixin;
|
|
||||||
|
|
||||||
import com.massivecraft.factions.entity.MConf;
|
|
||||||
import com.massivecraft.factions.entity.MPlayer;
|
|
||||||
|
|
||||||
public class PowerMixinDefault implements PowerMixin
|
|
||||||
{
|
|
||||||
// -------------------------------------------- //
|
|
||||||
// INSTANCE & CONSTRUCT
|
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
private static PowerMixinDefault i = new PowerMixinDefault();
|
|
||||||
public static PowerMixinDefault get() { return i; }
|
|
||||||
|
|
||||||
// -------------------------------------------- //
|
|
||||||
// OVERRIDE: PowerMixin
|
|
||||||
// -------------------------------------------- //
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxUniversal(MPlayer mplayer)
|
|
||||||
{
|
|
||||||
return this.getMax(mplayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMax(MPlayer mplayer)
|
|
||||||
{
|
|
||||||
return MConf.get().powerMax + mplayer.getPowerBoost();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMin(MPlayer mplayer)
|
|
||||||
{
|
|
||||||
return MConf.get().powerMin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getPerHour(MPlayer mplayer)
|
|
||||||
{
|
|
||||||
return MConf.get().powerPerHour;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getPerDeath(MPlayer mplayer)
|
|
||||||
{
|
|
||||||
return MConf.get().powerPerDeath;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user