Moving more stuff and removing useless lwc integration config option.

This commit is contained in:
Olof Larsson 2013-04-22 10:05:03 +02:00
parent b0871b0ee6
commit e901cae995
18 changed files with 67 additions and 59 deletions

View File

@ -76,8 +76,6 @@ public class ConfServer extends SimpleConfig
// Disallow joining/leaving/kicking while power is negative
public static boolean canLeaveWithNegativePower = true;
// -------------------------------------------- //
// AUTO LEAVE
// -------------------------------------------- //
@ -96,33 +94,9 @@ public class ConfServer extends SimpleConfig
// INTEGRATION: LWC
// -------------------------------------------- //
public static boolean lwcIntegration = false;
public static boolean onUnclaimResetLwcLocks = false;
public static boolean onCaptureResetLwcLocks = false;
// -------------------------------------------- //
// LOGGING
// -------------------------------------------- //
public static boolean logFactionCreate = true;
public static boolean logFactionDisband = true;
public static boolean logFactionJoin = true;
public static boolean logFactionKick = true;
public static boolean logFactionLeave = true;
public static boolean logLandClaims = true;
public static boolean logLandUnclaims = true;
public static boolean logMoneyTransactions = true;
public static boolean logPlayerCommands = true;
// -------------------------------------------- //
// EXPLOITS
// -------------------------------------------- //
public static boolean handleExploitObsidianGenerators = true;
public static boolean handleExploitEnderPearlClipping = true;
public static boolean handleExploitInteractionSpam = true;
public static boolean handleExploitTNTWaterlog = false;
// -------------------------------------------- //
// HOMES
// -------------------------------------------- //

View File

@ -2,7 +2,6 @@ package com.massivecraft.factions.cmd;
import java.util.ArrayList;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
@ -10,6 +9,7 @@ import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventCreate;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
@ -79,7 +79,7 @@ public class CmdFactionsCreate extends FCommand
msg("<i>You should now: %s", Factions.get().getOuterCmdFactions().cmdFactionsDescription.getUseageTemplate());
if (ConfServer.logFactionCreate)
if (MConf.get().logFactionCreate)
{
Factions.get().log(fme.getName()+" created a new faction: "+newTag);
}

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.FPlayerColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventDisband;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
@ -73,8 +73,11 @@ public class CmdFactionsDisband extends FCommand
fplayer.msg("<h>%s<i> disbanded the faction %s.", who, faction.getTag(fplayer));
}
}
if (ConfServer.logFactionDisband)
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+faction.getTag()+" ("+faction.getId()+") was disbanded by "+(senderIsConsole ? "console command" : fme.getName())+".");
}
if (Econ.isEnabled(faction))
{

View File

@ -7,6 +7,7 @@ import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -97,7 +98,7 @@ public class CmdFactionsJoin extends FCommand
faction.setInvited(fplayer, false);
// Derplog
if (ConfServer.logFactionJoin)
if (MConf.get().logFactionJoin)
{
if (samePlayer)
Factions.get().log("%s joined the faction %s.", fplayer.getName(), faction.getTag());

View File

@ -9,6 +9,7 @@ import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.FactionColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventMembershipChange;
import com.massivecraft.factions.event.FactionsEventMembershipChange.MembershipChangeReason;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -69,9 +70,9 @@ public class CmdFactionsKick extends FCommand
fme.msg("<i>You kicked %s<i> from the faction %s<i>!", fplayer.describeTo(fme), fplayerFaction.describeTo(fme));
}
if (ConfServer.logFactionKick)
if (MConf.get().logFactionKick)
{
Factions.get().log((senderIsConsole ? "A console command" : fme.getName())+" kicked "+fplayer.getName()+" from the faction: "+fplayerFaction.getTag());
Factions.get().log(fme.getDisplayName() + " kicked " + fplayer.getName() + " from the faction " + fplayerFaction.getTag());
}
// Apply

View File

@ -1,11 +1,11 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
import com.massivecraft.mcore.cmd.req.ReqHasPerm;
@ -40,7 +40,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
boolean success = Econ.transferMoney(fme, fme, faction, amount);
if (success && ConfServer.logMoneyTransactions)
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", fme.getName(), Money.format(fme, amount), faction.describeTo(null))));
}

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
@ -43,7 +43,7 @@ public class CmdFactionsMoneyTransferFf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
@ -45,7 +45,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}

View File

@ -1,12 +1,12 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFPlayer;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
@ -45,7 +45,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
boolean success = Econ.transferMoney(fme, from, to, amount);
if (success && ConfServer.logMoneyTransactions)
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", fme.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
}

View File

@ -1,10 +1,10 @@
package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Perm;
import com.massivecraft.factions.cmd.arg.ARFaction;
import com.massivecraft.factions.cmd.req.ReqBankCommandsEnabled;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.mcore.cmd.arg.ARDouble;
@ -39,7 +39,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand
boolean success = Econ.transferMoney(fme, faction, fme, amount);
if (success && ConfServer.logMoneyTransactions)
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", fme.getName(), Money.format(faction, amount), faction.describeTo(null))));
}

View File

@ -3,6 +3,7 @@ package com.massivecraft.factions.cmd;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.Faction;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventLandUnclaim;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures;
@ -57,7 +58,7 @@ public class CmdFactionsUnclaim extends FCommand
SpoutFeatures.updateTerritoryDisplayLoc(chunk);
myFaction.msg("%s<i> unclaimed some land.", fme.describeTo(myFaction, true));
if (ConfServer.logLandUnclaims)
if (MConf.get().logLandUnclaims)
{
Factions.get().log(fme.getName()+" unclaimed land at ("+chunk.getChunkX()+","+chunk.getChunkZ()+") from the faction: "+otherFaction.getTag());
}

View File

@ -6,6 +6,7 @@ import com.massivecraft.factions.Perm;
import com.massivecraft.factions.Rel;
import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast;
import com.massivecraft.factions.entity.BoardColl;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.factions.event.FactionsEventLandUnclaimAll;
import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.SpoutFeatures;
@ -52,7 +53,7 @@ public class CmdFactionsUnclaimall extends FCommand
// TODO: Move this to a listener instead.
SpoutFeatures.updateTerritoryDisplayLoc(null);
if (ConfServer.logLandUnclaims)
if (MConf.get().logLandUnclaims)
{
Factions.get().log(fme.getName()+" unclaimed everything for the faction: "+myFaction.getTag());
}

View File

@ -694,8 +694,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
fplayer.msg("%s<i> left %s<i>.", this.describeTo(fplayer, true), myFaction.describeTo(fplayer));
}
if (ConfServer.logFactionLeave)
if (MConf.get().logFactionLeave)
{
Factions.get().log(this.getName()+" left the faction: "+myFaction.getTag());
}
}
this.resetFactionData();
@ -709,8 +711,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
}
myFaction.detach();
if (ConfServer.logFactionDisband)
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+myFaction.getTag()+" ("+myFaction.getId()+") was disbanded due to the last player ("+this.getName()+") leaving.");
}
}
}
@ -840,8 +844,10 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
BoardColl.get().setFactionAt(psChunk, forFaction);
SpoutFeatures.updateTerritoryDisplayLoc(psChunk);
if (ConfServer.logLandClaims)
if (MConf.get().logLandClaims)
{
Factions.get().log(this.getName()+" claimed land at ("+psChunk.getChunkX()+","+psChunk.getChunkZ()+") for the faction: "+forFaction.getTag());
}
return true;
}

View File

@ -130,7 +130,7 @@ public class FPlayerColl extends SenderColl<FPlayer>
if (fplayer.isOnline()) continue;
if (now - lastPlayed <= toleranceMillis) continue;
if (ConfServer.logFactionLeave || ConfServer.logFactionKick)
if (MConf.get().logFactionLeave || MConf.get().logFactionKick)
{
Factions.get().log("Player "+fplayer.getName()+" was auto-removed due to inactivity.");
}

View File

@ -851,7 +851,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
}
// no members left and faction isn't permanent, so disband it
if (ConfServer.logFactionDisband)
if (MConf.get().logFactionDisband)
{
Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left.");
}

View File

@ -78,5 +78,28 @@ public class MConf extends Entity<MConf>
public boolean herochatAlliesMuted = false;
public Set<String> herochatAlliesWorlds = new HashSet<String>();
// -------------------------------------------- //
// LOGGING
// -------------------------------------------- //
public boolean logFactionCreate = true;
public boolean logFactionDisband = true;
public boolean logFactionJoin = true;
public boolean logFactionKick = true;
public boolean logFactionLeave = true;
public boolean logLandClaims = true;
public boolean logLandUnclaims = true;
public boolean logMoneyTransactions = true;
public boolean logPlayerCommands = true;
// -------------------------------------------- //
// EXPLOITS
// -------------------------------------------- //
public boolean handleExploitObsidianGenerators = true;
public boolean handleExploitEnderPearlClipping = true;
public boolean handleExploitInteractionSpam = true;
public boolean handleExploitTNTWaterlog = false;
}

View File

@ -13,7 +13,6 @@ import org.bukkit.block.BlockState;
import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin;
import com.griefcraft.model.Protection;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.FPlayer;
import com.massivecraft.factions.entity.Faction;
@ -29,15 +28,14 @@ public class LWCFeatures
if(test == null || !test.isEnabled()) return;
lwc = ((LWCPlugin)test).getLWC();
Factions.get().log("Successfully hooked into LWC!"+(ConfServer.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\")."));
Factions.get().log("Successfully hooked into LWC!");
}
public static boolean getEnabled()
{
return ConfServer.lwcIntegration && lwc != null;
return lwc != null;
}
public static void clearAllProtections(PS chunkPs)
{
for (Protection protection : getProtectionsInChunk(chunkPs))

View File

@ -20,8 +20,8 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import com.massivecraft.factions.ConfServer;
import com.massivecraft.factions.Factions;
import com.massivecraft.factions.entity.MConf;
import com.massivecraft.mcore.util.SenderUtil;
import com.massivecraft.mcore.util.Txt;
@ -52,7 +52,7 @@ public class FactionsListenerExploit implements Listener
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
public void interactSpam(PlayerInteractEvent event)
{
if (!ConfServer.handleExploitInteractionSpam) return;
if (!MConf.get().handleExploitInteractionSpam) return;
Player player = event.getPlayer();
String playerId = SenderUtil.getSenderId(player);
@ -99,7 +99,7 @@ public class FactionsListenerExploit implements Listener
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void obsidianGenerators(BlockFromToEvent event)
{
if (!ConfServer.handleExploitObsidianGenerators) return;
if (!MConf.get().handleExploitObsidianGenerators) return;
// thanks to ObGenBlocker and WorldGuard for this method
Block block = event.getToBlock();
@ -118,7 +118,7 @@ public class FactionsListenerExploit implements Listener
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void enderPearlClipping(PlayerTeleportEvent event)
{
if (!ConfServer.handleExploitEnderPearlClipping) return;
if (!MConf.get().handleExploitEnderPearlClipping) return;
if (event.getCause() != PlayerTeleportEvent.TeleportCause.ENDER_PEARL) return;
// this exploit works when the target location is within 0.31 blocks or so of a door or glass block or similar...
@ -164,7 +164,7 @@ public class FactionsListenerExploit implements Listener
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void tntWaterlog(EntityExplodeEvent event)
{
if (!ConfServer.handleExploitEnderPearlClipping) return;
if (!MConf.get().handleExploitEnderPearlClipping) return;
if (!(event.getEntity() instanceof TNTPrimed)) return;
Block center = event.getLocation().getBlock();