LWC integration
This commit is contained in:
parent
53d832369b
commit
1d0ba04336
@ -71,6 +71,8 @@ public class Conf
|
|||||||
|
|
||||||
public static boolean worldGuardChecking = false;
|
public static boolean worldGuardChecking = false;
|
||||||
|
|
||||||
|
public static boolean lwcIntegration = false;
|
||||||
|
|
||||||
// server logging options
|
// server logging options
|
||||||
public static boolean logFactionCreate = true;
|
public static boolean logFactionCreate = true;
|
||||||
public static boolean logFactionDisband = true;
|
public static boolean logFactionDisband = true;
|
||||||
|
@ -11,6 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
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.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
import com.massivecraft.factions.struct.ChatMode;
|
import com.massivecraft.factions.struct.ChatMode;
|
||||||
@ -791,6 +792,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LWCFeatures.getEnabled()&& ! forFaction.isSafeZone() && ! forFaction.isWarZone() && Board.getIdAt(flocation) != "0")
|
||||||
|
{
|
||||||
|
LWCFeatures.clearChests(location, this);
|
||||||
|
}
|
||||||
|
|
||||||
// announce success
|
// announce success
|
||||||
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();
|
Set<FPlayer> informTheseFPlayers = new HashSet<FPlayer>();
|
||||||
informTheseFPlayers.add(this);
|
informTheseFPlayers.add(this);
|
||||||
|
@ -6,18 +6,26 @@ import java.util.HashSet;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.player.PlayerChatEvent;
|
import org.bukkit.event.player.PlayerChatEvent;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import com.massivecraft.factions.cmd.*;
|
import com.earth2me.essentials.chat.EssentialsChat;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
import com.griefcraft.lwc.LWCPlugin;
|
||||||
|
import com.massivecraft.factions.cmd.CmdAutoHelp;
|
||||||
|
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.LWCFeatures;
|
||||||
import com.massivecraft.factions.integration.SpoutFeatures;
|
import com.massivecraft.factions.integration.SpoutFeatures;
|
||||||
import com.massivecraft.factions.integration.Worldguard;
|
import com.massivecraft.factions.integration.Worldguard;
|
||||||
|
import com.massivecraft.factions.integration.capi.CapiFeatures;
|
||||||
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
import com.massivecraft.factions.listeners.FactionsBlockListener;
|
||||||
import com.massivecraft.factions.listeners.FactionsChatEarlyListener;
|
import com.massivecraft.factions.listeners.FactionsChatEarlyListener;
|
||||||
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
import com.massivecraft.factions.listeners.FactionsEntityListener;
|
||||||
@ -27,13 +35,7 @@ import com.massivecraft.factions.struct.ChatMode;
|
|||||||
import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
|
import com.massivecraft.factions.util.MapFLocToStringSetTypeAdapter;
|
||||||
import com.massivecraft.factions.util.MyLocationTypeAdapter;
|
import com.massivecraft.factions.util.MyLocationTypeAdapter;
|
||||||
import com.massivecraft.factions.zcore.MPlugin;
|
import com.massivecraft.factions.zcore.MPlugin;
|
||||||
|
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.earth2me.essentials.chat.EssentialsChat;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
import com.massivecraft.factions.integration.EssentialsFeatures;
|
|
||||||
import com.massivecraft.factions.integration.capi.CapiFeatures;
|
|
||||||
|
|
||||||
public class P extends MPlugin
|
public class P extends MPlugin
|
||||||
{
|
{
|
||||||
@ -94,6 +96,7 @@ public class P extends MPlugin
|
|||||||
Econ.doSetup();
|
Econ.doSetup();
|
||||||
Econ.oldMoneyDoTransfer();
|
Econ.oldMoneyDoTransfer();
|
||||||
CapiFeatures.setup();
|
CapiFeatures.setup();
|
||||||
|
setupLWC();
|
||||||
|
|
||||||
if(Conf.worldGuardChecking)
|
if(Conf.worldGuardChecking)
|
||||||
{
|
{
|
||||||
@ -202,6 +205,17 @@ public class P extends MPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupLWC()
|
||||||
|
{
|
||||||
|
|
||||||
|
Plugin test = this.getServer().getPluginManager().getPlugin("LWC");
|
||||||
|
|
||||||
|
if(test != null && test.isEnabled() && Conf.lwcIntegration)
|
||||||
|
{
|
||||||
|
LWCFeatures.integrateLWC((LWCPlugin)test);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Functions for other plugins to hook into
|
// Functions for other plugins to hook into
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
60
src/com/massivecraft/factions/integration/LWCFeatures.java
Normal file
60
src/com/massivecraft/factions/integration/LWCFeatures.java
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
package com.massivecraft.factions.integration;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
|
||||||
|
import com.griefcraft.lwc.LWC;
|
||||||
|
import com.griefcraft.lwc.LWCPlugin;
|
||||||
|
import com.massivecraft.factions.FPlayer;
|
||||||
|
import com.massivecraft.factions.FPlayers;
|
||||||
|
import com.massivecraft.factions.P;
|
||||||
|
|
||||||
|
public class LWCFeatures
|
||||||
|
{
|
||||||
|
|
||||||
|
private static LWC lwc;
|
||||||
|
private static boolean isEnabled = false;
|
||||||
|
|
||||||
|
public static void integrateLWC(LWCPlugin test)
|
||||||
|
{
|
||||||
|
lwc = test.getLWC();
|
||||||
|
isEnabled = true;
|
||||||
|
|
||||||
|
P.p.log("Successfully hooked into LWC!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearChests(Location location, FPlayer fPlayer)
|
||||||
|
{
|
||||||
|
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(!fPlayer.getFaction().getFPlayers().contains(FPlayers.i.get(lwc.findProtection(chests.get(x)).getBukkitOwner())))
|
||||||
|
lwc.findProtection(chests.get(x)).remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getEnabled()
|
||||||
|
{
|
||||||
|
return isEnabled;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user