diff --git a/pom.xml b/pom.xml
index 38637bc..4c1838c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
com.dre
brewery
- 1.5
+ 1.6.1
Brewery
@@ -35,8 +35,8 @@
maven-compiler-plugin
3.5.1
-
- 1.7
+
+ 1.8
UTF-8
@@ -54,7 +54,7 @@
vault-repo
- http://nexus.theyeticave.net/content/repositories/pub_releases
+ http://nexus.hc.to/content/repositories/pub_releases
mcstats-repo
@@ -68,21 +68,37 @@
dre2n-rpo
http://feuerstern.bplaced.net/repo/
+
+ devoted-repo
+ https://build.devotedmc.com/plugin/repository/everything/
+
org.bukkit
bukkit
- 1.10.2-R0.1-SNAPSHOT
+ 1.12-R0.1-SNAPSHOT
provided
net.milkbowl.vault
VaultAPI
- 1.5
+ 1.6
provided
+
+ vg.civcraft.mc.citadel
+ Citadel
+ 3.9.1
+ compile
+
+
+ vg.civcraft.mc.civmodcore
+ CivModCore
+ 1.6.0
+ compile
+
com.sk89q
worldguard
diff --git a/resources/config/de/config.yml b/resources/config/de/config.yml
index 06b6768..cf12f4f 100644
--- a/resources/config/de/config.yml
+++ b/resources/config/de/config.yml
@@ -265,6 +265,7 @@ cooked:
useWorldGuard: true
useLWC: true
useGriefPrevention: true
+useCitadel: true
# Ă„nderungen an Fassinventaren mit LogBlock aufzeichen [true]
useLogBlock: true
diff --git a/resources/config/en/config.yml b/resources/config/en/config.yml
index 2460954..cccd7e6 100644
--- a/resources/config/en/config.yml
+++ b/resources/config/en/config.yml
@@ -263,6 +263,7 @@ cooked:
useWorldGuard: true
useLWC: true
useGriefPrevention: true
+useCitadel: true
# Enable the Logging of Barrel Inventories to LogBlock [true]
useLogBlock: true
diff --git a/resources/config/fr/config.yml b/resources/config/fr/config.yml
index e9d83d7..3033437 100644
--- a/resources/config/fr/config.yml
+++ b/resources/config/fr/config.yml
@@ -268,6 +268,7 @@ cooked:
useWorldGuard: true
useLWC: true
useGriefPrevention: true
+useCitadel: true
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
useLogBlock: true
diff --git a/resources/config/it/config.yml b/resources/config/it/config.yml
index 591a76b..9a0f770 100755
--- a/resources/config/it/config.yml
+++ b/resources/config/it/config.yml
@@ -263,6 +263,7 @@ cooked:
useWorldGuard: true
useLWC: true
useGriefPrevention: true
+useCitadel: true
# Abilita il logging degli inventari dei barili [true]
useLogBlock: true
diff --git a/resources/plugin.yml b/resources/plugin.yml
index 3e3bd01..30a1220 100644
--- a/resources/plugin.yml
+++ b/resources/plugin.yml
@@ -2,7 +2,7 @@ name: ${project.name}
version: ${project.version}
main: com.dre.brewery.P
authors: [Milan Albrecht, Frank Baumann, ProgrammerDan]
-softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault]
+softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault, Citadel]
commands:
brewery:
description: Command for Administration
diff --git a/src/com/dre/brewery/Barrel.java b/src/com/dre/brewery/Barrel.java
index ae73bb1..738f89c 100644
--- a/src/com/dre/brewery/Barrel.java
+++ b/src/com/dre/brewery/Barrel.java
@@ -22,6 +22,7 @@ import org.bukkit.material.Wood;
import org.bukkit.plugin.Plugin;
import org.bukkit.scheduler.BukkitRunnable;
+import com.dre.brewery.integration.CitadelBarrel;
import com.dre.brewery.integration.GriefPreventionBarrel;
import com.dre.brewery.integration.LWCBarrel;
import com.dre.brewery.integration.LogBlockBarrel;
@@ -179,6 +180,26 @@ public class Barrel implements InventoryHolder {
}
}
}
+
+ if (event != null && P.p.useCitadel) {
+ Plugin plugin = P.p.getServer().getPluginManager().getPlugin("Citadel");
+ if (plugin != null) {
+ try {
+ if (isSign(event.getClickedBlock())) {
+ return CitadelBarrel.checkAccess(player, getSignOfSpigot());
+ } else {
+ return CitadelBarrel.checkAccess(player, spigot);
+ }
+ } catch (Throwable e) {
+ P.p.errorLog("Failed to Check Citadel for Container Access Permissions!");
+ P.p.errorLog("Brewery was tested with version 3.9.1 of Citadel!");
+ P.p.errorLog("Disable Citadel support in the config and do /brew reload");
+ e.printStackTrace();
+ P.p.msg(player, "&cError opening Barrel, please report to an admin!");
+ return false;
+ }
+ }
+ }
return true;
}
diff --git a/src/com/dre/brewery/Brew.java b/src/com/dre/brewery/Brew.java
index 3c28035..47798a0 100644
--- a/src/com/dre/brewery/Brew.java
+++ b/src/com/dre/brewery/Brew.java
@@ -1,5 +1,6 @@
package com.dre.brewery;
+import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.BrewerInventory;
@@ -625,7 +626,7 @@ public class Brew {
// True if the PotionMeta has colored Lore
public static Boolean hasColorLore(PotionMeta meta) {
- return meta.hasLore() && !meta.getLore().get(1).startsWith(P.p.color("&7"));
+ return meta.hasLore() && (meta.getLore().size() > 1 && !meta.getLore().get(1).startsWith(P.p.color("&7")));
}
// gets the Color that represents a quality in Lore
@@ -685,25 +686,27 @@ public class Brew {
}
public enum PotionColor {
- PINK(1, PotionType.REGEN),
- CYAN(2, PotionType.SPEED),
- ORANGE(3, PotionType.FIRE_RESISTANCE),
- GREEN(4, PotionType.POISON),
- BRIGHT_RED(5, PotionType.INSTANT_HEAL),
- BLUE(6, PotionType.NIGHT_VISION),
- BLACK(8, PotionType.WEAKNESS),
- RED(9, PotionType.STRENGTH),
- GREY(10, PotionType.SLOWNESS),
- WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null),
- DARK_RED(12, PotionType.INSTANT_DAMAGE),
- BRIGHT_GREY(14, PotionType.INVISIBILITY);
+ PINK(1, PotionType.REGEN, Color.FUCHSIA),
+ CYAN(2, PotionType.SPEED, Color.AQUA),
+ ORANGE(3, PotionType.FIRE_RESISTANCE, Color.ORANGE),
+ GREEN(4, PotionType.POISON, Color.GREEN),
+ BRIGHT_RED(5, PotionType.INSTANT_HEAL, Color.fromRGB(255,0,0)),
+ BLUE(6, PotionType.NIGHT_VISION, Color.NAVY),
+ BLACK(8, PotionType.WEAKNESS, Color.BLACK),
+ RED(9, PotionType.STRENGTH, Color.fromRGB(196,0,0)),
+ GREY(10, PotionType.SLOWNESS, Color.GRAY),
+ WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null, Color.BLUE),
+ DARK_RED(12, PotionType.INSTANT_DAMAGE, Color.fromRGB(128,0,0)),
+ BRIGHT_GREY(14, PotionType.INVISIBILITY, Color.SILVER);
private final int colorId;
private final PotionType type;
+ private final Color color;
- PotionColor(int colorId, PotionType type) {
+ PotionColor(int colorId, PotionType type, Color color) {
this.colorId = colorId;
this.type = type;
+ this.color = color;
}
// gets the Damage Value, that sets a color on the potion
@@ -718,11 +721,18 @@ public class Brew {
public PotionType getType() {
return type;
}
+
+ public Color getColor() {
+ return color;
+ }
public void colorBrew(PotionMeta meta, ItemStack potion, boolean destillable) {
if (P.use1_9) {
meta.setBasePotionData(new PotionData(getType()));
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
+ if (P.use1_12) {
+ meta.setColor(getColor());
+ }
} else {
potion.setDurability(getColorId(destillable));
}
diff --git a/src/com/dre/brewery/P.java b/src/com/dre/brewery/P.java
index 45df16c..2ddc5b6 100644
--- a/src/com/dre/brewery/P.java
+++ b/src/com/dre/brewery/P.java
@@ -39,6 +39,7 @@ public class P extends JavaPlugin {
public static boolean debug;
public static boolean useUUID;
public static boolean use1_9;
+ public static boolean use1_12;
public static boolean updateCheck;
// Third Party Enabled
@@ -47,7 +48,8 @@ public class P extends JavaPlugin {
public boolean useLWC; //LWC
public boolean useLB; //LogBlock
public boolean useGP; //GriefPrevention
- public boolean hasVault;
+ public boolean hasVault; // Vault
+ public boolean useCitadel; // CivCraft/DevotedMC Citadel
// Listeners
public BlockListener blockListener;
@@ -70,6 +72,7 @@ public class P extends JavaPlugin {
String v = Bukkit.getBukkitVersion();
useUUID = !v.matches("(^|.*[^\\.\\d])1\\.[0-6]([^\\d].*|$)") && !v.matches("(^|.*[^\\.\\d])1\\.7\\.[0-5]([^\\d].*|$)");
use1_9 = !v.matches("(^|.*[^\\.\\d])1\\.[0-8]([^\\d].*|$)");
+ use1_12 = !v.matches("(^|.*[^\\.\\d])1\\.[0-11]([^\\d].*|$)");
// load the Config
try {
@@ -280,6 +283,8 @@ public class P extends JavaPlugin {
useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention");
useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock");
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
+
+ useCitadel = config.getBoolean("useCitadel", false) && getServer().getPluginManager().isPluginEnabled("Citadel");
// various Settings
DataSave.autosave = config.getInt("autosave", 3);
diff --git a/src/com/dre/brewery/integration/CitadelBarrel.java b/src/com/dre/brewery/integration/CitadelBarrel.java
new file mode 100644
index 0000000..cb36a80
--- /dev/null
+++ b/src/com/dre/brewery/integration/CitadelBarrel.java
@@ -0,0 +1,43 @@
+package com.dre.brewery.integration;
+
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+
+import com.dre.brewery.P;
+
+import vg.civcraft.mc.citadel.Citadel;
+import vg.civcraft.mc.citadel.ReinforcementManager;
+import vg.civcraft.mc.citadel.reinforcement.NullReinforcement;
+import vg.civcraft.mc.citadel.reinforcement.PlayerReinforcement;
+import vg.civcraft.mc.citadel.reinforcement.Reinforcement;
+
+/**
+ * Basic Citadel support to prevent randos from stealing your barrel aging brews
+ *
+ * @author ProgrammerDan
+ */
+public class CitadelBarrel {
+ static P brewery = P.p;
+
+ public static boolean checkAccess(Player player, Block sign) {
+ ReinforcementManager manager = Citadel.getReinforcementManager();
+
+ Reinforcement rein = manager.getReinforcement(sign);
+
+ if (rein == null) return true; // no protections in place.
+
+ if (rein instanceof PlayerReinforcement) {
+ PlayerReinforcement prein = (PlayerReinforcement) rein;
+ if (prein.canAccessChests(player)) {
+ return true;
+ }
+ } else if (rein instanceof NullReinforcement) {
+ return true;
+ }
+ // no support for multiblock atm, would require namelayer support.
+
+ // special locked, or no access.
+ brewery.msg(player, brewery.languageReader.get("Error_NoBarrelAccess"));
+ return false;
+ }
+}