Added LWC and Lockette Support

This commit is contained in:
Eric 2015-09-04 12:31:19 +02:00
parent 56967951da
commit 22442f0429
3 changed files with 53 additions and 3 deletions

View File

@ -2,11 +2,11 @@
name: ShopChest
main: de.epiceric.shopchest.ShopChest
version: 1.4.10
version: 1.4.11
author: EpicEric
website: https://www.spigotmc.org/resources/shopchest.11431/
depend: [Vault]
softdepend: [ClearLag]
softdepend: [ClearLag, LWC, Lockette]
permissions:
shopchest.*:
@ -28,6 +28,11 @@ permissions:
children:
shopchest.create: true
default: op
shopchest.create.protected:
description: Allows you to create a shop on a protected chest.
children:
shopchest.create: true
default: op
shopchest.removeOther:
description: Allows you to remove other players' shop.
default: op

View File

@ -16,8 +16,13 @@ import org.bukkit.World;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.RegisteredServiceProvider;
import org.bukkit.plugin.java.JavaPlugin;
import org.yi.acru.bukkit.Lockette.Lockette;
import com.griefcraft.lwc.LWC;
import com.griefcraft.lwc.LWCPlugin;
import de.epiceric.shopchest.config.Config;
import de.epiceric.shopchest.event.InteractShop;
@ -53,6 +58,8 @@ public class ShopChest extends JavaPlugin{
public static Logger logger = Logger.getLogger("Minecraft");
public static Economy econ = null;
public static Permission perm = null;
public static LWC lwc = null;
public static boolean lockette = false;
public static boolean isUpdateNeeded = false;
public static String latestVersion = "";
@ -103,7 +110,7 @@ public class ShopChest extends JavaPlugin{
} catch (IOException e) {
logger.severe("[ShopChest] [PluginMetrics] Could not submit stats.");
}
switch (Utils.getVersion(getServer())) {
case "v1_8_R1": utils = new Utils_R1(); break;
@ -115,6 +122,19 @@ public class ShopChest extends JavaPlugin{
return;
}
if (getServer().getPluginManager().getPlugin("LWC") != null) {
Plugin lwcp = getServer().getPluginManager().getPlugin("LWC");
lwc = ((LWCPlugin) lwcp).getLWC();
} else {
lwc = null;
}
if (getServer().getPluginManager().getPlugin("Lockette") != null) {
lockette = true;
} else {
lockette = false;
}
setupPermissions();
instance = this;

View File

@ -19,6 +19,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.yi.acru.bukkit.Lockette.Lockette;
import com.griefcraft.lwc.LWC;
import com.griefcraft.model.Protection;
import de.epiceric.shopchest.ShopChest;
import de.epiceric.shopchest.config.Config;
@ -63,6 +67,27 @@ public class InteractShop implements Listener{
case CREATE:
e.setCancelled(true);
if (!p.isOp() || !perm.has(p, "shopchest.create.protected")) {
if (ShopChest.lockette) {
if (Lockette.isProtected(b)) {
if (!Lockette.isOwner(b, p) || !Lockette.isUser(b, p, true)) {
ClickType.removePlayerClickType(p);
break;
}
}
}
if (ShopChest.lwc != null) {
if (ShopChest.lwc.getPhysicalDatabase().loadProtection(b.getLocation().getWorld().getName(), b.getX(), b.getY(), b.getZ()) != null) {
Protection protection = ShopChest.lwc.getPhysicalDatabase().loadProtection(b.getLocation().getWorld().getName(), b.getX(), b.getY(), b.getZ());
if (!protection.isOwner(p) || !protection.isRealOwner(p)) {
ClickType.removePlayerClickType(p);
break;
}
}
}
}
if (!ShopUtils.isShop(b.getLocation())) {
ClickType clickType = ClickType.getPlayerClickType(p);