mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 07:49:03 +00:00
Finalized Merge of 2.0-StoreDataInLore
Rebased onto Master Branch commit e5438e7ae3
And moved to new branch v2.0
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
package com.dre.brewery;
|
package com.dre.brewery;
|
||||||
|
|
||||||
|
import com.dre.brewery.api.events.IngedientAddEvent;
|
||||||
|
import org.bukkit.Effect;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Levelled;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
|
||||||
import org.bukkit.block.data.BlockData;
|
|
||||||
import org.bukkit.block.data.Levelled;
|
|
||||||
import com.dre.brewery.api.events.IngedientAddEvent;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.block.BlockFace;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.Effect;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
|
|
||||||
public class BCauldron {
|
public class BCauldron {
|
||||||
|
public static final byte EMPTY = 0, SOME = 1, FULL = 2;
|
||||||
public static CopyOnWriteArrayList<BCauldron> bcauldrons = new CopyOnWriteArrayList<>(); // TODO find best Collection
|
public static CopyOnWriteArrayList<BCauldron> bcauldrons = new CopyOnWriteArrayList<>(); // TODO find best Collection
|
||||||
|
|
||||||
private BIngredients ingredients = new BIngredients();
|
private BIngredients ingredients = new BIngredients();
|
||||||
@@ -35,7 +37,7 @@ public class BCauldron {
|
|||||||
|
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
// Check if fire still alive
|
// Check if fire still alive
|
||||||
if (!Util.isChunkLoaded(block) || LegacyUtil.isFireForCauldron(block.getRelative(BlockFace.DOWN))) {
|
if (!BUtil.isChunkLoaded(block) || LegacyUtil.isFireForCauldron(block.getRelative(BlockFace.DOWN))) {
|
||||||
// add a minute to cooking time
|
// add a minute to cooking time
|
||||||
state++;
|
state++;
|
||||||
if (someRemoved) {
|
if (someRemoved) {
|
||||||
@@ -74,7 +76,7 @@ public class BCauldron {
|
|||||||
// Calls the IngredientAddEvent and may be cancelled or changed
|
// Calls the IngredientAddEvent and may be cancelled or changed
|
||||||
public static boolean ingredientAdd(Block block, ItemStack ingredient, Player player) {
|
public static boolean ingredientAdd(Block block, ItemStack ingredient, Player player) {
|
||||||
// if not empty
|
// if not empty
|
||||||
if (LegacyUtil.getFillLevel(block) != 0) {
|
if (LegacyUtil.getFillLevel(block) != EMPTY) {
|
||||||
BCauldron bcauldron = get(block);
|
BCauldron bcauldron = get(block);
|
||||||
if (bcauldron == null) {
|
if (bcauldron == null) {
|
||||||
bcauldron = new BCauldron(block);
|
bcauldron = new BCauldron(block);
|
||||||
@@ -84,7 +86,7 @@ public class BCauldron {
|
|||||||
P.p.getServer().getPluginManager().callEvent(event);
|
P.p.getServer().getPluginManager().callEvent(event);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
bcauldron.add(event.getIngredient());
|
bcauldron.add(event.getIngredient());
|
||||||
return event.shouldTakeItem();
|
return event.willTakeItem();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -169,7 +171,7 @@ public class BCauldron {
|
|||||||
|
|
||||||
// reset to normal cauldron
|
// reset to normal cauldron
|
||||||
public static boolean remove(Block block) {
|
public static boolean remove(Block block) {
|
||||||
if (LegacyUtil.getFillLevel(block) != 0) {
|
if (LegacyUtil.getFillLevel(block) != EMPTY) {
|
||||||
BCauldron bcauldron = get(block);
|
BCauldron bcauldron = get(block);
|
||||||
if (bcauldron != null) {
|
if (bcauldron != null) {
|
||||||
bcauldrons.remove(bcauldron);
|
bcauldrons.remove(bcauldron);
|
||||||
@@ -190,7 +192,7 @@ public class BCauldron {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
||||||
Util.createWorldSections(config);
|
BUtil.createWorldSections(config);
|
||||||
|
|
||||||
if (!bcauldrons.isEmpty()) {
|
if (!bcauldrons.isEmpty()) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
@@ -199,7 +201,7 @@ public class BCauldron {
|
|||||||
String prefix;
|
String prefix;
|
||||||
|
|
||||||
if (worldName.startsWith("DXL_")) {
|
if (worldName.startsWith("DXL_")) {
|
||||||
prefix = Util.getDxlName(worldName) + "." + id;
|
prefix = BUtil.getDxlName(worldName) + "." + id;
|
||||||
} else {
|
} else {
|
||||||
prefix = cauldron.block.getWorld().getUID().toString() + "." + id;
|
prefix = cauldron.block.getWorld().getUID().toString() + "." + id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ public class BEffect {
|
|||||||
public void apply(int quality, Player player) {
|
public void apply(int quality, Player player) {
|
||||||
PotionEffect effect = generateEffect(quality);
|
PotionEffect effect = generateEffect(quality);
|
||||||
if (effect != null) {
|
if (effect != null) {
|
||||||
Util.reapplyPotionEffect(player, effect, true);
|
BUtil.reapplyPotionEffect(player, effect, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,11 +128,11 @@ public class BIngredients {
|
|||||||
}
|
}
|
||||||
|
|
||||||
potionMeta.setDisplayName(P.p.color("&f" + cookedName));
|
potionMeta.setDisplayName(P.p.color("&f" + cookedName));
|
||||||
if (!P.use1_14) {
|
//if (!P.use1_14) {
|
||||||
// Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be
|
// Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be
|
||||||
// This is due to the Duration Modifier, that is removed in 1.14
|
// This is due to the Duration Modifier, that is removed in 1.14
|
||||||
uid *= 4;
|
// uid *= 4;
|
||||||
}
|
//}
|
||||||
// This effect stores the UID in its Duration
|
// This effect stores the UID in its Duration
|
||||||
//potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true);
|
//potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true);
|
||||||
|
|
||||||
@@ -363,7 +363,7 @@ public class BIngredients {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "BIngredients{" +
|
return "BIngredients{" +
|
||||||
"cookedTime=" + cookedTime +
|
"cookedTime=" + cookedTime +
|
||||||
", total ingedients: " + getIngredientsCount() + '}';
|
", total ingredients: " + getIngredientsCount() + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void testStore(DataOutputStream out) throws IOException {
|
/*public void testStore(DataOutputStream out) throws IOException {
|
||||||
|
|||||||
@@ -22,13 +22,7 @@ import org.bukkit.util.Vector;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BPlayer {
|
public class BPlayer {
|
||||||
private static Map<String, BPlayer> players = new HashMap<>();// Players name/uuid and BPlayer
|
private static Map<String, BPlayer> players = new HashMap<>();// Players name/uuid and BPlayer
|
||||||
@@ -69,7 +63,7 @@ public class BPlayer {
|
|||||||
|
|
||||||
public static BPlayer get(Player player) {
|
public static BPlayer get(Player player) {
|
||||||
if (!players.isEmpty()) {
|
if (!players.isEmpty()) {
|
||||||
return players.get(Util.playerString(player));
|
return players.get(BUtil.playerString(player));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -117,18 +111,18 @@ public class BPlayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasPlayer(Player player) {
|
public static boolean hasPlayer(Player player) {
|
||||||
return players.containsKey(Util.playerString(player));
|
return players.containsKey(BUtil.playerString(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new BPlayer and add it to the list
|
// Create a new BPlayer and add it to the list
|
||||||
public static BPlayer addPlayer(Player player) {
|
public static BPlayer addPlayer(Player player) {
|
||||||
BPlayer bPlayer = new BPlayer();
|
BPlayer bPlayer = new BPlayer();
|
||||||
players.put(Util.playerString(player), bPlayer);
|
players.put(BUtil.playerString(player), bPlayer);
|
||||||
return bPlayer;
|
return bPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void remove(Player player) {
|
public static void remove(Player player) {
|
||||||
players.remove(Util.playerString(player));
|
players.remove(BUtil.playerString(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int numDrunkPlayers() {
|
public static int numDrunkPlayers() {
|
||||||
@@ -353,7 +347,7 @@ public class BPlayer {
|
|||||||
}
|
}
|
||||||
hangoverEffects(player);
|
hangoverEffects(player);
|
||||||
// wird der spieler noch gebraucht?
|
// wird der spieler noch gebraucht?
|
||||||
players.remove(Util.playerString(player));
|
players.remove(BUtil.playerString(player));
|
||||||
|
|
||||||
} else if (offlineDrunk - drunkeness >= 30) {
|
} else if (offlineDrunk - drunkeness >= 30) {
|
||||||
Location randomLoc = Wakeup.getRandom(player.getLocation());
|
Location randomLoc = Wakeup.getRandom(player.getLocation());
|
||||||
@@ -514,7 +508,7 @@ public class BPlayer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (PotionEffect effect : effects) {
|
for (PotionEffect effect : effects) {
|
||||||
Util.reapplyPotionEffect(player, effect, true);
|
BUtil.reapplyPotionEffect(player, effect, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +576,7 @@ public class BPlayer {
|
|||||||
|
|
||||||
public static void addQualityEffects(int quality, int brewAlc, Player player) {
|
public static void addQualityEffects(int quality, int brewAlc, Player player) {
|
||||||
for (PotionEffect effect : getQualityEffects(quality, brewAlc)) {
|
for (PotionEffect effect : getQualityEffects(quality, brewAlc)) {
|
||||||
Util.reapplyPotionEffect(player, effect, true);
|
BUtil.reapplyPotionEffect(player, effect, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -615,8 +609,8 @@ public class BPlayer {
|
|||||||
}
|
}
|
||||||
int amplifier = getHangoverQuality() / 3;
|
int amplifier = getHangoverQuality() / 3;
|
||||||
|
|
||||||
Util.reapplyPotionEffect(player, PotionEffectType.SLOW.createEffect(duration, amplifier), true);
|
BUtil.reapplyPotionEffect(player, PotionEffectType.SLOW.createEffect(duration, amplifier), true);
|
||||||
Util.reapplyPotionEffect(player, PotionEffectType.HUNGER.createEffect(duration, amplifier), true);
|
BUtil.reapplyPotionEffect(player, PotionEffectType.HUNGER.createEffect(duration, amplifier), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -629,7 +623,7 @@ public class BPlayer {
|
|||||||
|
|
||||||
if (bplayer.drunkeness > 30) {
|
if (bplayer.drunkeness > 30) {
|
||||||
if (bplayer.offlineDrunk == 0) {
|
if (bplayer.offlineDrunk == 0) {
|
||||||
Player player = Util.getPlayerfromString(name);
|
Player player = BUtil.getPlayerfromString(name);
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
|
||||||
bplayer.drunkEffects(player);
|
bplayer.drunkEffects(player);
|
||||||
@@ -657,7 +651,7 @@ public class BPlayer {
|
|||||||
// Prevent 0 drunkeness
|
// Prevent 0 drunkeness
|
||||||
soberPerMin++;
|
soberPerMin++;
|
||||||
}
|
}
|
||||||
if (bplayer.drain(Util.getPlayerfromString(name), soberPerMin)) {
|
if (bplayer.drain(BUtil.getPlayerfromString(name), soberPerMin)) {
|
||||||
iter.remove();
|
iter.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -257,11 +257,11 @@ public class BRecipe {
|
|||||||
|
|
||||||
Brew.PotionColor.fromString(getColor()).colorBrew(potionMeta, potion, false);
|
Brew.PotionColor.fromString(getColor()).colorBrew(potionMeta, potion, false);
|
||||||
potionMeta.setDisplayName(P.p.color("&f" + getName(quality)));
|
potionMeta.setDisplayName(P.p.color("&f" + getName(quality)));
|
||||||
if (!P.use1_14) {
|
//if (!P.use1_14) {
|
||||||
// Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be
|
// Before 1.14 the effects duration would strangely be only a quarter of what we tell it to be
|
||||||
// This is due to the Duration Modifier, that is removed in 1.14
|
// This is due to the Duration Modifier, that is removed in 1.14
|
||||||
uid *= 4;
|
// uid *= 4;
|
||||||
}
|
//}
|
||||||
// This effect stores the UID in its Duration
|
// This effect stores the UID in its Duration
|
||||||
//potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true);
|
//potionMeta.addCustomEffect((PotionEffectType.REGENERATION).createEffect((uid * 4), 0), true);
|
||||||
|
|
||||||
@@ -288,7 +288,7 @@ public class BRecipe {
|
|||||||
|
|
||||||
BIngredients bIngredients = new BIngredients(list, cookingTime);
|
BIngredients bIngredients = new BIngredients(list, cookingTime);
|
||||||
|
|
||||||
return new Brew(bIngredients, quality, distillruns, getAge(), wood, getName(5), false, true);
|
return new Brew(bIngredients, quality, distillruns, getAge(), wood, getName(5), false, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+208
-55
@@ -1,13 +1,94 @@
|
|||||||
package com.dre.brewery;
|
package com.dre.brewery;
|
||||||
|
|
||||||
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ListIterator;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public class BUtil {
|
public class BUtil {
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/********** **********/
|
||||||
|
/********** Bukkit Utils **********/
|
||||||
|
/********** **********/
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
|
// Check if the Chunk of a Block is loaded !without loading it in the process!
|
||||||
|
public static boolean isChunkLoaded(Block block) {
|
||||||
|
return block.getWorld().isChunkLoaded(block.getX() >> 4, block.getZ() >> 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String color(String msg) {
|
||||||
|
if (msg != null) {
|
||||||
|
msg = ChatColor.translateAlternateColorCodes('&', msg);
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns either uuid or Name of player, depending on bukkit version
|
||||||
|
public static String playerString(Player player) {
|
||||||
|
if (P.useUUID) {
|
||||||
|
return player.getUniqueId().toString();
|
||||||
|
} else {
|
||||||
|
return player.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns the Player if online
|
||||||
|
public static Player getPlayerfromString(String name) {
|
||||||
|
if (P.useUUID) {
|
||||||
|
try {
|
||||||
|
return Bukkit.getPlayer(UUID.fromString(name));
|
||||||
|
} catch (Exception e) {
|
||||||
|
return Bukkit.getPlayerExact(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Bukkit.getPlayerExact(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply a Potion Effect, if player already has this effect, overwrite the existing effect.
|
||||||
|
// Optionally only overwrite if the new one is stronger, i.e. has higher level or longer duration
|
||||||
|
public static void reapplyPotionEffect(Player player, PotionEffect effect, boolean onlyIfStronger) {
|
||||||
|
final PotionEffectType type = effect.getType();
|
||||||
|
if (player.hasPotionEffect(type)) {
|
||||||
|
PotionEffect plEffect;
|
||||||
|
if (P.use1_11) {
|
||||||
|
plEffect = player.getPotionEffect(type);
|
||||||
|
} else {
|
||||||
|
plEffect = player.getActivePotionEffects().stream().filter(e -> e.getType().equals(type)).findAny().get();
|
||||||
|
}
|
||||||
|
if (plEffect.getAmplifier() < effect.getAmplifier() || (plEffect.getAmplifier() == effect.getAmplifier() && plEffect.getDuration() < effect.getDuration())) {
|
||||||
|
player.removePotionEffect(type);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
effect.apply(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/********** **********/
|
||||||
|
/********** String Utils **********/
|
||||||
|
/********** **********/
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
// Returns the Index of a String from the list that contains this substring
|
// Returns the Index of a String from the list that contains this substring
|
||||||
public static int indexOfSubstring(List<String> list, String substring) {
|
public static int indexOfSubstring(List<String> list, String substring) {
|
||||||
if (list.isEmpty()) return -1;
|
if (list.isEmpty()) return -1;
|
||||||
@@ -30,71 +111,143 @@ public class BUtil {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/******************************************/
|
||||||
---- Barrel ----
|
/********** **********/
|
||||||
*/
|
/********** Brewery Utils **********/
|
||||||
|
/********** **********/
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
|
// create empty World save Sections
|
||||||
|
public static void createWorldSections(ConfigurationSection section) {
|
||||||
|
for (World world : P.p.getServer().getWorlds()) {
|
||||||
|
String worldName = world.getName();
|
||||||
|
if (worldName.startsWith("DXL_")) {
|
||||||
|
worldName = getDxlName(worldName);
|
||||||
|
} else {
|
||||||
|
worldName = world.getUID().toString();
|
||||||
|
}
|
||||||
|
section.createSection(worldName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Returns true if the Block can be destroyed by the Player or something else (null)
|
// Returns true if the Block can be destroyed by the Player or something else (null)
|
||||||
public static boolean blockDestroy(Block block, Player player, BarrelDestroyEvent.Reason reason) {
|
public static boolean blockDestroy(Block block, Player player, BarrelDestroyEvent.Reason reason) {
|
||||||
switch (block.getType()) {
|
Material type = block.getType();
|
||||||
case CAULDRON:
|
if (type == Material.CAULDRON) {
|
||||||
// will only remove when existing
|
// will only remove when existing
|
||||||
BCauldron.remove(block);
|
BCauldron.remove(block);
|
||||||
return true;
|
return true;
|
||||||
case FENCE:
|
|
||||||
case NETHER_FENCE:
|
} else if (LegacyUtil.isFence(type)) {
|
||||||
case ACACIA_FENCE:
|
// remove barrel and throw potions on the ground
|
||||||
case BIRCH_FENCE:
|
Barrel barrel = Barrel.getBySpigot(block);
|
||||||
case DARK_OAK_FENCE:
|
if (barrel != null) {
|
||||||
case IRON_FENCE:
|
if (barrel.hasPermsDestroy(player, block, reason)) {
|
||||||
case JUNGLE_FENCE:
|
barrel.remove(null, player);
|
||||||
case SPRUCE_FENCE:
|
return true;
|
||||||
// remove barrel and throw potions on the ground
|
} else {
|
||||||
Barrel barrel = Barrel.getBySpigot(block);
|
return false;
|
||||||
if (barrel != null) {
|
}
|
||||||
if (barrel.hasPermsDestroy(player, block, reason)) {
|
}
|
||||||
barrel.remove(null, player);
|
return true;
|
||||||
|
|
||||||
|
} else if (LegacyUtil.isSign(type)) {
|
||||||
|
// remove small Barrels
|
||||||
|
Barrel barrel2 = Barrel.getBySpigot(block);
|
||||||
|
if (barrel2 != null) {
|
||||||
|
if (!barrel2.isLarge()) {
|
||||||
|
if (barrel2.hasPermsDestroy(player, block, reason)) {
|
||||||
|
barrel2.remove(null, player);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
barrel2.destroySign();
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
case SIGN_POST:
|
return true;
|
||||||
case WALL_SIGN:
|
|
||||||
// remove small Barrels
|
} else if (LegacyUtil.isWoodPlanks(type) || LegacyUtil.isWoodStairs(type)){
|
||||||
Barrel barrel2 = Barrel.getBySpigot(block);
|
Barrel barrel3 = Barrel.getByWood(block);
|
||||||
if (barrel2 != null) {
|
if (barrel3 != null) {
|
||||||
if (!barrel2.isLarge()) {
|
if (barrel3.hasPermsDestroy(player, block, reason)) {
|
||||||
if (barrel2.hasPermsDestroy(player, block, reason)) {
|
barrel3.remove(block, player);
|
||||||
barrel2.remove(null, player);
|
} else {
|
||||||
return true;
|
return false;
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
barrel2.destroySign();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
}
|
||||||
case WOOD:
|
|
||||||
case WOOD_STAIRS:
|
|
||||||
case BIRCH_WOOD_STAIRS:
|
|
||||||
case JUNGLE_WOOD_STAIRS:
|
|
||||||
case SPRUCE_WOOD_STAIRS:
|
|
||||||
case ACACIA_STAIRS:
|
|
||||||
case DARK_OAK_STAIRS:
|
|
||||||
Barrel barrel3 = Barrel.getByWood(block);
|
|
||||||
if (barrel3 != null) {
|
|
||||||
if (barrel3.hasPermsDestroy(player, block, reason)) {
|
|
||||||
barrel3.remove(block, player);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************/
|
||||||
|
/********** **********/
|
||||||
|
/********** Other Utils **********/
|
||||||
|
/********** **********/
|
||||||
|
/******************************************/
|
||||||
|
|
||||||
|
// prints a list of Strings at the specified page
|
||||||
|
public static void list(CommandSender sender, ArrayList<String> strings, int page) {
|
||||||
|
int pages = (int) Math.ceil(strings.size() / 7F);
|
||||||
|
if (page > pages || page < 1) {
|
||||||
|
page = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(color("&7-------------- &f" + P.p.languageReader.get("Etc_Page") + " &6" + page + "&f/&6" + pages + " &7--------------"));
|
||||||
|
|
||||||
|
ListIterator<String> iter = strings.listIterator((page - 1) * 7);
|
||||||
|
|
||||||
|
for (int i = 0; i < 7; i++) {
|
||||||
|
if (iter.hasNext()) {
|
||||||
|
sender.sendMessage(color(iter.next()));
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// gets the Name of a DXL World
|
||||||
|
public static String getDxlName(String worldName) {
|
||||||
|
File dungeonFolder = new File(worldName);
|
||||||
|
if (dungeonFolder.isDirectory()) {
|
||||||
|
for (File file : dungeonFolder.listFiles()) {
|
||||||
|
if (!file.isDirectory()) {
|
||||||
|
if (file.getName().startsWith(".id_")) {
|
||||||
|
return file.getName().substring(1).toLowerCase();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return worldName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
|
public static void saveFile(InputStream in, File dest, String name, boolean overwrite) throws IOException {
|
||||||
|
if (in == null) return;
|
||||||
|
if (!dest.exists()) {
|
||||||
|
dest.mkdirs();
|
||||||
|
}
|
||||||
|
File result = new File(dest, name);
|
||||||
|
if (result.exists()) {
|
||||||
|
if (overwrite) {
|
||||||
|
result.delete();
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
OutputStream out = new FileOutputStream(result);
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
|
||||||
|
int length;
|
||||||
|
//copy the file content in bytes
|
||||||
|
while ((length = in.read(buffer)) > 0){
|
||||||
|
out.write(buffer, 0, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
in.close();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,11 @@ import com.dre.brewery.api.events.barrel.BarrelAccessEvent;
|
|||||||
import com.dre.brewery.api.events.barrel.BarrelCreateEvent;
|
import com.dre.brewery.api.events.barrel.BarrelCreateEvent;
|
||||||
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
||||||
import com.dre.brewery.api.events.barrel.BarrelRemoveEvent;
|
import com.dre.brewery.api.events.barrel.BarrelRemoveEvent;
|
||||||
import com.dre.brewery.integration.CitadelBarrel;
|
|
||||||
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;
|
||||||
import com.dre.brewery.lore.BrewLore;
|
import com.dre.brewery.lore.BrewLore;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.TreeSpecies;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
@@ -21,10 +18,6 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.PotionMeta;
|
import org.bukkit.inventory.meta.PotionMeta;
|
||||||
import org.bukkit.material.MaterialData;
|
|
||||||
import org.bukkit.material.Stairs;
|
|
||||||
import org.bukkit.material.Tree;
|
|
||||||
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;
|
||||||
|
|
||||||
@@ -142,7 +135,7 @@ public class Barrel implements InventoryHolder {
|
|||||||
if (plugin != null) {
|
if (plugin != null) {
|
||||||
|
|
||||||
// If the Clicked Block was the Sign, LWC already knows and we dont need to do anything here
|
// If the Clicked Block was the Sign, LWC already knows and we dont need to do anything here
|
||||||
if (!isSign(event.getClickedBlock())) {
|
if (!LegacyUtil.isSign(event.getClickedBlock().getType())) {
|
||||||
Block sign = getSignOfSpigot();
|
Block sign = getSignOfSpigot();
|
||||||
// If the Barrel does not have a Sign, it cannot be locked
|
// If the Barrel does not have a Sign, it cannot be locked
|
||||||
if (!sign.equals(event.getClickedBlock())) {
|
if (!sign.equals(event.getClickedBlock())) {
|
||||||
@@ -410,14 +403,14 @@ public class Barrel implements InventoryHolder {
|
|||||||
inventory.clear();
|
inventory.clear();
|
||||||
if (P.p.useLB && breaker != null) {
|
if (P.p.useLB && breaker != null) {
|
||||||
try {
|
try {
|
||||||
LogBlockBarrel.breakBarrel(breaker.getName(), items, spigot.getLocation());
|
LogBlockBarrel.breakBarrel(breaker, items, spigot.getLocation());
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
P.p.errorLog("Failed to Log Barrel-break to LogBlock!");
|
P.p.errorLog("Failed to Log Barrel-break to LogBlock!");
|
||||||
P.p.errorLog("Brewery was tested with version 1.94 of LogBlock!");
|
P.p.errorLog("Brewery was tested with version 1.94 of LogBlock!");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.shouldItemsDrop()) {
|
if (event.willItemsDrop()) {
|
||||||
for (ItemStack item : items) {
|
for (ItemStack item : items) {
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
Brew brew = Brew.get(item);
|
Brew brew = Brew.get(item);
|
||||||
@@ -462,7 +455,7 @@ public class Barrel implements InventoryHolder {
|
|||||||
|
|
||||||
// Saves all data
|
// Saves all data
|
||||||
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
||||||
Util.createWorldSections(config);
|
BUtil.createWorldSections(config);
|
||||||
|
|
||||||
if (!barrels.isEmpty()) {
|
if (!barrels.isEmpty()) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
@@ -472,7 +465,7 @@ public class Barrel implements InventoryHolder {
|
|||||||
String prefix;
|
String prefix;
|
||||||
|
|
||||||
if (worldName.startsWith("DXL_")) {
|
if (worldName.startsWith("DXL_")) {
|
||||||
prefix = Util.getDxlName(worldName) + "." + id;
|
prefix = BUtil.getDxlName(worldName) + "." + id;
|
||||||
} else {
|
} else {
|
||||||
prefix = barrel.spigot.getWorld().getUID().toString() + "." + id;
|
prefix = barrel.spigot.getWorld().getUID().toString() + "." + id;
|
||||||
}
|
}
|
||||||
@@ -638,7 +631,7 @@ public class Barrel implements InventoryHolder {
|
|||||||
// the barrel needs to be formed correctly
|
// the barrel needs to be formed correctly
|
||||||
// flag force to also check if chunk is not loaded
|
// flag force to also check if chunk is not loaded
|
||||||
public Block getBrokenBlock(boolean force) {
|
public Block getBrokenBlock(boolean force) {
|
||||||
if (force || Util.isChunkLoaded(spigot)) {
|
if (force || BUtil.isChunkLoaded(spigot)) {
|
||||||
spigot = getSpigotOfSign(spigot);
|
spigot = getSpigotOfSign(spigot);
|
||||||
if (LegacyUtil.isSign(spigot.getType())) {
|
if (LegacyUtil.isSign(spigot.getType())) {
|
||||||
return checkSBarrel();
|
return checkSBarrel();
|
||||||
@@ -825,7 +818,6 @@ public class Barrel implements InventoryHolder {
|
|||||||
P.p.debugLog("Barrel at " + broken.getWorld().getName() + "/" + broken.getX() + "/" + broken.getY() + "/" + broken.getZ()
|
P.p.debugLog("Barrel at " + broken.getWorld().getName() + "/" + broken.getX() + "/" + broken.getY() + "/" + broken.getZ()
|
||||||
+ " has been destroyed unexpectedly, contents will drop");
|
+ " has been destroyed unexpectedly, contents will drop");
|
||||||
// remove the barrel if it was destroyed
|
// remove the barrel if it was destroyed
|
||||||
barrel.willDestroy(); // TODO Check if still needed
|
|
||||||
barrel.remove(broken, null);
|
barrel.remove(broken, null);
|
||||||
} else {
|
} else {
|
||||||
// Dont check this barrel again, its enough to check it once after every restart
|
// Dont check this barrel again, its enough to check it once after every restart
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.dre.brewery;
|
package com.dre.brewery;
|
||||||
|
|
||||||
import org.bukkit.Color;
|
|
||||||
import com.dre.brewery.api.events.brew.BrewModifyEvent;
|
import com.dre.brewery.api.events.brew.BrewModifyEvent;
|
||||||
import com.dre.brewery.lore.*;
|
import com.dre.brewery.lore.*;
|
||||||
|
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;
|
||||||
@@ -42,7 +42,7 @@ public class Brew {
|
|||||||
private boolean unlabeled;
|
private boolean unlabeled;
|
||||||
private boolean persistent; // Only for legacy
|
private boolean persistent; // Only for legacy
|
||||||
private boolean immutable; // static/immutable potions should not be changed
|
private boolean immutable; // static/immutable potions should not be changed
|
||||||
//private int lastUpdate; // last update in hours after install time
|
private int lastUpdate; // last update in hours after install time
|
||||||
|
|
||||||
public Brew(BIngredients ingredients) {
|
public Brew(BIngredients ingredients) {
|
||||||
this.ingredients = ingredients;
|
this.ingredients = ingredients;
|
||||||
@@ -56,7 +56,7 @@ public class Brew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// loading with all values set
|
// loading with all values set
|
||||||
public Brew(BIngredients ingredients, int quality, byte distillRuns, float ageTime, float wood, String recipe, boolean unlabeled, boolean immutable) {
|
public Brew(BIngredients ingredients, int quality, byte distillRuns, float ageTime, float wood, String recipe, boolean unlabeled, boolean immutable, int lastUpdate) {
|
||||||
this.ingredients = ingredients;
|
this.ingredients = ingredients;
|
||||||
this.quality = quality;
|
this.quality = quality;
|
||||||
this.distillRuns = distillRuns;
|
this.distillRuns = distillRuns;
|
||||||
@@ -64,6 +64,7 @@ public class Brew {
|
|||||||
this.wood = wood;
|
this.wood = wood;
|
||||||
this.unlabeled = unlabeled;
|
this.unlabeled = unlabeled;
|
||||||
this.immutable = immutable;
|
this.immutable = immutable;
|
||||||
|
this.lastUpdate = lastUpdate;
|
||||||
setRecipeFromString(recipe);
|
setRecipeFromString(recipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,6 +78,7 @@ public class Brew {
|
|||||||
if (meta instanceof PotionMeta && ((PotionMeta) meta).hasCustomEffect(PotionEffectType.REGENERATION)) {
|
if (meta instanceof PotionMeta && ((PotionMeta) meta).hasCustomEffect(PotionEffectType.REGENERATION)) {
|
||||||
Brew brew = load(meta);
|
Brew brew = load(meta);
|
||||||
if (brew != null) {
|
if (brew != null) {
|
||||||
|
// Load Legacy
|
||||||
brew = getFromPotionEffect(((PotionMeta) meta), false);
|
brew = getFromPotionEffect(((PotionMeta) meta), false);
|
||||||
}
|
}
|
||||||
return brew;
|
return brew;
|
||||||
@@ -98,6 +100,7 @@ public class Brew {
|
|||||||
if (brew != null) {
|
if (brew != null) {
|
||||||
((PotionMeta) meta).removeCustomEffect(PotionEffectType.REGENERATION);
|
((PotionMeta) meta).removeCustomEffect(PotionEffectType.REGENERATION);
|
||||||
} else {
|
} else {
|
||||||
|
// Load Legacy and convert
|
||||||
brew = getFromPotionEffect(((PotionMeta) meta), true);
|
brew = getFromPotionEffect(((PotionMeta) meta), true);
|
||||||
if (brew == null) return null;
|
if (brew == null) return null;
|
||||||
brew.save(meta);
|
brew.save(meta);
|
||||||
@@ -113,6 +116,7 @@ public class Brew {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy Brew Loading
|
||||||
private static Brew getFromPotionEffect(PotionMeta potionMeta, boolean remove) {
|
private static Brew getFromPotionEffect(PotionMeta potionMeta, boolean remove) {
|
||||||
for (PotionEffect effect : potionMeta.getCustomEffects()) {
|
for (PotionEffect effect : potionMeta.getCustomEffects()) {
|
||||||
if (effect.getType().equals(PotionEffectType.REGENERATION)) {
|
if (effect.getType().equals(PotionEffectType.REGENERATION)) {
|
||||||
@@ -365,9 +369,8 @@ public class Brew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do some regular updates
|
// Do some regular updates
|
||||||
// Currently does nothing, but may be used to update something on this brew
|
|
||||||
public void touch() {
|
public void touch() {
|
||||||
//lastUpdate = (int) ((double) (System.currentTimeMillis() - installTime) / 3600000D);
|
lastUpdate = (int) ((double) (System.currentTimeMillis() - installTime) / 3600000D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getDistillRuns() {
|
public byte getDistillRuns() {
|
||||||
@@ -439,9 +442,9 @@ public class Brew {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public int getLastUpdate() {
|
public int getLastUpdate() {
|
||||||
return lastUpdate;
|
return lastUpdate;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Distilling section ---------------
|
// Distilling section ---------------
|
||||||
|
|
||||||
@@ -459,6 +462,7 @@ public class Brew {
|
|||||||
// distill custom potion in given slot
|
// distill custom potion in given slot
|
||||||
public void distillSlot(ItemStack slotItem, PotionMeta potionMeta) {
|
public void distillSlot(ItemStack slotItem, PotionMeta potionMeta) {
|
||||||
if (immutable) return;
|
if (immutable) return;
|
||||||
|
//List<Consumer<Brew>> fcts = new ArrayList<>();
|
||||||
BrewModifyEvent modifyEvent = new BrewModifyEvent(this, BrewModifyEvent.Type.DISTILL);
|
BrewModifyEvent modifyEvent = new BrewModifyEvent(this, BrewModifyEvent.Type.DISTILL);
|
||||||
P.p.getServer().getPluginManager().callEvent(modifyEvent);
|
P.p.getServer().getPluginManager().callEvent(modifyEvent);
|
||||||
if (modifyEvent.isCancelled()) return;
|
if (modifyEvent.isCancelled()) return;
|
||||||
@@ -574,7 +578,7 @@ public class Brew {
|
|||||||
factor = 2;
|
factor = 2;
|
||||||
} else if (ageTime > 10) {
|
} else if (ageTime > 10) {
|
||||||
factor = 2;
|
factor = 2;
|
||||||
factor += (float) ageTime / 10F;
|
factor += ageTime / 10F;
|
||||||
}
|
}
|
||||||
if (wood > to) {
|
if (wood > to) {
|
||||||
wood -= time / factor;
|
wood -= time / factor;
|
||||||
@@ -723,8 +727,8 @@ public class Brew {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load potion data from data file for backwards compatibility
|
// Load potion data from data file for backwards compatibility
|
||||||
public static void loadLegacy(BIngredients ingredients, int uid, int quality, byte distillRuns, float ageTime, float wood, String recipe, boolean unlabeled, boolean persistent, boolean stat) {
|
public static void loadLegacy(BIngredients ingredients, int uid, int quality, byte distillRuns, float ageTime, float wood, String recipe, boolean unlabeled, boolean persistent, boolean stat, int lastUpdate) {
|
||||||
Brew brew = new Brew(ingredients, quality, distillRuns, ageTime, wood, recipe, unlabeled, stat);
|
Brew brew = new Brew(ingredients, quality, distillRuns, ageTime, wood, recipe, unlabeled, stat, lastUpdate);
|
||||||
brew.persistent = persistent;
|
brew.persistent = persistent;
|
||||||
legacyPotions.put(uid, brew);
|
legacyPotions.put(uid, brew);
|
||||||
}
|
}
|
||||||
@@ -751,7 +755,7 @@ public class Brew {
|
|||||||
if (hasRecipe()) {
|
if (hasRecipe()) {
|
||||||
BrewLore lore = new BrewLore(this, potionMeta);
|
BrewLore lore = new BrewLore(this, potionMeta);
|
||||||
lore.removeEffects();
|
lore.removeEffects();
|
||||||
PotionColor.valueOf(currentRecipe.getColor()).colorBrew(potionMeta, item, canDistill());
|
PotionColor.fromString(currentRecipe.getColor()).colorBrew(potionMeta, item, canDistill());
|
||||||
} else {
|
} else {
|
||||||
PotionColor.GREY.colorBrew(potionMeta, item, canDistill());
|
PotionColor.GREY.colorBrew(potionMeta, item, canDistill());
|
||||||
}
|
}
|
||||||
@@ -792,9 +796,9 @@ public class Brew {
|
|||||||
if (brew.immutable) {
|
if (brew.immutable) {
|
||||||
idConfig.set("stat", true);
|
idConfig.set("stat", true);
|
||||||
}
|
}
|
||||||
/*if (brew.lastUpdate > 0) {
|
if (brew.lastUpdate > 0) {
|
||||||
idConfig.set("lastUpdate", brew.lastUpdate);
|
idConfig.set("lastUpdate", brew.lastUpdate);
|
||||||
}*/
|
}
|
||||||
// save the ingredients
|
// save the ingredients
|
||||||
idConfig.set("ingId", brew.ingredients.save(config.getParent()));
|
idConfig.set("ingId", brew.ingredients.save(config.getParent()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,10 @@ import java.lang.reflect.Method;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.dre.brewery.BCauldron.EMPTY;
|
||||||
|
import static com.dre.brewery.BCauldron.SOME;
|
||||||
|
import static com.dre.brewery.BCauldron.FULL;
|
||||||
|
|
||||||
@SuppressWarnings("JavaReflectionMemberAccess")
|
@SuppressWarnings("JavaReflectionMemberAccess")
|
||||||
public class LegacyUtil {
|
public class LegacyUtil {
|
||||||
|
|
||||||
@@ -190,27 +194,27 @@ public class LegacyUtil {
|
|||||||
// 0 = empty, 1 = something in, 2 = full
|
// 0 = empty, 1 = something in, 2 = full
|
||||||
public static byte getFillLevel(Block block) {
|
public static byte getFillLevel(Block block) {
|
||||||
if (block.getType() != Material.CAULDRON) {
|
if (block.getType() != Material.CAULDRON) {
|
||||||
return 0;
|
return EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (P.use1_13) {
|
if (P.use1_13) {
|
||||||
Levelled cauldron = ((Levelled) block.getBlockData());
|
Levelled cauldron = ((Levelled) block.getBlockData());
|
||||||
if (cauldron.getLevel() == 0) {
|
if (cauldron.getLevel() == 0) {
|
||||||
return 0;
|
return EMPTY;
|
||||||
} else if (cauldron.getLevel() == cauldron.getMaximumLevel()) {
|
} else if (cauldron.getLevel() == cauldron.getMaximumLevel()) {
|
||||||
return 2;
|
return FULL;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return SOME;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Cauldron cauldron = (Cauldron) block.getState().getData();
|
Cauldron cauldron = (Cauldron) block.getState().getData();
|
||||||
if (cauldron.isEmpty()) {
|
if (cauldron.isEmpty()) {
|
||||||
return 0;
|
return EMPTY;
|
||||||
} else if (cauldron.isFull()) {
|
} else if (cauldron.isFull()) {
|
||||||
return 2;
|
return FULL;
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return SOME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-81
@@ -5,19 +5,8 @@ import com.dre.brewery.filedata.DataSave;
|
|||||||
import com.dre.brewery.filedata.DataUpdater;
|
import com.dre.brewery.filedata.DataUpdater;
|
||||||
import com.dre.brewery.filedata.LanguageReader;
|
import com.dre.brewery.filedata.LanguageReader;
|
||||||
import com.dre.brewery.filedata.UpdateChecker;
|
import com.dre.brewery.filedata.UpdateChecker;
|
||||||
import com.dre.brewery.integration.IntegrationListener;
|
import com.dre.brewery.integration.*;
|
||||||
import com.dre.brewery.integration.LogBlockBarrel;
|
import com.dre.brewery.listeners.*;
|
||||||
import com.dre.brewery.integration.WGBarrel;
|
|
||||||
import com.dre.brewery.integration.WGBarrel7;
|
|
||||||
import com.dre.brewery.integration.WGBarrelNew;
|
|
||||||
import com.dre.brewery.integration.WGBarrelOld;
|
|
||||||
import com.dre.brewery.listeners.BlockListener;
|
|
||||||
import com.dre.brewery.listeners.CauldronListener;
|
|
||||||
import com.dre.brewery.listeners.CommandListener;
|
|
||||||
import com.dre.brewery.listeners.EntityListener;
|
|
||||||
import com.dre.brewery.listeners.InventoryListener;
|
|
||||||
import com.dre.brewery.listeners.PlayerListener;
|
|
||||||
import com.dre.brewery.listeners.WorldListener;
|
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
import org.bstats.bukkit.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@@ -25,7 +14,6 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import com.dre.brewery.lore.LoreOutputStream;
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
@@ -38,14 +26,11 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@@ -360,7 +345,7 @@ public class P extends JavaPlugin {
|
|||||||
readData();
|
readData();
|
||||||
|
|
||||||
// Setup Metrics
|
// Setup Metrics
|
||||||
try {
|
/*try {
|
||||||
Metrics metrics = new Metrics(this);
|
Metrics metrics = new Metrics(this);
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("drunk_players", BPlayer::numDrunkPlayers));
|
metrics.addCustomChart(new Metrics.SingleLineChart("drunk_players", BPlayer::numDrunkPlayers));
|
||||||
metrics.addCustomChart(new Metrics.SingleLineChart("brews_in_existence", () -> Brew.potions.size()));
|
metrics.addCustomChart(new Metrics.SingleLineChart("brews_in_existence", () -> Brew.potions.size()));
|
||||||
@@ -416,7 +401,7 @@ public class P extends JavaPlugin {
|
|||||||
}));
|
}));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Listeners
|
// Listeners
|
||||||
blockListener = new BlockListener();
|
blockListener = new BlockListener();
|
||||||
@@ -592,9 +577,6 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
// Third-Party
|
// Third-Party
|
||||||
useWG = config.getBoolean("useWorldGuard", true) && getServer().getPluginManager().isPluginEnabled("WorldGuard");
|
useWG = config.getBoolean("useWorldGuard", true) && getServer().getPluginManager().isPluginEnabled("WorldGuard");
|
||||||
useLWC = config.getBoolean("useLWC", true) && getServer().getPluginManager().isPluginEnabled("LWC");
|
|
||||||
useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention");
|
|
||||||
useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock");
|
|
||||||
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
|
hasVault = getServer().getPluginManager().isPluginEnabled("Vault");
|
||||||
|
|
||||||
if (useWG) {
|
if (useWG) {
|
||||||
@@ -773,9 +755,9 @@ public class P extends JavaPlugin {
|
|||||||
boolean unlabeled = section.getBoolean(uid + ".unlabeled", false);
|
boolean unlabeled = section.getBoolean(uid + ".unlabeled", false);
|
||||||
boolean persistent = section.getBoolean(uid + ".persist", false);
|
boolean persistent = section.getBoolean(uid + ".persist", false);
|
||||||
boolean stat = section.getBoolean(uid + ".stat", false);
|
boolean stat = section.getBoolean(uid + ".stat", false);
|
||||||
//int lastUpdate = section.getInt("lastUpdate", 0);
|
int lastUpdate = section.getInt("lastUpdate", 0);
|
||||||
|
|
||||||
Brew.loadLegacy(ingredients, parseInt(uid), quality, distillRuns, ageTime, wood, recipe, unlabeled, persistent, stat);
|
Brew.loadLegacy(ingredients, parseInt(uid), quality, distillRuns, ageTime, wood, recipe, unlabeled, persistent, stat, lastUpdate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -806,7 +788,7 @@ public class P extends JavaPlugin {
|
|||||||
|
|
||||||
for (World world : p.getServer().getWorlds()) {
|
for (World world : p.getServer().getWorlds()) {
|
||||||
if (world.getName().startsWith("DXL_")) {
|
if (world.getName().startsWith("DXL_")) {
|
||||||
loadWorldData(Util.getDxlName(world.getName()), world);
|
loadWorldData(BUtil.getDxlName(world.getName()), world);
|
||||||
} else {
|
} else {
|
||||||
loadWorldData(world.getUID().toString(), world);
|
loadWorldData(world.getUID().toString(), world);
|
||||||
}
|
}
|
||||||
@@ -967,7 +949,7 @@ public class P extends JavaPlugin {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Util.saveFile(defconf, getDataFolder(), "config.yml", false);
|
BUtil.saveFile(defconf, getDataFolder(), "config.yml", false);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
@@ -988,8 +970,8 @@ public class P extends JavaPlugin {
|
|||||||
for (String l : new String[] {"de", "en", "fr", "it", "zh", "tw"}) {
|
for (String l : new String[] {"de", "en", "fr", "it", "zh", "tw"}) {
|
||||||
File lfold = new File(configs, l);
|
File lfold = new File(configs, l);
|
||||||
try {
|
try {
|
||||||
Util.saveFile(getResource("config/" + (use1_13 ? "v13/" : "v12/") + l + "/config.yml"), lfold, "config.yml", overwrite);
|
BUtil.saveFile(getResource("config/" + (use1_13 ? "v13/" : "v12/") + l + "/config.yml"), lfold, "config.yml", overwrite);
|
||||||
Util.saveFile(getResource("languages/" + l + ".yml"), languages, l + ".yml", false); // Never overwrite languages for now
|
BUtil.saveFile(getResource("languages/" + l + ".yml"), languages, l + ".yml", false); // Never overwrite languages for now
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (!(l.equals("zh") || l.equals("tw"))) {
|
if (!(l.equals("zh") || l.equals("tw"))) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@@ -1004,60 +986,8 @@ public class P extends JavaPlugin {
|
|||||||
return NumberUtils.toInt(string, 0);
|
return NumberUtils.toInt(string, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Returns true if the Block can be destroyed by the Player or something else (null)
|
|
||||||
public boolean blockDestroy(Block block, Player player) {
|
|
||||||
Material type = block.getType();
|
|
||||||
if (type == Material.CAULDRON) {
|
|
||||||
// will only remove when existing
|
|
||||||
BCauldron.remove(block);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (LegacyUtil.isFence(type)) {
|
|
||||||
// remove barrel and throw potions on the ground
|
|
||||||
Barrel barrel = Barrel.getBySpigot(block);
|
|
||||||
if (barrel != null) {
|
|
||||||
if (barrel.hasPermsDestroy(player)) {
|
|
||||||
barrel.remove(null, player);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (LegacyUtil.isSign(type)) {
|
|
||||||
// remove small Barrels
|
|
||||||
Barrel barrel2 = Barrel.getBySpigot(block);
|
|
||||||
if (barrel2 != null) {
|
|
||||||
if (!barrel2.isLarge()) {
|
|
||||||
if (barrel2.hasPermsDestroy(player)) {
|
|
||||||
barrel2.remove(null, player);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
barrel2.destroySign();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else if (LegacyUtil.isWoodPlanks(type) || LegacyUtil.isWoodStairs(type)){
|
|
||||||
Barrel barrel3 = Barrel.getByWood(block);
|
|
||||||
if (barrel3 != null) {
|
|
||||||
if (barrel3.hasPermsDestroy(player)) {
|
|
||||||
barrel3.remove(block, player);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String color(String msg) {
|
public String color(String msg) {
|
||||||
return Util.color(msg);
|
return BUtil.color(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,157 +0,0 @@
|
|||||||
package com.dre.brewery;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.ListIterator;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class Util {
|
|
||||||
|
|
||||||
/********** Bukkit Utils **********/
|
|
||||||
|
|
||||||
// Check if the Chunk of a Block is loaded !without loading it in the process!
|
|
||||||
public static boolean isChunkLoaded(Block block) {
|
|
||||||
return block.getWorld().isChunkLoaded(block.getX() >> 4, block.getZ() >> 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String color(String msg) {
|
|
||||||
if (msg != null) {
|
|
||||||
msg = ChatColor.translateAlternateColorCodes('&', msg);
|
|
||||||
}
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns either uuid or Name of player, depending on bukkit version
|
|
||||||
public static String playerString(Player player) {
|
|
||||||
if (P.useUUID) {
|
|
||||||
return player.getUniqueId().toString();
|
|
||||||
} else {
|
|
||||||
return player.getName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// returns the Player if online
|
|
||||||
public static Player getPlayerfromString(String name) {
|
|
||||||
if (P.useUUID) {
|
|
||||||
try {
|
|
||||||
return Bukkit.getPlayer(UUID.fromString(name));
|
|
||||||
} catch (Exception e) {
|
|
||||||
return Bukkit.getPlayerExact(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Bukkit.getPlayerExact(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply a Potion Effect, if player already has this effect, overwrite the existing effect.
|
|
||||||
// Optionally only overwrite if the new one is stronger, i.e. has higher level or longer duration
|
|
||||||
public static void reapplyPotionEffect(Player player, PotionEffect effect, boolean onlyIfStronger) {
|
|
||||||
final PotionEffectType type = effect.getType();
|
|
||||||
if (player.hasPotionEffect(type)) {
|
|
||||||
PotionEffect plEffect;
|
|
||||||
if (P.use1_11) {
|
|
||||||
plEffect = player.getPotionEffect(type);
|
|
||||||
} else {
|
|
||||||
plEffect = player.getActivePotionEffects().stream().filter(e -> e.getType().equals(type)).findAny().get();
|
|
||||||
}
|
|
||||||
if (plEffect.getAmplifier() < effect.getAmplifier() || (plEffect.getAmplifier() == effect.getAmplifier() && plEffect.getDuration() < effect.getDuration())) {
|
|
||||||
player.removePotionEffect(type);
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
effect.apply(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
/********** Other Utils **********/
|
|
||||||
|
|
||||||
// prints a list of Strings at the specified page
|
|
||||||
public static void list(CommandSender sender, ArrayList<String> strings, int page) {
|
|
||||||
int pages = (int) Math.ceil(strings.size() / 7F);
|
|
||||||
if (page > pages || page < 1) {
|
|
||||||
page = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sender.sendMessage(color("&7-------------- &f" + P.p.languageReader.get("Etc_Page") + " &6" + page + "&f/&6" + pages + " &7--------------"));
|
|
||||||
|
|
||||||
ListIterator<String> iter = strings.listIterator((page - 1) * 7);
|
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
|
||||||
if (iter.hasNext()) {
|
|
||||||
sender.sendMessage(color(iter.next()));
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// gets the Name of a DXL World
|
|
||||||
public static String getDxlName(String worldName) {
|
|
||||||
File dungeonFolder = new File(worldName);
|
|
||||||
if (dungeonFolder.isDirectory()) {
|
|
||||||
for (File file : dungeonFolder.listFiles()) {
|
|
||||||
if (!file.isDirectory()) {
|
|
||||||
if (file.getName().startsWith(".id_")) {
|
|
||||||
return file.getName().substring(1).toLowerCase();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return worldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
// create empty World save Sections
|
|
||||||
public static void createWorldSections(ConfigurationSection section) {
|
|
||||||
for (World world : P.p.getServer().getWorlds()) {
|
|
||||||
String worldName = world.getName();
|
|
||||||
if (worldName.startsWith("DXL_")) {
|
|
||||||
worldName = getDxlName(worldName);
|
|
||||||
} else {
|
|
||||||
worldName = world.getUID().toString();
|
|
||||||
}
|
|
||||||
section.createSection(worldName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
|
||||||
public static void saveFile(InputStream in, File dest, String name, boolean overwrite) throws IOException {
|
|
||||||
if (in == null) return;
|
|
||||||
if (!dest.exists()) {
|
|
||||||
dest.mkdirs();
|
|
||||||
}
|
|
||||||
File result = new File(dest, name);
|
|
||||||
if (result.exists()) {
|
|
||||||
if (overwrite) {
|
|
||||||
result.delete();
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputStream out = new FileOutputStream(result);
|
|
||||||
byte[] buffer = new byte[1024];
|
|
||||||
|
|
||||||
int length;
|
|
||||||
//copy the file content in bytes
|
|
||||||
while ((length = in.read(buffer)) > 0){
|
|
||||||
out.write(buffer, 0, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
in.close();
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -140,7 +140,7 @@ public class Wakeup {
|
|||||||
locs.add("&6" + s + id + "&f" + s + ": " + world + " " + x + "," + y + "," + z);
|
locs.add("&6" + s + id + "&f" + s + ": " + world + " " + x + "," + y + "," + z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Util.list(sender, locs, page);
|
BUtil.list(sender, locs, page);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void check(CommandSender sender, int id, boolean all) {
|
public static void check(CommandSender sender, int id, boolean all) {
|
||||||
@@ -228,7 +228,7 @@ public class Wakeup {
|
|||||||
|
|
||||||
|
|
||||||
public static void save(ConfigurationSection section, ConfigurationSection oldData) {
|
public static void save(ConfigurationSection section, ConfigurationSection oldData) {
|
||||||
Util.createWorldSections(section);
|
BUtil.createWorldSections(section);
|
||||||
|
|
||||||
// loc is saved as a String in world sections with format x/y/z/pitch/yaw
|
// loc is saved as a String in world sections with format x/y/z/pitch/yaw
|
||||||
if (!wakeups.isEmpty()) {
|
if (!wakeups.isEmpty()) {
|
||||||
@@ -245,7 +245,7 @@ public class Wakeup {
|
|||||||
String prefix;
|
String prefix;
|
||||||
|
|
||||||
if (worldName.startsWith("DXL_")) {
|
if (worldName.startsWith("DXL_")) {
|
||||||
prefix = Util.getDxlName(worldName) + "." + id;
|
prefix = BUtil.getDxlName(worldName) + "." + id;
|
||||||
} else {
|
} else {
|
||||||
prefix = wakeup.loc.getWorld().getUID().toString() + "." + id;
|
prefix = wakeup.loc.getWorld().getUID().toString() + "." + id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
package com.dre.brewery.api.events;
|
package com.dre.brewery.api.events;
|
||||||
|
|
||||||
import com.dre.brewery.BCauldron;
|
import com.dre.brewery.BCauldron;
|
||||||
|
import com.dre.brewery.LegacyUtil;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.block.data.Levelled;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.Cancellable;
|
import org.bukkit.event.Cancellable;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
@@ -40,7 +43,7 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the item currently being added to the cauldron by the player
|
// Get the item currently being added to the cauldron by the player
|
||||||
// Can be changed directly or with the setter
|
// Can be changed directly (mutable) or with the setter Method
|
||||||
// The amount is ignored and always one added
|
// The amount is ignored and always one added
|
||||||
public ItemStack getIngredient() {
|
public ItemStack getIngredient() {
|
||||||
return ingredient;
|
return ingredient;
|
||||||
@@ -55,7 +58,7 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
|
|||||||
|
|
||||||
// If the amount of the item in the players hand should be decreased
|
// If the amount of the item in the players hand should be decreased
|
||||||
// Default true
|
// Default true
|
||||||
public boolean shouldTakeItem() {
|
public boolean willTakeItem() {
|
||||||
return takeItem;
|
return takeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,22 +67,21 @@ public class IngedientAddEvent extends PlayerEvent implements Cancellable {
|
|||||||
this.takeItem = takeItem;
|
this.takeItem = takeItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the MaterialData of the Cauldron
|
// Get the BlockData of the Cauldron
|
||||||
// May be null if the Cauldron does not exist anymore
|
// May be null if the Cauldron does not exist anymore
|
||||||
public Cauldron getCauldronData() {
|
public Levelled getCauldronData() {
|
||||||
BlockState state = block.getState();
|
BlockData data = block.getBlockData();
|
||||||
if (state != null) {
|
if (data instanceof Levelled) {
|
||||||
MaterialData data = state.getData();
|
return (Levelled) data;
|
||||||
if (data instanceof Cauldron) {
|
|
||||||
return ((Cauldron) state);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the Water Fill level of the Cauldron
|
||||||
// 0 = empty, 1 = something in, 2 = full
|
// 0 = empty, 1 = something in, 2 = full
|
||||||
public int getFillLevel() {
|
// Can use BCauldron.EMPTY, BCauldron.SOME, BCauldron.FULL
|
||||||
return BCauldron.getFillLevel(block);
|
public byte getFillLevel() {
|
||||||
|
return LegacyUtil.getFillLevel(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public class PlayerPushEvent extends PlayerEvent implements Cancellable {
|
|||||||
this.bPlayer = bPlayer;
|
this.bPlayer = bPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BPlayer getbPlayer() {
|
public BPlayer getBPlayer() {
|
||||||
return bPlayer;
|
return bPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class BarrelRemoveEvent extends BarrelEvent {
|
|||||||
super(barrel);
|
super(barrel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean shouldItemsDrop() {
|
public boolean willItemsDrop() {
|
||||||
return itemsDrop;
|
return itemsDrop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
|
|||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Type type;
|
private final Type type;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
//private List<Consumer<Brew>> fcts;
|
||||||
|
|
||||||
public BrewModifyEvent(Brew brew, Type type) {
|
public BrewModifyEvent(Brew brew, Type type) {
|
||||||
super(brew);
|
super(brew);
|
||||||
@@ -22,6 +23,10 @@ public class BrewModifyEvent extends BrewEvent implements Cancellable {
|
|||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*public void addModification(Consumer<Brew> predicate) {
|
||||||
|
fcts.add(predicate);
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCancelled() {
|
public boolean isCancelled() {
|
||||||
return cancelled;
|
return cancelled;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package com.dre.brewery.filedata;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import com.dre.brewery.MCBarrel;
|
import com.dre.brewery.MCBarrel;
|
||||||
import com.dre.brewery.Util;
|
import com.dre.brewery.BUtil;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
@@ -157,7 +157,7 @@ public class DataSave extends BukkitRunnable {
|
|||||||
for (World world : P.p.getServer().getWorlds()) {
|
for (World world : P.p.getServer().getWorlds()) {
|
||||||
String worldName = world.getName();
|
String worldName = world.getName();
|
||||||
if (worldName.startsWith("DXL_")) {
|
if (worldName.startsWith("DXL_")) {
|
||||||
worldName = Util.getDxlName(worldName);
|
worldName = BUtil.getDxlName(worldName);
|
||||||
root.set("Worlds." + worldName, 0);
|
root.set("Worlds." + worldName, 0);
|
||||||
} else {
|
} else {
|
||||||
worldName = world.getUID().toString();
|
worldName = world.getUID().toString();
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ public class GriefPreventionBarrel {
|
|||||||
playerData.lastClaim = claim;
|
playerData.lastClaim = claim;
|
||||||
String noContainersReason = claim.allowContainers(player);
|
String noContainersReason = claim.allowContainers(player);
|
||||||
if (noContainersReason != null) {
|
if (noContainersReason != null) {
|
||||||
brewery.msg(player, brewery.languageReader.get("Error_NoBarrelAccess") + " " + noContainersReason);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.dre.brewery.P;
|
|||||||
import com.dre.brewery.api.events.barrel.BarrelAccessEvent;
|
import com.dre.brewery.api.events.barrel.BarrelAccessEvent;
|
||||||
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
import com.dre.brewery.api.events.barrel.BarrelDestroyEvent;
|
||||||
import com.dre.brewery.api.events.barrel.BarrelRemoveEvent;
|
import com.dre.brewery.api.events.barrel.BarrelRemoveEvent;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
@@ -25,10 +26,16 @@ public class IntegrationListener implements Listener {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
P.p.errorLog("Failed to Check WorldGuard for Barrel Open Permissions!");
|
P.p.errorLog("Failed to Check WorldGuard for Barrel Open Permissions!");
|
||||||
P.p.errorLog("Brewery was tested with version 5.8 to 6.1 of WorldGuard!");
|
P.p.errorLog("Brewery was tested with version 5.8, 6.1 to 7.0 of WorldGuard!");
|
||||||
P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload");
|
P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
P.p.msg(event.getPlayer(), "&cError opening Barrel, please report to an Admin!");
|
Player player = event.getPlayer();
|
||||||
|
if (player.hasPermission("brewery.admin") || player.hasPermission("brewery.mod")) {
|
||||||
|
P.p.msg(player, "&cWorldGuard check Error, Brewery was tested with up to v7.0 of Worldguard");
|
||||||
|
P.p.msg(player, "&cSet &7useWorldGuard: false &cin the config and /brew reload");
|
||||||
|
} else {
|
||||||
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,10 +52,16 @@ public class IntegrationListener implements Listener {
|
|||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
P.p.errorLog("Failed to Check GriefPrevention for Barrel Open Permissions!");
|
P.p.errorLog("Failed to Check GriefPrevention for Barrel Open Permissions!");
|
||||||
P.p.errorLog("Brewery was tested with GriefPrevention 14.5.4");
|
P.p.errorLog("Brewery was tested with GriefPrevention v14.5 - v16.9");
|
||||||
P.p.errorLog("Disable the GriefPrevention support in the config and do /brew reload");
|
P.p.errorLog("Disable the GriefPrevention support in the config and do /brew reload");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
P.p.msg(event.getPlayer(), "&cError opening Barrel, please report to an Admin!");
|
Player player = event.getPlayer();
|
||||||
|
if (player.hasPermission("brewery.admin") || player.hasPermission("brewery.mod")) {
|
||||||
|
P.p.msg(player, "&cGriefPrevention check Error, Brewery was tested with up to v16.9 of GriefPrevention");
|
||||||
|
P.p.msg(player, "&cSet &7useGriefPrevention: false &cin the config and /brew reload");
|
||||||
|
} else {
|
||||||
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +82,13 @@ public class IntegrationListener implements Listener {
|
|||||||
P.p.errorLog("Brewery was tested with version 4.5.0 of LWC!");
|
P.p.errorLog("Brewery was tested with version 4.5.0 of LWC!");
|
||||||
P.p.errorLog("Disable the LWC support in the config and do /brew reload");
|
P.p.errorLog("Disable the LWC support in the config and do /brew reload");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
P.p.msg(event.getPlayerOptional(), "&cError breaking Barrel, please report to an Admin!");
|
Player player = event.getPlayerOptional();
|
||||||
|
if (player.hasPermission("brewery.admin") || player.hasPermission("brewery.mod")) {
|
||||||
|
P.p.msg(player, "&cLWC check Error, Brewery was tested with up to v4.5.0 of LWC");
|
||||||
|
P.p.msg(player, "&cSet &7useLWC: false &cin the config and /brew reload");
|
||||||
|
} else {
|
||||||
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -55,12 +55,7 @@ public class WGBarrel7 implements WGBarrel {
|
|||||||
|
|
||||||
RegionQuery query = platform.getRegionContainer().createQuery();
|
RegionQuery query = platform.getRegionContainer().createQuery();
|
||||||
|
|
||||||
if (!query.testBuild(new Location(world, spigot.getX(), spigot.getY(), spigot.getZ()), wg.wrapPlayer(player), Flags.USE, Flags.CHEST_ACCESS)) {
|
return query.testBuild(new Location(world, spigot.getX(), spigot.getY(), spigot.getZ()), wg.wrapPlayer(player), Flags.USE, Flags.CHEST_ACCESS);
|
||||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.dre.brewery.listeners;
|
package com.dre.brewery.listeners;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import com.dre.brewery.*;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import com.dre.brewery.Util;
|
|
||||||
import com.dre.brewery.api.events.brew.BrewModifyEvent;
|
import com.dre.brewery.api.events.brew.BrewModifyEvent;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@@ -12,12 +9,8 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.dre.brewery.BIngredients;
|
import java.util.ArrayList;
|
||||||
import com.dre.brewery.BRecipe;
|
import java.util.Locale;
|
||||||
import com.dre.brewery.P;
|
|
||||||
import com.dre.brewery.Wakeup;
|
|
||||||
import com.dre.brewery.BPlayer;
|
|
||||||
import com.dre.brewery.Brew;
|
|
||||||
|
|
||||||
public class CommandListener implements CommandExecutor {
|
public class CommandListener implements CommandExecutor {
|
||||||
|
|
||||||
@@ -168,7 +161,7 @@ public class CommandListener implements CommandExecutor {
|
|||||||
p.msg(sender, "&6" + p.getDescription().getName() + " v" + p.getDescription().getVersion());
|
p.msg(sender, "&6" + p.getDescription().getName() + " v" + p.getDescription().getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
Util.list(sender, commands, page);
|
BUtil.list(sender, commands, page);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
package com.dre.brewery.listeners;
|
package com.dre.brewery.listeners;
|
||||||
|
|
||||||
import com.dre.brewery.BPlayer;
|
import com.dre.brewery.*;
|
||||||
import com.dre.brewery.BRecipe;
|
|
||||||
import com.dre.brewery.Barrel;
|
|
||||||
import com.dre.brewery.Brew;
|
|
||||||
import com.dre.brewery.MCBarrel;
|
|
||||||
import com.dre.brewery.integration.LogBlockBarrel;
|
|
||||||
import com.dre.brewery.P;
|
|
||||||
import com.dre.brewery.lore.BrewLore;
|
import com.dre.brewery.lore.BrewLore;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@@ -19,15 +13,7 @@ import org.bukkit.entity.HumanEntity;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.inventory.BrewEvent;
|
import org.bukkit.event.inventory.*;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
|
||||||
import org.bukkit.event.inventory.InventoryAction;
|
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryDragEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
|
||||||
import org.bukkit.inventory.BrewerInventory;
|
import org.bukkit.inventory.BrewerInventory;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemFlag;
|
import org.bukkit.inventory.ItemFlag;
|
||||||
@@ -38,7 +24,6 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,13 +188,25 @@ public class InventoryListener implements Listener {
|
|||||||
for (int slot = 0; slot < 3; slot++) {
|
for (int slot = 0; slot < 3; slot++) {
|
||||||
item = inv.getItem(slot);
|
item = inv.getItem(slot);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (item.getType() == Material.POTION) {
|
contents[slot] = Brew.get(item);
|
||||||
if (item.hasItemMeta()) {
|
}
|
||||||
Brew pot = Brew.get(item);
|
}
|
||||||
if (pot != null && (!distill || pot.canDistill())) { // need at least one distillable potion.
|
return contents;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
}
|
private byte hasCustom(BrewerInventory brewer) {
|
||||||
|
ItemStack item = brewer.getItem(3); // ingredient
|
||||||
|
boolean glowstone = (item != null && Material.GLOWSTONE_DUST == item.getType()); // need dust in the top slot.
|
||||||
|
byte customFound = 0;
|
||||||
|
for (Brew brew : getDistillContents(brewer)) {
|
||||||
|
if (brew != null) {
|
||||||
|
if (!glowstone) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (brew.canDistill()) {
|
||||||
|
return 2;
|
||||||
|
} else {
|
||||||
|
customFound = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,24 +228,14 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
private boolean runDistill(BrewerInventory inv) {
|
private boolean runDistill(BrewerInventory inv) {
|
||||||
boolean custom = false;
|
boolean custom = false;
|
||||||
Boolean[] contents = new Boolean[3];
|
Brew[] contents = getDistillContents(inv);
|
||||||
while (slot < 3) {
|
for (int slot = 0; slot < 3; slot++) {
|
||||||
item = inv.getItem(slot);
|
if (contents[slot] == null) continue;
|
||||||
contents[slot] = false;
|
if (contents[slot].canDistill()) {
|
||||||
if (item != null) {
|
// is further distillable
|
||||||
if (item.getType() == Material.POTION) {
|
custom = true;
|
||||||
if (item.hasItemMeta()) {
|
} else {
|
||||||
Brew brew = Brew.get(item);
|
contents[slot] = null;
|
||||||
if (brew != null) {
|
|
||||||
// has custom potion in "slot"
|
|
||||||
if (brew.canDistill()) {
|
|
||||||
// is further distillable
|
|
||||||
contents[slot] = true;
|
|
||||||
custom = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (custom) {
|
if (custom) {
|
||||||
@@ -299,7 +286,7 @@ public class InventoryListener implements Listener {
|
|||||||
P.p.log(potion.getLore().get(0).replaceAll("§", ""));
|
P.p.log(potion.getLore().get(0).replaceAll("§", ""));
|
||||||
P.p.log("similar to beispiel? " + BRecipe.get("Beispiel").createBrew(10).isSimilar(brew));
|
P.p.log("similar to beispiel? " + BRecipe.get("Beispiel").createBrew(10).isSimilar(brew));
|
||||||
|
|
||||||
//brew.touch();
|
brew.touch();
|
||||||
|
|
||||||
/*try {
|
/*try {
|
||||||
DataInputStream in = new DataInputStream(new Base91DecoderStream(new LoreLoadStream(potion)));
|
DataInputStream in = new DataInputStream(new Base91DecoderStream(new LoreLoadStream(potion)));
|
||||||
@@ -457,18 +444,6 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onInventoryClose(InventoryCloseEvent event) {
|
public void onInventoryClose(InventoryCloseEvent event) {
|
||||||
if (P.p.useLB) {
|
|
||||||
if (event.getInventory().getHolder() instanceof Barrel) {
|
|
||||||
try {
|
|
||||||
LogBlockBarrel.closeBarrel(event.getPlayer(), event.getInventory());
|
|
||||||
} catch (Exception e) {
|
|
||||||
P.p.errorLog("Failed to Log Barrel to LogBlock!");
|
|
||||||
P.p.errorLog("Brewery was tested with version 1.94 of LogBlock!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!P.use1_14) return;
|
if (!P.use1_14) return;
|
||||||
|
|
||||||
// Barrel Closing Sound
|
// Barrel Closing Sound
|
||||||
|
|||||||
@@ -1,13 +1,6 @@
|
|||||||
package com.dre.brewery.listeners;
|
package com.dre.brewery.listeners;
|
||||||
|
|
||||||
import com.dre.brewery.BCauldron;
|
import com.dre.brewery.*;
|
||||||
import com.dre.brewery.BIngredients;
|
|
||||||
import com.dre.brewery.BPlayer;
|
|
||||||
import com.dre.brewery.Barrel;
|
|
||||||
import com.dre.brewery.Brew;
|
|
||||||
import com.dre.brewery.P;
|
|
||||||
import com.dre.brewery.Wakeup;
|
|
||||||
import com.dre.brewery.Words;
|
|
||||||
import com.dre.brewery.filedata.UpdateChecker;
|
import com.dre.brewery.filedata.UpdateChecker;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package com.dre.brewery.listeners;
|
|||||||
import com.dre.brewery.BCauldron;
|
import com.dre.brewery.BCauldron;
|
||||||
import com.dre.brewery.Barrel;
|
import com.dre.brewery.Barrel;
|
||||||
import com.dre.brewery.P;
|
import com.dre.brewery.P;
|
||||||
import com.dre.brewery.Util;
|
import com.dre.brewery.BUtil;
|
||||||
import com.dre.brewery.filedata.DataSave;
|
import com.dre.brewery.filedata.DataSave;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -19,7 +19,7 @@ public class WorldListener implements Listener {
|
|||||||
World world = event.getWorld();
|
World world = event.getWorld();
|
||||||
|
|
||||||
if (world.getName().startsWith("DXL_")) {
|
if (world.getName().startsWith("DXL_")) {
|
||||||
P.p.loadWorldData(Util.getDxlName(world.getName()), world);
|
P.p.loadWorldData(BUtil.getDxlName(world.getName()), world);
|
||||||
} else {
|
} else {
|
||||||
P.p.loadWorldData(world.getUID().toString(), world);
|
P.p.loadWorldData(world.getUID().toString(), world);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user