mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-08 19:51:05 +00:00
Added LWC and Lockette Support
This commit is contained in:
parent
56967951da
commit
22442f0429
@ -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
|
||||
|
@ -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 = "";
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
@ -64,6 +68,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);
|
||||
ItemStack product = clickType.getProduct();
|
||||
|
Loading…
Reference in New Issue
Block a user