This commit is contained in:
drtshock 2014-04-05 17:25:15 -05:00
parent a73f2b0174
commit b50cebcdb6
6 changed files with 1 additions and 102 deletions

View File

@ -55,11 +55,6 @@
<version>1.2.27</version> <version>1.2.27</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.griefcraft</groupId>
<artifactId>lwc</artifactId>
<version>4.4.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>net.ess3</groupId> <groupId>net.ess3</groupId>
<artifactId>Essentials</artifactId> <artifactId>Essentials</artifactId>
@ -91,10 +86,6 @@
<id>bukkit-repo</id> <id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url> <url>http://repo.bukkit.org/content/groups/public/</url>
</repository> </repository>
<repository>
<id>mcstats.releases</id>
<url>http://repo.mcstats.org/content/repositories/</url>
</repository>
<repository> <repository>
<id>essrel</id> <id>essrel</id>
<url>http://repo.ess3.net/content/repositories/essrel</url> <url>http://repo.ess3.net/content/repositories/essrel</url>

View File

@ -1,6 +1,5 @@
package com.massivecraft.factions; package com.massivecraft.factions;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.util.AsciiCompass; import com.massivecraft.factions.util.AsciiCompass;
import com.massivecraft.factions.zcore.util.DiscUtil; import com.massivecraft.factions.zcore.util.DiscUtil;
@ -69,9 +68,6 @@ public class Board {
while (iter.hasNext()) { while (iter.hasNext()) {
Entry<FLocation, String> entry = iter.next(); Entry<FLocation, String> entry = iter.next();
if (entry.getValue().equals(factionId)) { if (entry.getValue().equals(factionId)) {
if (Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) {
LWCFeatures.clearAllChests(entry.getKey());
}
iter.remove(); iter.remove();
} }
} }
@ -107,9 +103,7 @@ public class Board {
while (iter.hasNext()) { while (iter.hasNext()) {
Entry<FLocation, String> entry = iter.next(); Entry<FLocation, String> entry = iter.next();
if (!Factions.i.exists(entry.getValue())) { if (!Factions.i.exists(entry.getValue())) {
if (Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) {
LWCFeatures.clearAllChests(entry.getKey());
}
P.p.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey()); P.p.log("Board cleaner removed " + entry.getValue() + " from " + entry.getKey());
iter.remove(); iter.remove();
} }

View File

@ -5,7 +5,6 @@ import com.massivecraft.factions.event.LandClaimEvent;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.integration.Worldguard; import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
@ -735,10 +734,6 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
// then make 'em pay (if applicable) // then make 'em pay (if applicable)
if (mustPay && !Econ.modifyMoney(payee, -cost, "to claim this land", "for claiming this land")) return false; if (mustPay && !Econ.modifyMoney(payee, -cost, "to claim this land", "for claiming this land")) return false;
if (LWCFeatures.getEnabled() && forFaction.isNormal() && Conf.onCaptureResetLwcLocks) {
LWCFeatures.clearOtherChests(flocation, this.getFaction());
}
// announce success // announce success
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>(); Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();
informTheseFPlayers.add(this); informTheseFPlayers.add(this);

View File

@ -3,7 +3,6 @@ package com.massivecraft.factions;
import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.iface.EconomyParticipator;
import com.massivecraft.factions.iface.RelationParticipator; import com.massivecraft.factions.iface.RelationParticipator;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.struct.Permission; import com.massivecraft.factions.struct.Permission;
import com.massivecraft.factions.struct.Relation; import com.massivecraft.factions.struct.Relation;
import com.massivecraft.factions.struct.Role; import com.massivecraft.factions.struct.Role;
@ -545,9 +544,6 @@ public class Faction extends Entity implements EconomyParticipator {
} }
public void clearClaimOwnership(FLocation loc) { public void clearClaimOwnership(FLocation loc) {
if (Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) {
LWCFeatures.clearAllChests(loc);
}
claimOwnership.remove(loc); claimOwnership.remove(loc);
} }
@ -572,9 +568,6 @@ public class Faction extends Entity implements EconomyParticipator {
} }
if (ownerData.isEmpty()) { if (ownerData.isEmpty()) {
if (Conf.onUnclaimResetLwcLocks && LWCFeatures.getEnabled()) {
LWCFeatures.clearAllChests(entry.getKey());
}
claimOwnership.remove(entry.getKey()); claimOwnership.remove(entry.getKey());
} }
} }

View File

@ -4,7 +4,6 @@ import com.massivecraft.factions.cmd.CmdAutoHelp;
import com.massivecraft.factions.cmd.FCmdRoot; import com.massivecraft.factions.cmd.FCmdRoot;
import com.massivecraft.factions.integration.Econ; import com.massivecraft.factions.integration.Econ;
import com.massivecraft.factions.integration.EssentialsFeatures; import com.massivecraft.factions.integration.EssentialsFeatures;
import com.massivecraft.factions.integration.LWCFeatures;
import com.massivecraft.factions.integration.Worldguard; import com.massivecraft.factions.integration.Worldguard;
import com.massivecraft.factions.listeners.*; import com.massivecraft.factions.listeners.*;
import com.massivecraft.factions.struct.ChatMode; import com.massivecraft.factions.struct.ChatMode;
@ -101,7 +100,6 @@ public class P extends MPlugin {
EssentialsFeatures.setup(); EssentialsFeatures.setup();
Econ.setup(); Econ.setup();
LWCFeatures.setup();
if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) { if (Conf.worldGuardChecking || Conf.worldGuardBuildPriority) {
Worldguard.init(this); Worldguard.init(this);

View File

@ -1,72 +0,0 @@
package com.massivecraft.factions.integration;
import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin;
import com.massivecraft.factions.*;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.plugin.Plugin;
import java.util.LinkedList;
import java.util.List;
public class LWCFeatures {
private static LWC lwc;
public static void setup() {
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("LWC");
if (test == null || !test.isEnabled()) return;
lwc = ((LWCPlugin) test).getLWC();
P.p.log("Successfully hooked into LWC!" + (Conf.lwcIntegration ? "" : " Integration is currently disabled, though (\"lwcIntegration\")."));
}
public static boolean getEnabled() {
return Conf.lwcIntegration && lwc != null;
}
public static void clearOtherChests(FLocation flocation, Faction faction) {
Location location = new Location(Bukkit.getWorld(flocation.getWorldName()), flocation.getX() * 16, 5, flocation.getZ() * 16);
if (location.getWorld() == null) return; // world not loaded or something? cancel out to prevent error
Chunk chunk = location.getChunk();
BlockState[] blocks = chunk.getTileEntities();
List<Block> chests = new LinkedList<Block>();
for (int x = 0; x < blocks.length; x++) {
if (blocks[x].getType() == Material.CHEST) {
chests.add(blocks[x].getBlock());
}
}
for (int x = 0; x < chests.size(); x++) {
if (lwc.findProtection(chests.get(x)) != null) {
if (!faction.getFPlayers().contains(FPlayers.i.get(lwc.findProtection(chests.get(x)).getOwner())))
lwc.findProtection(chests.get(x)).remove();
}
}
}
public static void clearAllChests(FLocation flocation) {
Location location = new Location(Bukkit.getWorld(flocation.getWorldName()), flocation.getX() * 16, 5, flocation.getZ() * 16);
if (location.getWorld() == null) return; // world not loaded or something? cancel out to prevent error
Chunk chunk = location.getChunk();
BlockState[] blocks = chunk.getTileEntities();
List<Block> chests = new LinkedList<Block>();
for (int x = 0; x < blocks.length; x++) {
if (blocks[x].getType() == Material.CHEST) {
chests.add(blocks[x].getBlock());
}
}
for (int x = 0; x < chests.size(); x++) {
if (lwc.findProtection(chests.get(x)) != null) {
lwc.findProtection(chests.get(x)).remove();
}
}
}
}