MassiveCore - MassivePlugin and Active

This commit is contained in:
Olof Larsson 2016-02-25 22:28:09 +01:00
parent ce6a98e27d
commit 1f5e591ce6
38 changed files with 234 additions and 361 deletions

View File

@ -36,10 +36,10 @@ import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.factions.entity.MConfColl; import com.massivecraft.factions.entity.MConfColl;
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.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.mixin.PowerMixinDefault;
import com.massivecraft.factions.spigot.SpigotFeatures;
import com.massivecraft.factions.task.TaskFlagPermCreate; import com.massivecraft.factions.task.TaskFlagPermCreate;
import com.massivecraft.factions.task.TaskPlayerDataRemove; import com.massivecraft.factions.task.TaskPlayerDataRemove;
import com.massivecraft.factions.task.TaskEconLandReward; import com.massivecraft.factions.task.TaskEconLandReward;
@ -75,16 +75,18 @@ public class Factions extends MassivePlugin
private static Factions i; private static Factions i;
public static Factions get() { return i; } public static Factions get() { return i; }
public Factions() { Factions.i = this; } public Factions()
{
Factions.i = this;
// Version Synchronized
this.setVersionSynchronized(true);
}
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //
// Commands
private CmdFactions outerCmdFactions;
public CmdFactions getOuterCmdFactions() { return this.outerCmdFactions; }
// Aspects // Aspects
// TODO: Remove in the future when the update has been removed. // TODO: Remove in the future when the update has been removed.
private Aspect aspect; private Aspect aspect;
@ -108,13 +110,8 @@ public class Factions extends MassivePlugin
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void onEnable() public void onEnableInner()
{ {
if ( ! preEnable()) return;
// Version Synchronized
this.setVersionSynchronized(true);
// Initialize Aspects // Initialize Aspects
this.aspect = AspectColl.get().get(Const.ASPECT, true); this.aspect = AspectColl.get().get(Const.ASPECT, true);
this.aspect.register(); this.aspect.register();
@ -129,47 +126,47 @@ public class Factions extends MassivePlugin
// Initialize Database // Initialize Database
this.databaseInitialized = false; this.databaseInitialized = false;
MFlagColl.get().init(); MFlagColl.get().setActive(true);
MPermColl.get().init(); MPermColl.get().setActive(true);
MConfColl.get().init(); MConfColl.get().setActive(true);
UpdateUtil.update(); UpdateUtil.update();
MPlayerColl.get().init(); MPlayerColl.get().setActive(true);
FactionColl.get().init(); FactionColl.get().setActive(true);
BoardColl.get().init(); BoardColl.get().setActive(true);
UpdateUtil.updateSpecialIds(); UpdateUtil.updateSpecialIds();
FactionColl.get().reindexMPlayers(); FactionColl.get().reindexMPlayers();
this.databaseInitialized = true; this.databaseInitialized = true;
// Commands // Activate
this.outerCmdFactions = new CmdFactions(); this.activate(
this.outerCmdFactions.register(this); // Command
CmdFactions.get(),
// Engines // Engines
EngineMain.get().activate(); EngineMain.get(),
EngineChat.get().activate(); EngineChat.get(),
EngineExploit.get().activate(); EngineExploit.get(),
EngineSeeChunk.get().activate(); EngineSeeChunk.get(),
EngineEcon.get().activate(); // TODO: Take an extra look and make sure all economy stuff is handled using events. EngineEcon.get(), // TODO: Take an extra look and make sure all economy stuff is handled using events.
// Integrate // Integrate
this.integrate(
IntegrationHerochat.get(), IntegrationHerochat.get(),
IntegrationLwc.get(), IntegrationLwc.get(),
IntegrationWorldGuard.get() IntegrationWorldGuard.get(),
);
// Spigot // Spigot
SpigotFeatures.activate(); IntegrationSpigot.get(),
// Modulo Repeat Tasks // Modulo Repeat Tasks
TaskPlayerPowerUpdate.get().activate(); TaskPlayerPowerUpdate.get(),
TaskPlayerDataRemove.get().activate(); TaskPlayerDataRemove.get(),
TaskEconLandReward.get().activate(); TaskEconLandReward.get(),
TaskFlagPermCreate.get().activate(); TaskFlagPermCreate.get()
);
// Register built in chat modifiers // Register built in chat modifiers
ChatModifierLc.get().register(); ChatModifierLc.get().register();

View File

@ -10,6 +10,13 @@ import com.massivecraft.massivecore.command.VersionCommand;
public class CmdFactions extends FactionsCommand public class CmdFactions extends FactionsCommand
{ {
// -------------------------------------------- //
// INSTANCE
// -------------------------------------------- //
private static CmdFactions i = new CmdFactions();
public static CmdFactions get() { return i; }
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -84,7 +84,7 @@ public class CmdFactionsCreate extends FactionsCommand
// Inform // Inform
msg("<i>You created the faction %s", faction.getName(msender)); msg("<i>You created the faction %s", faction.getName(msender));
message(Mson.mson(mson("You should now: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsDescription.getTemplate())); message(Mson.mson(mson("You should now: ").color(ChatColor.YELLOW), CmdFactions.get().cmdFactionsDescription.getTemplate()));
// Log // Log
if (MConf.get().logFactionCreate) if (MConf.get().logFactionCreate)

View File

@ -4,7 +4,6 @@ import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.factions.cmd.type.TypeFaction;
@ -73,7 +72,7 @@ public class CmdFactionsHome extends FactionsCommandHome
if (MPerm.getPermSethome().has(msender, faction, false)) if (MPerm.getPermSethome().has(msender, faction, false))
{ {
msender.msg("<i>You should:"); msender.msg("<i>You should:");
msender.message(Factions.get().getOuterCmdFactions().cmdFactionsSethome.getTemplate()); msender.message(CmdFactions.get().cmdFactionsSethome.getTemplate());
} }
return; return;

View File

@ -4,7 +4,6 @@ import java.util.Collection;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.type.TypeMPlayer; import com.massivecraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
@ -77,7 +76,7 @@ public class CmdFactionsInviteAdd extends FactionsCommand
else else
{ {
// Mson // Mson
String command = Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteRemove.getCommandLine(mplayer.getName()); String command = CmdFactions.get().cmdFactionsInvite.cmdFactionsInviteRemove.getCommandLine(mplayer.getName());
String tooltip = Txt.parse("<i>Click to <c>%s<i>.", command); String tooltip = Txt.parse("<i>Click to <c>%s<i>.", command);
Mson remove = Mson.mson( Mson remove = Mson.mson(

View File

@ -7,7 +7,6 @@ import java.util.Set;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.type.TypeMPlayer; import com.massivecraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
@ -73,7 +72,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
if (mplayer.getFaction() == msenderFaction) if (mplayer.getFaction() == msenderFaction)
{ {
// Mson // Mson
String command = Factions.get().getOuterCmdFactions().cmdFactionsKick.getCommandLine(mplayer.getName()); String command = CmdFactions.get().cmdFactionsKick.getCommandLine(mplayer.getName());
String tooltip = Txt.parse("Click to <c>%s<i>.", command); String tooltip = Txt.parse("Click to <c>%s<i>.", command);
Mson kick = Mson.mson( Mson kick = Mson.mson(
@ -116,7 +115,7 @@ public class CmdFactionsInviteRemove extends FactionsCommand
else else
{ {
// Mson // Mson
String command = Factions.get().getOuterCmdFactions().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName()); String command = CmdFactions.get().cmdFactionsInvite.cmdFactionsInviteAdd.getCommandLine(mplayer.getName());
String tooltip = Txt.parse("Click to <c>%s<i>.", command); String tooltip = Txt.parse("Click to <c>%s<i>.", command);
Mson invite = Mson.mson( Mson invite = Mson.mson(

View File

@ -60,7 +60,7 @@ public class CmdFactionsJoin extends FactionsCommand
if (faction == mplayerFaction) if (faction == mplayerFaction)
{ {
String command = Factions.get().getOuterCmdFactions().cmdFactionsKick.getCommandLine(mplayer.getName()); String command = CmdFactions.get().cmdFactionsKick.getCommandLine(mplayer.getName());
// Mson creation // Mson creation
Mson alreadyMember = Mson.mson( Mson alreadyMember = Mson.mson(
@ -80,7 +80,7 @@ public class CmdFactionsJoin extends FactionsCommand
if (mplayerFaction.isNormal()) if (mplayerFaction.isNormal())
{ {
String command = Factions.get().getOuterCmdFactions().cmdFactionsLeave.getCommandLine(mplayer.getName()); String command = CmdFactions.get().cmdFactionsLeave.getCommandLine(mplayer.getName());
// Mson creation // Mson creation
Mson leaveFirst = Mson.mson( Mson leaveFirst = Mson.mson(

View File

@ -49,7 +49,7 @@ public class CmdFactionsKick extends FactionsCommand
if (msender == mplayer) if (msender == mplayer)
{ {
msg("<b>You can't kick yourself."); msg("<b>You can't kick yourself.");
message(mson(mson("You might want to: ").color(ChatColor.YELLOW), Factions.get().getOuterCmdFactions().cmdFactionsLeave.getTemplate(false))); message(mson(mson("You might want to: ").color(ChatColor.YELLOW), CmdFactions.get().cmdFactionsLeave.getTemplate(false)));
return; return;
} }

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.cmd.type.TypeMPlayer; import com.massivecraft.factions.cmd.type.TypeMPlayer;
import com.massivecraft.massivecore.command.Visibility; import com.massivecraft.massivecore.command.Visibility;
@ -41,7 +40,7 @@ public class CmdFactionsRankOld extends FactionsCommand
@Override @Override
public void perform() public void perform()
{ {
Factions.get().getOuterCmdFactions().cmdFactionsRank.execute(sender, MUtil.list(this.argAt(0), this.rankName, this.argAt(1))); CmdFactions.get().cmdFactionsRank.execute(sender, MUtil.list(this.argAt(0), this.rankName, this.argAt(1)));
} }
} }

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqHasFaction; import com.massivecraft.factions.cmd.req.ReqHasFaction;
@ -88,10 +87,10 @@ public abstract class CmdFactionsRelationAbstract extends FactionsCommand
else else
{ {
MassiveCommand relationshipCommand = null; MassiveCommand relationshipCommand = null;
if (newRelation.equals(Rel.NEUTRAL)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationNeutral; if (newRelation.equals(Rel.NEUTRAL)) relationshipCommand = CmdFactions.get().cmdFactionsRelationNeutral;
else if (newRelation.equals(Rel.TRUCE)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationTruce; else if (newRelation.equals(Rel.TRUCE)) relationshipCommand = CmdFactions.get().cmdFactionsRelationTruce;
else if (newRelation.equals(Rel.ALLY)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationAlly; else if (newRelation.equals(Rel.ALLY)) relationshipCommand = CmdFactions.get().cmdFactionsRelationAlly;
else if (newRelation.equals(Rel.ENEMY)) relationshipCommand = Factions.get().getOuterCmdFactions().cmdFactionsRelationEnemy; else if (newRelation.equals(Rel.ENEMY)) relationshipCommand = CmdFactions.get().cmdFactionsRelationEnemy;
String command = relationshipCommand.getCommandLine(msenderFaction.getName()); String command = relationshipCommand.getCommandLine(msenderFaction.getName());
String tooltip = Txt.parse("<g>Click to <c>%s<i>.", command); String tooltip = Txt.parse("<g>Click to <c>%s<i>.", command);

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions.cmd; package com.massivecraft.factions.cmd;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.type.TypeFaction; import com.massivecraft.factions.cmd.type.TypeFaction;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
@ -63,7 +62,7 @@ public class CmdFactionsSethome extends FactionsCommandHome
// Inform // Inform
faction.msg("%s<i> set the home for your faction. You can now use:", msender.describeTo(msenderFaction, true)); faction.msg("%s<i> set the home for your faction. You can now use:", msender.describeTo(msenderFaction, true));
faction.sendMessage(Factions.get().getOuterCmdFactions().cmdFactionsHome.getTemplate()); faction.sendMessage(CmdFactions.get().cmdFactionsHome.getTemplate());
if (faction != msenderFaction) if (faction != msenderFaction)
{ {
msender.msg("<i>You have set the home for " + faction.getName(msender) + "<i>."); msender.msg("<i>You have set the home for " + faction.getName(msender) + "<i>.");

View File

@ -8,16 +8,15 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.EventExecutor; import org.bukkit.plugin.EventExecutor;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.chat.ChatFormatter;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat; import com.massivecraft.massivecore.event.EventMassiveCorePlayerToRecipientChat;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class EngineChat extends EngineAbstract public class EngineChat extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -25,21 +24,19 @@ public class EngineChat extends EngineAbstract
private static EngineChat i = new EngineChat(); private static EngineChat i = new EngineChat();
public static EngineChat get() { return i; } public static EngineChat get() { return i; }
public EngineChat()
{
this.setPlugin(Factions.get());
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Plugin getPlugin() public void setActiveInner(boolean active)
{ {
return Factions.get(); if ( ! active) return;
}
@Override
public void activate()
{
super.activate();
if (MConf.get().chatSetFormat) if (MConf.get().chatSetFormat)
{ {

View File

@ -7,9 +7,9 @@ import java.util.Set;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions; import com.massivecraft.factions.Factions;
import com.massivecraft.factions.cmd.CmdFactions;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
@ -29,12 +29,12 @@ import com.massivecraft.factions.event.EventFactionsFlagChange;
import com.massivecraft.factions.event.EventFactionsRelationChange; import com.massivecraft.factions.event.EventFactionsRelationChange;
import com.massivecraft.factions.event.EventFactionsTitleChange; import com.massivecraft.factions.event.EventFactionsTitleChange;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.money.Money; import com.massivecraft.massivecore.money.Money;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class EngineEcon extends EngineAbstract public class EngineEcon extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -42,17 +42,6 @@ public class EngineEcon extends EngineAbstract
private static EngineEcon i = new EngineEcon(); private static EngineEcon i = new EngineEcon();
public static EngineEcon get() { return i; } public static EngineEcon get() { return i; }
public EngineEcon() {}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
// -------------------------------------------- // // -------------------------------------------- //
// TAKE ON LEAVE // TAKE ON LEAVE
@ -180,7 +169,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsRelationChange event) public void payForCommand(EventFactionsRelationChange event)
{ {
Double cost = MConf.get().econRelCost.get(event.getNewRelation()); Double cost = MConf.get().econRelCost.get(event.getNewRelation());
String desc = Factions.get().getOuterCmdFactions().cmdFactionsRelationNeutral.getDesc(); String desc = CmdFactions.get().cmdFactionsRelationNeutral.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -189,7 +178,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsHomeChange event) public void payForCommand(EventFactionsHomeChange event)
{ {
Double cost = MConf.get().econCostSethome; Double cost = MConf.get().econCostSethome;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsSethome.getDesc(); String desc = CmdFactions.get().cmdFactionsSethome.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -198,7 +187,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsCreate event) public void payForCommand(EventFactionsCreate event)
{ {
Double cost = MConf.get().econCostCreate; Double cost = MConf.get().econCostCreate;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsCreate.getDesc(); String desc = CmdFactions.get().cmdFactionsCreate.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -207,7 +196,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsDescriptionChange event) public void payForCommand(EventFactionsDescriptionChange event)
{ {
Double cost = MConf.get().econCostDescription; Double cost = MConf.get().econCostDescription;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsDescription.getDesc(); String desc = CmdFactions.get().cmdFactionsDescription.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -216,7 +205,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsNameChange event) public void payForCommand(EventFactionsNameChange event)
{ {
Double cost = MConf.get().econCostName; Double cost = MConf.get().econCostName;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsName.getDesc(); String desc = CmdFactions.get().cmdFactionsName.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -225,7 +214,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsTitleChange event) public void payForCommand(EventFactionsTitleChange event)
{ {
Double cost = MConf.get().econCostTitle; Double cost = MConf.get().econCostTitle;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsTitle.getDesc(); String desc = CmdFactions.get().cmdFactionsTitle.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -234,7 +223,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsFlagChange event) public void payForCommand(EventFactionsFlagChange event)
{ {
Double cost = MConf.get().econCostFlag; Double cost = MConf.get().econCostFlag;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsFlag.getDesc(); String desc = CmdFactions.get().cmdFactionsFlag.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -243,7 +232,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsInvitedChange event) public void payForCommand(EventFactionsInvitedChange event)
{ {
Double cost = event.isNewInvited() ? MConf.get().econCostInvite : MConf.get().econCostDeinvite; Double cost = event.isNewInvited() ? MConf.get().econCostInvite : MConf.get().econCostDeinvite;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsInvite.getDesc(); String desc = CmdFactions.get().cmdFactionsInvite.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }
@ -252,7 +241,7 @@ public class EngineEcon extends EngineAbstract
public void payForCommand(EventFactionsHomeTeleport event) public void payForCommand(EventFactionsHomeTeleport event)
{ {
Double cost = MConf.get().econCostHome; Double cost = MConf.get().econCostHome;
String desc = Factions.get().getOuterCmdFactions().cmdFactionsHome.getDesc(); String desc = CmdFactions.get().cmdFactionsHome.getDesc();
payForAction(event, cost, desc); payForAction(event, cost, desc);
} }

View File

@ -15,18 +15,16 @@ import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class EngineExploit extends EngineAbstract public class EngineExploit extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -35,16 +33,6 @@ public class EngineExploit extends EngineAbstract
private static EngineExploit i = new EngineExploit(); private static EngineExploit i = new EngineExploit();
public static EngineExploit get() { return i; } public static EngineExploit get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
// -------------------------------------------- // // -------------------------------------------- //
// OBSIDIAN GENERATORS // OBSIDIAN GENERATORS
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -65,7 +65,6 @@ import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import com.massivecraft.factions.Const; import com.massivecraft.factions.Const;
@ -89,9 +88,9 @@ import com.massivecraft.factions.event.EventFactionsPowerChange;
import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason; import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason;
import com.massivecraft.factions.event.EventFactionsPvpDisallowed; import com.massivecraft.factions.event.EventFactionsPvpDisallowed;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.spigot.SpigotFeatures; import com.massivecraft.factions.integration.spigot.IntegrationSpigot;
import com.massivecraft.factions.util.VisualizeUtil; import com.massivecraft.factions.util.VisualizeUtil;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.PriorityLines; import com.massivecraft.massivecore.PriorityLines;
import com.massivecraft.massivecore.collections.MassiveSet; import com.massivecraft.massivecore.collections.MassiveSet;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
@ -104,7 +103,7 @@ import com.massivecraft.massivecore.util.TimeDiffUtil;
import com.massivecraft.massivecore.util.TimeUnit; import com.massivecraft.massivecore.util.TimeUnit;
import com.massivecraft.massivecore.util.Txt; import com.massivecraft.massivecore.util.Txt;
public class EngineMain extends EngineAbstract public class EngineMain extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -112,17 +111,6 @@ public class EngineMain extends EngineAbstract
private static EngineMain i = new EngineMain(); private static EngineMain i = new EngineMain();
public static EngineMain get() { return i; } public static EngineMain get() { return i; }
public EngineMain() {}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
// -------------------------------------------- // // -------------------------------------------- //
// CONSTANTS // CONSTANTS
@ -1462,7 +1450,7 @@ public class EngineMain extends EngineAbstract
public void blockBuild(BlockPistonExtendEvent event) public void blockBuild(BlockPistonExtendEvent event)
{ {
// Is using Spigot or is checking deactivated by MConf? // Is using Spigot or is checking deactivated by MConf?
if (SpigotFeatures.isActive() || ! MConf.get().handlePistonProtectionThroughDenyBuild) return; if (IntegrationSpigot.get().isIntegrationActive() || ! MConf.get().handlePistonProtectionThroughDenyBuild) return;
Block block = event.getBlock(); Block block = event.getBlock();
@ -1494,7 +1482,7 @@ public class EngineMain extends EngineAbstract
public void blockBuild(BlockPistonRetractEvent event) public void blockBuild(BlockPistonRetractEvent event)
{ {
// Is using Spigot or is checking deactivated by MConf? // Is using Spigot or is checking deactivated by MConf?
if (SpigotFeatures.isActive() || ! MConf.get().handlePistonProtectionThroughDenyBuild) return; if (IntegrationSpigot.get().isIntegrationActive() || ! MConf.get().handlePistonProtectionThroughDenyBuild) return;
// If not a sticky piston, retraction should be fine // If not a sticky piston, retraction should be fine
if ( ! event.isSticky()) return; if ( ! event.isSticky()) return;

View File

@ -10,19 +10,16 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave; import com.massivecraft.massivecore.event.EventMassiveCorePlayerLeave;
import com.massivecraft.massivecore.particleeffect.ParticleEffect; import com.massivecraft.massivecore.particleeffect.ParticleEffect;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PeriodUtil; import com.massivecraft.massivecore.util.PeriodUtil;
public class EngineSeeChunk extends EngineAbstract public class EngineSeeChunk extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -30,22 +27,9 @@ public class EngineSeeChunk extends EngineAbstract
private static EngineSeeChunk i = new EngineSeeChunk(); private static EngineSeeChunk i = new EngineSeeChunk();
public static EngineSeeChunk get() { return i; } public static EngineSeeChunk get() { return i; }
public EngineSeeChunk() {} public EngineSeeChunk()
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{ {
return Factions.get(); this.setPeriod(1L);
}
@Override
public Long getPeriod()
{
return 1L;
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -39,9 +39,11 @@ public class FactionColl extends Coll<Faction>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void init() public void setActive(boolean active)
{ {
super.init(); super.setActive(active);
if ( ! active) return;
this.createSpecialFactions(); this.createSpecialFactions();
} }

View File

@ -42,8 +42,8 @@ public class MConf extends Entity<MConf>
if (!Factions.get().isDatabaseInitialized()) return this; if (!Factions.get().isDatabaseInitialized()) return this;
EngineChat.get().deactivate(); EngineChat.get().setActive(false);
EngineChat.get().activate(); EngineChat.get().setActive(true);
return this; return this;
} }

View File

@ -34,9 +34,10 @@ public class MConfColl extends Coll<MConf>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void init() public void setActive(boolean active)
{ {
super.init(); super.setActive(active);
if ( ! active) return;
MConf.i = this.get(MassiveCore.INSTANCE, true); MConf.i = this.get(MassiveCore.INSTANCE, true);
} }

View File

@ -37,9 +37,10 @@ public class MFlagColl extends Coll<MFlag>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void init() public void setActive(boolean active)
{ {
super.init(); super.setActive(active);
if ( ! active) return;
MFlag.setupStandardFlags(); MFlag.setupStandardFlags();
} }

View File

@ -7,10 +7,10 @@ import java.util.Set;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm; import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel; import com.massivecraft.factions.Rel;
import com.massivecraft.factions.TerritoryAccess; import com.massivecraft.factions.TerritoryAccess;
import com.massivecraft.factions.cmd.CmdFactions;
import com.massivecraft.factions.event.EventFactionsCreatePerms; import com.massivecraft.factions.event.EventFactionsCreatePerms;
import com.massivecraft.massivecore.Named; import com.massivecraft.massivecore.Named;
import com.massivecraft.massivecore.Prioritized; import com.massivecraft.massivecore.Prioritized;
@ -298,7 +298,7 @@ public class MPerm extends Entity<MPerm> implements Prioritized, Registerable, N
Player player = mplayer.getPlayer(); Player player = mplayer.getPlayer();
if (player != null && Perm.OVERRIDE.has(player)) if (player != null && Perm.OVERRIDE.has(player))
{ {
ret += Txt.parse("\n<i>You can bypass by using " + Factions.get().getOuterCmdFactions().cmdFactionsOverride.getTemplate(false).toPlain(true)); ret += Txt.parse("\n<i>You can bypass by using " + CmdFactions.get().cmdFactionsOverride.getTemplate(false).toPlain(true));
} }
return ret; return ret;

View File

@ -37,9 +37,10 @@ public class MPermColl extends Coll<MPerm>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void init() public void setActive(boolean active)
{ {
super.init(); super.setActive(active);
if ( ! active) return;
MPerm.setupStandardPerms(); MPerm.setupStandardPerms();
} }

View File

@ -1,19 +1,14 @@
package com.massivecraft.factions.integration.herochat; package com.massivecraft.factions.integration.herochat;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import com.dthielke.herochat.ChannelChatEvent; import com.dthielke.herochat.ChannelChatEvent;
import com.dthielke.herochat.Herochat; import com.dthielke.herochat.Herochat;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.chat.ChatFormatter; import com.massivecraft.factions.chat.ChatFormatter;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.Engine;
public class EngineHerochat extends Engine
public class EngineHerochat implements Listener
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -21,23 +16,18 @@ public class EngineHerochat implements Listener
private static EngineHerochat i = new EngineHerochat(); private static EngineHerochat i = new EngineHerochat();
public static EngineHerochat get() { return i; } public static EngineHerochat get() { return i; }
private EngineHerochat() {}
// -------------------------------------------- // // -------------------------------------------- //
// ACTIVATE & DEACTIVATE // ACTIVATE & DEACTIVATE
// -------------------------------------------- // // -------------------------------------------- //
public void activate() @Override
public void setActiveInner(boolean active)
{ {
if ( ! active) return;
Herochat.getChannelManager().addChannel(new ChannelFactionsFaction()); Herochat.getChannelManager().addChannel(new ChannelFactionsFaction());
Herochat.getChannelManager().addChannel(new ChannelFactionsAllies()); Herochat.getChannelManager().addChannel(new ChannelFactionsAllies());
Bukkit.getPluginManager().registerEvents(this, Factions.get());
}
public void deactivate()
{
HandlerList.unregisterAll(this);
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -1,8 +1,9 @@
package com.massivecraft.factions.integration.herochat; package com.massivecraft.factions.integration.herochat;
import com.massivecraft.massivecore.integration.IntegrationAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.Integration;
public class IntegrationHerochat extends IntegrationAbstract public class IntegrationHerochat extends Integration
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -10,22 +11,19 @@ public class IntegrationHerochat extends IntegrationAbstract
private static IntegrationHerochat i = new IntegrationHerochat(); private static IntegrationHerochat i = new IntegrationHerochat();
public static IntegrationHerochat get() { return i; } public static IntegrationHerochat get() { return i; }
private IntegrationHerochat() { super("Herochat"); } private IntegrationHerochat()
{
this.setPluginName("HeroChat");
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void activate() public Engine getEngine()
{ {
EngineHerochat.get().activate(); return EngineHerochat.get();
}
@Override
public void deactivate()
{
EngineHerochat.get().deactivate();
} }
} }

View File

@ -8,7 +8,6 @@ import java.util.Set;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin;
import com.griefcraft.lwc.LWC; import com.griefcraft.lwc.LWC;
import com.griefcraft.model.Protection; import com.griefcraft.model.Protection;
@ -19,12 +18,12 @@ import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsChunksChange; import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.factions.event.EventFactionsChunkChangeType; import com.massivecraft.factions.event.EventFactionsChunkChangeType;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.IdUtil; import com.massivecraft.massivecore.util.IdUtil;
public class EngineLwc extends EngineAbstract public class EngineLwc extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -32,31 +31,23 @@ public class EngineLwc extends EngineAbstract
private static EngineLwc i = new EngineLwc(); private static EngineLwc i = new EngineLwc();
public static EngineLwc get() { return i; } public static EngineLwc get() { return i; }
private EngineLwc() {}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Plugin getPlugin() public void setActiveInner(boolean active)
{ {
return Factions.get(); if (active)
}
@Override
public void activate()
{ {
super.activate();
LWC.getInstance().getModuleLoader().registerModule(Factions.get(), new FactionsLwcModule(Factions.get())); LWC.getInstance().getModuleLoader().registerModule(Factions.get(), new FactionsLwcModule(Factions.get()));
} }
else
@Override
public void deactivate()
{ {
super.deactivate();
LWC.getInstance().getModuleLoader().removeModules(Factions.get()); LWC.getInstance().getModuleLoader().removeModules(Factions.get());
} }
}
// -------------------------------------------- // // -------------------------------------------- //
// LISTENER // LISTENER

View File

@ -1,8 +1,9 @@
package com.massivecraft.factions.integration.lwc; package com.massivecraft.factions.integration.lwc;
import com.massivecraft.massivecore.integration.IntegrationAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.Integration;
public class IntegrationLwc extends IntegrationAbstract public class IntegrationLwc extends Integration
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -10,22 +11,19 @@ public class IntegrationLwc extends IntegrationAbstract
private static IntegrationLwc i = new IntegrationLwc(); private static IntegrationLwc i = new IntegrationLwc();
public static IntegrationLwc get() { return i; } public static IntegrationLwc get() { return i; }
private IntegrationLwc() { super("LWC"); } private IntegrationLwc()
{
this.setPluginName("LWC");
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void activate() public Engine getEngine()
{ {
EngineLwc.get().activate(); return EngineLwc.get();
}
@Override
public void deactivate()
{
EngineLwc.get().deactivate();
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.factions.spigot; package com.massivecraft.factions.integration.spigot;
import java.util.List; import java.util.List;
@ -11,20 +11,17 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockPistonExtendEvent; import org.bukkit.event.block.BlockPistonExtendEvent;
import org.bukkit.event.block.BlockPistonRetractEvent; import org.bukkit.event.block.BlockPistonRetractEvent;
import org.bukkit.event.player.PlayerInteractAtEntityEvent; import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.engine.EngineMain; import com.massivecraft.factions.engine.EngineMain;
import com.massivecraft.factions.entity.BoardColl; import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction; import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
public class EngineSpigot extends EngineAbstract public class EngineSpigot extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -32,31 +29,6 @@ public class EngineSpigot extends EngineAbstract
private static EngineSpigot i = new EngineSpigot(); private static EngineSpigot i = new EngineSpigot();
public static EngineSpigot get() { return i; } public static EngineSpigot get() { return i; }
private EngineSpigot() {}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
@Override
public void activate()
{
super.activate();
SpigotFeatures.setActive(true);
}
@Override
public void deactivate()
{
super.deactivate();
SpigotFeatures.setActive(false);
}
// -------------------------------------------- // // -------------------------------------------- //
// LISTENER // LISTENER

View File

@ -0,0 +1,29 @@
package com.massivecraft.factions.integration.spigot;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.Integration;
public class IntegrationSpigot extends Integration
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static IntegrationSpigot i = new IntegrationSpigot();
public static IntegrationSpigot get() { return i; }
private IntegrationSpigot()
{
this.setPredicate(PredicateSpigot.get());
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Engine getEngine()
{
return EngineSpigot.get();
}
}

View File

@ -0,0 +1,37 @@
package com.massivecraft.factions.integration.spigot;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
import com.massivecraft.massivecore.Integration;
import com.massivecraft.massivecore.predicate.Predicate;
public class PredicateSpigot implements Predicate<Integration>
{
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
private static PredicateSpigot i = new PredicateSpigot();
public static PredicateSpigot get() { return i; }
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public boolean apply(Integration integration)
{
try
{
// This line will throw if the class does not exist.
PlayerInteractAtEntityEvent.class.getName();
return true;
}
catch (Throwable t)
{
return false;
}
}
}

View File

@ -7,14 +7,11 @@ import java.util.Map;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsChunksChange; import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.massivecore.EngineAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS; import com.massivecraft.massivecore.ps.PS;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin; import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
@ -22,7 +19,7 @@ import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion; import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
import com.sk89q.worldguard.protection.regions.ProtectedRegion; import com.sk89q.worldguard.protection.regions.ProtectedRegion;
public class EngineWorldGuard extends EngineAbstract public class EngineWorldGuard extends Engine
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -30,7 +27,6 @@ public class EngineWorldGuard extends EngineAbstract
private static EngineWorldGuard i = new EngineWorldGuard(); private static EngineWorldGuard i = new EngineWorldGuard();
public static EngineWorldGuard get() { return i; } public static EngineWorldGuard get() { return i; }
private EngineWorldGuard() {}
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -43,25 +39,16 @@ public class EngineWorldGuard extends EngineAbstract
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public Plugin getPlugin() public void setActiveInner(boolean active)
{ {
return Factions.get(); if (active)
}
@Override
public void activate()
{ {
this.worldGuard = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard"); this.worldGuard = (WorldGuardPlugin) Bukkit.getPluginManager().getPlugin("WorldGuard");
super.activate();
} }
else
@Override
public void deactivate()
{ {
this.worldGuard = null; this.worldGuard = null;
}
super.deactivate();
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -1,8 +1,9 @@
package com.massivecraft.factions.integration.worldguard; package com.massivecraft.factions.integration.worldguard;
import com.massivecraft.massivecore.integration.IntegrationAbstract; import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.Integration;
public class IntegrationWorldGuard extends IntegrationAbstract public class IntegrationWorldGuard extends Integration
{ {
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
@ -10,22 +11,19 @@ public class IntegrationWorldGuard extends IntegrationAbstract
private static IntegrationWorldGuard i = new IntegrationWorldGuard(); private static IntegrationWorldGuard i = new IntegrationWorldGuard();
public static IntegrationWorldGuard get() { return i; } public static IntegrationWorldGuard get() { return i; }
private IntegrationWorldGuard() { super("WorldGuard"); } private IntegrationWorldGuard()
{
this.setPluginName("WorldGuard");
}
// -------------------------------------------- // // -------------------------------------------- //
// OVERRIDE // OVERRIDE
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void activate() public Engine getEngine()
{ {
EngineWorldGuard.get().activate(); return EngineWorldGuard.get();
}
@Override
public void deactivate()
{
EngineWorldGuard.get().deactivate();
} }
} }

View File

@ -1,37 +0,0 @@
package com.massivecraft.factions.spigot;
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
public class SpigotFeatures
{
// -------------------------------------------- //
// STATIC FIELDS
// -------------------------------------------- //
// The "active" field is set from inside the EngineSpigot
private static boolean active = false;
public static boolean isActive() { return active; }
public static void setActive(boolean active) { SpigotFeatures.active = active; }
// -------------------------------------------- //
// ACTIVATE
// -------------------------------------------- //
public static void activate()
{
try
{
// This line will throw if the class does not exist.
PlayerInteractAtEntityEvent.class.getName();
// But if the event class exists we activate.
EngineSpigot.get().activate();
}
catch (Throwable t)
{
// ignored
}
}
}

View File

@ -1,8 +1,5 @@
package com.massivecraft.factions.task; package com.massivecraft.factions.task;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.FactionColl; import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
@ -18,16 +15,6 @@ public class TaskEconLandReward extends ModuloRepeatTask
private static TaskEconLandReward i = new TaskEconLandReward(); private static TaskEconLandReward i = new TaskEconLandReward();
public static TaskEconLandReward get() { return i; } public static TaskEconLandReward get() { return i; }
// -------------------------------------------- //
// OVERRIDE: MODULO REPEAT TASK
// -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
@Override @Override
public long getDelayMillis() public long getDelayMillis()
{ {

View File

@ -1,8 +1,5 @@
package com.massivecraft.factions.task; package com.massivecraft.factions.task;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MFlag; import com.massivecraft.factions.entity.MFlag;
import com.massivecraft.factions.entity.MPerm; import com.massivecraft.factions.entity.MPerm;
import com.massivecraft.massivecore.ModuloRepeatTask; import com.massivecraft.massivecore.ModuloRepeatTask;
@ -21,12 +18,6 @@ public class TaskFlagPermCreate extends ModuloRepeatTask
// OVERRIDE: MODULO REPEAT TASK // OVERRIDE: MODULO REPEAT TASK
// -------------------------------------------- // // -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
@Override @Override
public long getDelayMillis() public long getDelayMillis()
{ {

View File

@ -1,8 +1,5 @@
package com.massivecraft.factions.task; package com.massivecraft.factions.task;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayerColl; import com.massivecraft.factions.entity.MPlayerColl;
import com.massivecraft.massivecore.MassiveCore; import com.massivecraft.massivecore.MassiveCore;
@ -22,12 +19,6 @@ public class TaskPlayerDataRemove extends ModuloRepeatTask
// OVERRIDE: MODULO REPEAT TASK // OVERRIDE: MODULO REPEAT TASK
// -------------------------------------------- // // -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
@Override @Override
public long getDelayMillis() public long getDelayMillis()
{ {

View File

@ -1,9 +1,6 @@
package com.massivecraft.factions.task; package com.massivecraft.factions.task;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf; import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.entity.MPlayer; import com.massivecraft.factions.entity.MPlayer;
import com.massivecraft.factions.event.EventFactionsPowerChange; import com.massivecraft.factions.event.EventFactionsPowerChange;
@ -25,12 +22,6 @@ public class TaskPlayerPowerUpdate extends ModuloRepeatTask
// OVERRIDE: MODULO REPEAT TASK // OVERRIDE: MODULO REPEAT TASK
// -------------------------------------------- // // -------------------------------------------- //
@Override
public Plugin getPlugin()
{
return Factions.get();
}
@Override @Override
public long getDelayMillis() public long getDelayMillis()
{ {

View File

@ -21,9 +21,10 @@ public class OldConfColl extends Coll<OldConf>
// -------------------------------------------- // // -------------------------------------------- //
@Override @Override
public void init() public void setActive(boolean active)
{ {
super.init(); super.setActive(active);
if ( ! active) return;
this.get(MassiveCore.INSTANCE, true); this.get(MassiveCore.INSTANCE, true);
} }

View File

@ -48,7 +48,7 @@ public class UpdateUtil
Factions.get().log("Updating Database to New Version!"); Factions.get().log("Updating Database to New Version!");
// ... load the old uconf data ... // ... load the old uconf data ...
OldConfColls.get().init(); OldConfColls.get().setActive(true);
OldConf oldConf = OldConfColls.get().getForUniverse(universe).get(MassiveCore.INSTANCE, true); OldConf oldConf = OldConfColls.get().getForUniverse(universe).get(MassiveCore.INSTANCE, true);
// ... transfer the old uconf data over to the new mconf ... // ... transfer the old uconf data over to the new mconf ...