mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-11-22 02:12:25 +00:00
Added LWC and Lockette Support
This commit is contained in:
parent
56967951da
commit
22442f0429
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
name: ShopChest
|
name: ShopChest
|
||||||
main: de.epiceric.shopchest.ShopChest
|
main: de.epiceric.shopchest.ShopChest
|
||||||
version: 1.4.10
|
version: 1.4.11
|
||||||
author: EpicEric
|
author: EpicEric
|
||||||
website: https://www.spigotmc.org/resources/shopchest.11431/
|
website: https://www.spigotmc.org/resources/shopchest.11431/
|
||||||
depend: [Vault]
|
depend: [Vault]
|
||||||
softdepend: [ClearLag]
|
softdepend: [ClearLag, LWC, Lockette]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
shopchest.*:
|
shopchest.*:
|
||||||
@ -28,6 +28,11 @@ permissions:
|
|||||||
children:
|
children:
|
||||||
shopchest.create: true
|
shopchest.create: true
|
||||||
default: op
|
default: op
|
||||||
|
shopchest.create.protected:
|
||||||
|
description: Allows you to create a shop on a protected chest.
|
||||||
|
children:
|
||||||
|
shopchest.create: true
|
||||||
|
default: op
|
||||||
shopchest.removeOther:
|
shopchest.removeOther:
|
||||||
description: Allows you to remove other players' shop.
|
description: Allows you to remove other players' shop.
|
||||||
default: op
|
default: op
|
||||||
|
@ -16,8 +16,13 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
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.config.Config;
|
||||||
import de.epiceric.shopchest.event.InteractShop;
|
import de.epiceric.shopchest.event.InteractShop;
|
||||||
@ -53,6 +58,8 @@ public class ShopChest extends JavaPlugin{
|
|||||||
public static Logger logger = Logger.getLogger("Minecraft");
|
public static Logger logger = Logger.getLogger("Minecraft");
|
||||||
public static Economy econ = null;
|
public static Economy econ = null;
|
||||||
public static Permission perm = null;
|
public static Permission perm = null;
|
||||||
|
public static LWC lwc = null;
|
||||||
|
public static boolean lockette = false;
|
||||||
|
|
||||||
public static boolean isUpdateNeeded = false;
|
public static boolean isUpdateNeeded = false;
|
||||||
public static String latestVersion = "";
|
public static String latestVersion = "";
|
||||||
@ -103,7 +110,7 @@ public class ShopChest extends JavaPlugin{
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
logger.severe("[ShopChest] [PluginMetrics] Could not submit stats.");
|
logger.severe("[ShopChest] [PluginMetrics] Could not submit stats.");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (Utils.getVersion(getServer())) {
|
switch (Utils.getVersion(getServer())) {
|
||||||
|
|
||||||
case "v1_8_R1": utils = new Utils_R1(); break;
|
case "v1_8_R1": utils = new Utils_R1(); break;
|
||||||
@ -115,6 +122,19 @@ public class ShopChest extends JavaPlugin{
|
|||||||
return;
|
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();
|
setupPermissions();
|
||||||
|
|
||||||
instance = this;
|
instance = this;
|
||||||
|
@ -19,6 +19,10 @@ import org.bukkit.event.player.PlayerInteractEvent;
|
|||||||
import org.bukkit.event.player.PlayerMoveEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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.ShopChest;
|
||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
@ -63,6 +67,27 @@ public class InteractShop implements Listener{
|
|||||||
|
|
||||||
case CREATE:
|
case CREATE:
|
||||||
e.setCancelled(true);
|
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())) {
|
if (!ShopUtils.isShop(b.getLocation())) {
|
||||||
ClickType clickType = ClickType.getPlayerClickType(p);
|
ClickType clickType = ClickType.getPlayerClickType(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user