mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-02-19 01:41:22 +01:00
Adding Citadel support and finally fixing brew colors for 1.12
This commit is contained in:
parent
851160fbac
commit
5089b24dac
18
pom.xml
18
pom.xml
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<groupId>com.dre</groupId>
|
<groupId>com.dre</groupId>
|
||||||
<artifactId>brewery</artifactId>
|
<artifactId>brewery</artifactId>
|
||||||
<version>1.6.0</version>
|
<version>1.6.1</version>
|
||||||
<name>Brewery</name>
|
<name>Brewery</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -68,6 +68,10 @@
|
|||||||
<id>dre2n-rpo</id>
|
<id>dre2n-rpo</id>
|
||||||
<url>http://feuerstern.bplaced.net/repo/</url>
|
<url>http://feuerstern.bplaced.net/repo/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>devoted-repo</id>
|
||||||
|
<url>https://build.devotedmc.com/plugin/repository/everything/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -83,6 +87,18 @@
|
|||||||
<version>1.6</version>
|
<version>1.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>vg.civcraft.mc.citadel</groupId>
|
||||||
|
<artifactId>Citadel</artifactId>
|
||||||
|
<version>3.9.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>vg.civcraft.mc.civmodcore</groupId>
|
||||||
|
<artifactId>CivModCore</artifactId>
|
||||||
|
<version>1.6.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q</groupId>
|
<groupId>com.sk89q</groupId>
|
||||||
<artifactId>worldguard</artifactId>
|
<artifactId>worldguard</artifactId>
|
||||||
|
@ -265,6 +265,7 @@ cooked:
|
|||||||
useWorldGuard: true
|
useWorldGuard: true
|
||||||
useLWC: true
|
useLWC: true
|
||||||
useGriefPrevention: true
|
useGriefPrevention: true
|
||||||
|
useCitadel: true
|
||||||
|
|
||||||
# Änderungen an Fassinventaren mit LogBlock aufzeichen [true]
|
# Änderungen an Fassinventaren mit LogBlock aufzeichen [true]
|
||||||
useLogBlock: true
|
useLogBlock: true
|
||||||
|
@ -263,6 +263,7 @@ cooked:
|
|||||||
useWorldGuard: true
|
useWorldGuard: true
|
||||||
useLWC: true
|
useLWC: true
|
||||||
useGriefPrevention: true
|
useGriefPrevention: true
|
||||||
|
useCitadel: true
|
||||||
|
|
||||||
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
||||||
useLogBlock: true
|
useLogBlock: true
|
||||||
|
@ -268,6 +268,7 @@ cooked:
|
|||||||
useWorldGuard: true
|
useWorldGuard: true
|
||||||
useLWC: true
|
useLWC: true
|
||||||
useGriefPrevention: true
|
useGriefPrevention: true
|
||||||
|
useCitadel: true
|
||||||
|
|
||||||
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
|
# Activer l'historique du contenu des tonneaux avec LogBlock [true]
|
||||||
useLogBlock: true
|
useLogBlock: true
|
||||||
|
@ -263,6 +263,7 @@ cooked:
|
|||||||
useWorldGuard: true
|
useWorldGuard: true
|
||||||
useLWC: true
|
useLWC: true
|
||||||
useGriefPrevention: true
|
useGriefPrevention: true
|
||||||
|
useCitadel: true
|
||||||
|
|
||||||
# Abilita il logging degli inventari dei barili [true]
|
# Abilita il logging degli inventari dei barili [true]
|
||||||
useLogBlock: true
|
useLogBlock: true
|
||||||
|
@ -2,7 +2,7 @@ name: ${project.name}
|
|||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: com.dre.brewery.P
|
main: com.dre.brewery.P
|
||||||
authors: [Milan Albrecht, Frank Baumann, ProgrammerDan]
|
authors: [Milan Albrecht, Frank Baumann, ProgrammerDan]
|
||||||
softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault]
|
softdepend: [LWC, LogBlock, WorldGuard, GriefPrevention, Vault, Citadel]
|
||||||
commands:
|
commands:
|
||||||
brewery:
|
brewery:
|
||||||
description: Command for Administration
|
description: Command for Administration
|
||||||
|
@ -22,6 +22,7 @@ import org.bukkit.material.Wood;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import com.dre.brewery.integration.CitadelBarrel;
|
||||||
import com.dre.brewery.integration.GriefPreventionBarrel;
|
import com.dre.brewery.integration.GriefPreventionBarrel;
|
||||||
import com.dre.brewery.integration.LWCBarrel;
|
import com.dre.brewery.integration.LWCBarrel;
|
||||||
import com.dre.brewery.integration.LogBlockBarrel;
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.dre.brewery;
|
package com.dre.brewery;
|
||||||
|
|
||||||
|
import org.bukkit.Color;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.inventory.BrewerInventory;
|
import org.bukkit.inventory.BrewerInventory;
|
||||||
@ -685,25 +686,27 @@ public class Brew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public enum PotionColor {
|
public enum PotionColor {
|
||||||
PINK(1, PotionType.REGEN),
|
PINK(1, PotionType.REGEN, Color.FUCHSIA),
|
||||||
CYAN(2, PotionType.SPEED),
|
CYAN(2, PotionType.SPEED, Color.AQUA),
|
||||||
ORANGE(3, PotionType.FIRE_RESISTANCE),
|
ORANGE(3, PotionType.FIRE_RESISTANCE, Color.ORANGE),
|
||||||
GREEN(4, PotionType.POISON),
|
GREEN(4, PotionType.POISON, Color.GREEN),
|
||||||
BRIGHT_RED(5, PotionType.INSTANT_HEAL),
|
BRIGHT_RED(5, PotionType.INSTANT_HEAL, Color.fromRGB(255,0,0)),
|
||||||
BLUE(6, PotionType.NIGHT_VISION),
|
BLUE(6, PotionType.NIGHT_VISION, Color.NAVY),
|
||||||
BLACK(8, PotionType.WEAKNESS),
|
BLACK(8, PotionType.WEAKNESS, Color.BLACK),
|
||||||
RED(9, PotionType.STRENGTH),
|
RED(9, PotionType.STRENGTH, Color.fromRGB(196,0,0)),
|
||||||
GREY(10, PotionType.SLOWNESS),
|
GREY(10, PotionType.SLOWNESS, Color.GRAY),
|
||||||
WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null),
|
WATER(11, P.use1_9 ? PotionType.WATER_BREATHING : null, Color.BLUE),
|
||||||
DARK_RED(12, PotionType.INSTANT_DAMAGE),
|
DARK_RED(12, PotionType.INSTANT_DAMAGE, Color.fromRGB(128,0,0)),
|
||||||
BRIGHT_GREY(14, PotionType.INVISIBILITY);
|
BRIGHT_GREY(14, PotionType.INVISIBILITY, Color.SILVER);
|
||||||
|
|
||||||
private final int colorId;
|
private final int colorId;
|
||||||
private final PotionType type;
|
private final PotionType type;
|
||||||
|
private final Color color;
|
||||||
|
|
||||||
PotionColor(int colorId, PotionType type) {
|
PotionColor(int colorId, PotionType type, Color color) {
|
||||||
this.colorId = colorId;
|
this.colorId = colorId;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
this.color = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gets the Damage Value, that sets a color on the potion
|
// gets the Damage Value, that sets a color on the potion
|
||||||
@ -718,11 +721,18 @@ public class Brew {
|
|||||||
public PotionType getType() {
|
public PotionType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
public void colorBrew(PotionMeta meta, ItemStack potion, boolean destillable) {
|
public void colorBrew(PotionMeta meta, ItemStack potion, boolean destillable) {
|
||||||
if (P.use1_9) {
|
if (P.use1_9) {
|
||||||
meta.setBasePotionData(new PotionData(getType()));
|
meta.setBasePotionData(new PotionData(getType()));
|
||||||
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
|
||||||
|
if (P.use1_12) {
|
||||||
|
meta.setColor(getColor());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
potion.setDurability(getColorId(destillable));
|
potion.setDurability(getColorId(destillable));
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public class P extends JavaPlugin {
|
|||||||
public static boolean debug;
|
public static boolean debug;
|
||||||
public static boolean useUUID;
|
public static boolean useUUID;
|
||||||
public static boolean use1_9;
|
public static boolean use1_9;
|
||||||
|
public static boolean use1_12;
|
||||||
public static boolean updateCheck;
|
public static boolean updateCheck;
|
||||||
|
|
||||||
// Third Party Enabled
|
// Third Party Enabled
|
||||||
@ -47,7 +48,8 @@ public class P extends JavaPlugin {
|
|||||||
public boolean useLWC; //LWC
|
public boolean useLWC; //LWC
|
||||||
public boolean useLB; //LogBlock
|
public boolean useLB; //LogBlock
|
||||||
public boolean useGP; //GriefPrevention
|
public boolean useGP; //GriefPrevention
|
||||||
public boolean hasVault;
|
public boolean hasVault; // Vault
|
||||||
|
public boolean useCitadel; // CivCraft/DevotedMC Citadel
|
||||||
|
|
||||||
// Listeners
|
// Listeners
|
||||||
public BlockListener blockListener;
|
public BlockListener blockListener;
|
||||||
@ -70,6 +72,7 @@ public class P extends JavaPlugin {
|
|||||||
String v = Bukkit.getBukkitVersion();
|
String v = Bukkit.getBukkitVersion();
|
||||||
useUUID = !v.matches("(^|.*[^\\.\\d])1\\.[0-6]([^\\d].*|$)") && !v.matches("(^|.*[^\\.\\d])1\\.7\\.[0-5]([^\\d].*|$)");
|
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_9 = !v.matches("(^|.*[^\\.\\d])1\\.[0-8]([^\\d].*|$)");
|
||||||
|
use1_12 = !v.matches("(^|.*[^\\.\\d])1\\.[0-11]([^\\d].*|$)");
|
||||||
|
|
||||||
// load the Config
|
// load the Config
|
||||||
try {
|
try {
|
||||||
@ -280,6 +283,8 @@ public class P extends JavaPlugin {
|
|||||||
useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention");
|
useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention");
|
||||||
useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock");
|
useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock");
|
||||||
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
|
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
|
||||||
|
|
||||||
|
useCitadel = config.getBoolean("useCitadel", false) && getServer().getPluginManager().isPluginEnabled("Citadel");
|
||||||
|
|
||||||
// various Settings
|
// various Settings
|
||||||
DataSave.autosave = config.getInt("autosave", 3);
|
DataSave.autosave = config.getInt("autosave", 3);
|
||||||
|
43
src/com/dre/brewery/integration/CitadelBarrel.java
Normal file
43
src/com/dre/brewery/integration/CitadelBarrel.java
Normal file
@ -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;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user