mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2025-01-06 18:47:44 +01:00
Merge pull request #151 from DevotedMC/master
Update for MC 1.12 by @ProgrammerDan
This commit is contained in:
commit
861b94bded
28
pom.xml
28
pom.xml
@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.dre</groupId>
|
||||
<artifactId>brewery</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6.1</version>
|
||||
<name>Brewery</name>
|
||||
|
||||
<properties>
|
||||
@ -35,8 +35,8 @@
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@ -54,7 +54,7 @@
|
||||
</repository>
|
||||
<repository>
|
||||
<id>vault-repo</id>
|
||||
<url>http://nexus.theyeticave.net/content/repositories/pub_releases</url>
|
||||
<url>http://nexus.hc.to/content/repositories/pub_releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>mcstats-repo</id>
|
||||
@ -68,21 +68,37 @@
|
||||
<id>dre2n-rpo</id>
|
||||
<url>http://feuerstern.bplaced.net/repo/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>devoted-repo</id>
|
||||
<url>https://build.devotedmc.com/plugin/repository/everything/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<version>1.12-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6</version>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
|
@ -265,6 +265,7 @@ cooked:
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
useCitadel: true
|
||||
|
||||
# Änderungen an Fassinventaren mit LogBlock aufzeichen [true]
|
||||
useLogBlock: true
|
||||
|
@ -263,6 +263,7 @@ cooked:
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
useCitadel: true
|
||||
|
||||
# Enable the Logging of Barrel Inventories to LogBlock [true]
|
||||
useLogBlock: true
|
||||
|
@ -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
|
||||
|
@ -263,6 +263,7 @@ cooked:
|
||||
useWorldGuard: true
|
||||
useLWC: true
|
||||
useGriefPrevention: true
|
||||
useCitadel: true
|
||||
|
||||
# Abilita il logging degli inventari dei barili [true]
|
||||
useLogBlock: true
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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);
|
||||
|
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