mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 07:49:03 +00:00
Merge branch '1.13' of https://github.com/Sataniel98/Brewery into Sataniel98-1.13
This commit is contained in:
@@ -9,8 +9,6 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.material.Cauldron;
|
||||
import org.bukkit.material.MaterialData;
|
||||
|
||||
public class BCauldron {
|
||||
public static CopyOnWriteArrayList<BCauldron> bcauldrons = new CopyOnWriteArrayList<>();
|
||||
@@ -36,8 +34,7 @@ public class BCauldron {
|
||||
|
||||
public void onUpdate() {
|
||||
// Check if fire still alive
|
||||
if (!block.getChunk().isLoaded() || block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || block.getRelative(BlockFace.DOWN).getType() == Material.STATIONARY_LAVA
|
||||
|| block.getRelative(BlockFace.DOWN).getType() == Material.LAVA) {
|
||||
if (!block.getChunk().isLoaded() || block.getRelative(BlockFace.DOWN).getType() == Material.FIRE || LegacyUtil.isLava(block.getRelative(BlockFace.DOWN).getType())) {
|
||||
// add a minute to cooking time
|
||||
state++;
|
||||
if (someRemoved) {
|
||||
@@ -74,7 +71,7 @@ public class BCauldron {
|
||||
// get cauldron from block and add given ingredient
|
||||
public static boolean ingredientAdd(Block block, ItemStack ingredient) {
|
||||
// if not empty
|
||||
if (getFillLevel(block) != 0) {
|
||||
if (LegacyUtil.getFillLevel(block) != 0) {
|
||||
BCauldron bcauldron = get(block);
|
||||
if (bcauldron != null) {
|
||||
bcauldron.add(ingredient);
|
||||
@@ -100,13 +97,13 @@ public class BCauldron {
|
||||
byte data = block.getData();
|
||||
if (data > 3) {
|
||||
data = 3;
|
||||
block.setData(data);
|
||||
LegacyUtil.setData(block, data);
|
||||
} else if (data <= 0) {
|
||||
bcauldrons.remove(bcauldron);
|
||||
return false;
|
||||
}
|
||||
data -= 1;
|
||||
block.setData(data);
|
||||
LegacyUtil.setData(block, data);
|
||||
|
||||
if (data == 0) {
|
||||
bcauldrons.remove(bcauldron);
|
||||
@@ -125,24 +122,6 @@ public class BCauldron {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 0 = empty, 1 = something in, 2 = full
|
||||
public static byte getFillLevel(Block block) {
|
||||
if (block.getType() == Material.CAULDRON) {
|
||||
MaterialData data = block.getState().getData();
|
||||
if (data instanceof Cauldron) {
|
||||
Cauldron cauldron = (Cauldron) data;
|
||||
if (cauldron.isEmpty()) {
|
||||
return 0;
|
||||
} else if (cauldron.isFull()) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// prints the current cooking time to the player
|
||||
public static void printTime(Player player, Block block) {
|
||||
if (!player.hasPermission("brewery.cauldron.time")) {
|
||||
@@ -161,7 +140,7 @@ public class BCauldron {
|
||||
|
||||
// reset to normal cauldron
|
||||
public static void remove(Block block) {
|
||||
if (getFillLevel(block) != 0) {
|
||||
if (LegacyUtil.getFillLevel(block) != 0) {
|
||||
BCauldron bcauldron = get(block);
|
||||
if (bcauldron != null) {
|
||||
bcauldrons.remove(bcauldron);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class BRecipe {
|
||||
if (durability == -1 && vaultItem.getSubTypeId() != 0) {
|
||||
durability = vaultItem.getSubTypeId();
|
||||
}
|
||||
if (mat == Material.LEAVES) {
|
||||
if (mat.name().contains("LEAVES")) {
|
||||
if (durability > 3) {
|
||||
durability -= 4; // Vault has leaves with higher durability
|
||||
}
|
||||
|
||||
+877
-992
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,196 @@
|
||||
package com.dre.brewery;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.material.Cauldron;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.Wood;
|
||||
|
||||
public class LegacyUtil {
|
||||
|
||||
private static Method GET_MATERIAL;
|
||||
private static Method GET_BLOCK_TYPE_ID_AT;
|
||||
private static Method SET_DATA;
|
||||
|
||||
static {
|
||||
// -1.12.2 methods
|
||||
try {
|
||||
GET_MATERIAL = Material.class.getDeclaredMethod("getMaterial", int.class);
|
||||
GET_BLOCK_TYPE_ID_AT = World.class.getDeclaredMethod("getBlockTypeIdAt", Location.class);
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
}
|
||||
// 1.13+ methods
|
||||
try {
|
||||
SET_DATA = Class.forName(Bukkit.getServer().getClass().getPackage().getName() + ".block.CraftBlock").getDeclaredMethod("setData", byte.class);
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | SecurityException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Material CLOCK = get("CLOCK", "WATCH");
|
||||
public static final Material OAK_STAIRS = get("OAK_STAIRS", "WOOD_STAIRS");
|
||||
public static final Material SPRUCE_STAIRS = get("SPRUCE_STAIRS", "SPRUCE_WOOD_STAIRS");
|
||||
public static final Material BIRCH_STAIRS = get("BIRCH_STAIRS", "BIRCH_WOOD_STAIRS");
|
||||
public static final Material JUNGLE_STAIRS = get("JUNGLE_STAIRS", "JUNGLE_WOOD_STAIRS");
|
||||
public static final Material ACACIA_STAIRS = get("ACACIA_STAIRS");
|
||||
public static final Material DARK_OAK_STAIRS = get("DARK_OAK_STAIRS");
|
||||
|
||||
private static Material get(String name) {
|
||||
try {
|
||||
return Material.valueOf(name);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static Material get(String newName, String oldName) {
|
||||
try {
|
||||
return Material.valueOf(P.use1_13 ? newName : oldName);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isWoodPlanks(Material type) {
|
||||
return type.name().contains("PLANKS") || type.name().equals("WOOD");
|
||||
}
|
||||
|
||||
public static boolean isWoodStairs(Material type) {
|
||||
return type == OAK_STAIRS || type == SPRUCE_STAIRS || type == BIRCH_STAIRS || type == JUNGLE_STAIRS
|
||||
|| (type == ACACIA_STAIRS && ACACIA_STAIRS != null) || (type == DARK_OAK_STAIRS && DARK_OAK_STAIRS != null);
|
||||
}
|
||||
|
||||
public static boolean isFence(Material type) {
|
||||
return type.name().endsWith("FENCE");
|
||||
}
|
||||
|
||||
public static boolean isSign(Material type) {
|
||||
return type.name().equals("SIGN_POST") || type == Material.SIGN || type == Material.WALL_SIGN;
|
||||
}
|
||||
|
||||
// LAVA and STATIONARY_LAVA are merged as of 1.13
|
||||
public static boolean isLava(Material type) {
|
||||
return type.name().equals("STATIONARY_LAVA") || type == Material.LAVA;
|
||||
}
|
||||
|
||||
public static boolean areStairsInverted(Block block) {
|
||||
if (!P.use1_13) {
|
||||
MaterialData data = block.getState().getData();
|
||||
return data instanceof org.bukkit.material.Stairs && (((org.bukkit.material.Stairs) data).isInverted());
|
||||
} else {
|
||||
BlockData data = block.getBlockData();
|
||||
return data instanceof org.bukkit.block.data.type.Stairs && ((org.bukkit.block.data.type.Stairs) data).getHalf() == org.bukkit.block.data.type.Stairs.Half.TOP;
|
||||
}
|
||||
}
|
||||
|
||||
public static byte getWoodType(Block wood) {
|
||||
TreeSpecies woodType = null;
|
||||
|
||||
if (P.use1_13 || isWoodStairs(wood.getType())) {
|
||||
String material = wood.getType().name();
|
||||
if (material.startsWith("OAK")) {
|
||||
woodType = TreeSpecies.GENERIC;
|
||||
} else if (material.startsWith("SPRUCE")) {
|
||||
woodType = TreeSpecies.REDWOOD;
|
||||
} else if (material.startsWith("BIRCH")) {
|
||||
woodType = TreeSpecies.BIRCH;
|
||||
} else if (material.startsWith("JUNGLE")) {
|
||||
woodType = TreeSpecies.JUNGLE;
|
||||
} else if (material.startsWith("ACACIA")) {
|
||||
woodType = TreeSpecies.ACACIA;
|
||||
} else if (material.startsWith("DARK_OAK")) {
|
||||
woodType = TreeSpecies.DARK_OAK;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
MaterialData data = wood.getState().getData();
|
||||
if (data instanceof Tree) {
|
||||
woodType = ((Tree) data).getSpecies();
|
||||
} else if (data instanceof Wood) {
|
||||
woodType = ((Wood) data).getSpecies();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
switch (woodType) {
|
||||
case GENERIC:
|
||||
return 2;
|
||||
case REDWOOD:
|
||||
return 4;
|
||||
case BIRCH:
|
||||
return 1;
|
||||
case JUNGLE:
|
||||
return 3;
|
||||
case ACACIA:
|
||||
return 5;
|
||||
case DARK_OAK:
|
||||
return 6;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 0 = empty, 1 = something in, 2 = full
|
||||
public static byte getFillLevel(Block block) {
|
||||
if (block.getType() != Material.CAULDRON) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (P.use1_13) {
|
||||
Levelled cauldron = ((Levelled) block.getBlockData());
|
||||
if (cauldron.getLevel() == 0) {
|
||||
return 0;
|
||||
} else if (cauldron.getLevel() == cauldron.getMaximumLevel()) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
Cauldron cauldron = (Cauldron) block.getState().getData();
|
||||
if (cauldron.isEmpty()) {
|
||||
return 0;
|
||||
} else if (cauldron.isFull()) {
|
||||
return 2;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Material getMaterial(int id) {
|
||||
try {
|
||||
return GET_MATERIAL != null ? (Material) GET_MATERIAL.invoke(null, id) : null;
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getBlockTypeIdAt(Location location) {
|
||||
try {
|
||||
return GET_BLOCK_TYPE_ID_AT != null ? (int) GET_BLOCK_TYPE_ID_AT.invoke(location.getWorld(), location) : 0;
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Setting byte data to blocks works in 1.13, but isn't part of the API anymore
|
||||
public static void setData(Block block, byte data) {
|
||||
try {
|
||||
SET_DATA.invoke(block, data);
|
||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+30
-46
@@ -3,6 +3,7 @@ package com.dre.brewery;
|
||||
import com.dre.brewery.filedata.*;
|
||||
import com.dre.brewery.integration.LogBlockBarrel;
|
||||
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.*;
|
||||
@@ -18,6 +19,7 @@ import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -31,15 +33,17 @@ import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class P extends JavaPlugin {
|
||||
public static P p;
|
||||
public static final String configVersion = "1.5";
|
||||
public static final String configVersion = "1.6";
|
||||
public static boolean debug;
|
||||
public static boolean useUUID;
|
||||
public static boolean use1_9;
|
||||
public static boolean use1_12;
|
||||
public static boolean use1_13;
|
||||
public static boolean updateCheck;
|
||||
|
||||
// Third Party Enabled
|
||||
@@ -73,6 +77,7 @@ public class P extends JavaPlugin {
|
||||
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].*|$)");
|
||||
use1_13 = !v.matches("(^|.*[^\\.\\d])1\\.1[0-2]([^\\d].*|$)") && !v.matches("(^|.*[^\\.\\d])1\\.[0-9]([^\\d].*|$)");
|
||||
|
||||
// load the Config
|
||||
try {
|
||||
@@ -90,7 +95,7 @@ public class P extends JavaPlugin {
|
||||
readData();
|
||||
|
||||
// Setup Metrics
|
||||
setupMetrics();
|
||||
new Metrics(this);
|
||||
|
||||
// Listeners
|
||||
blockListener = new BlockListener();
|
||||
@@ -155,13 +160,6 @@ public class P extends JavaPlugin {
|
||||
this.log(this.getDescription().getName() + " disabled!");
|
||||
}
|
||||
|
||||
public void setupMetrics() {
|
||||
try {
|
||||
new com.dre.brewery.integration.Metrics(this).start();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
public void reload(CommandSender sender) {
|
||||
if (sender != null && !sender.equals(getServer().getConsoleSender())) {
|
||||
reloader = sender;
|
||||
@@ -264,27 +262,26 @@ public class P extends JavaPlugin {
|
||||
// Third-Party
|
||||
useWG = config.getBoolean("useWorldGuard", true) && getServer().getPluginManager().isPluginEnabled("WorldGuard");
|
||||
if (useWG) {
|
||||
try {
|
||||
try {
|
||||
Class.forName("com.sk89q.worldguard.bukkit.RegionContainer");
|
||||
wg = new WGBarrelNew();
|
||||
} catch (ClassNotFoundException e) {
|
||||
wg = new WGBarrelOld();
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
wg = null;
|
||||
Plugin plugin = Bukkit.getPluginManager().getPlugin("WorldEdit");
|
||||
if (plugin != null) {
|
||||
String wgv = plugin.getDescription().getVersion();
|
||||
if (wgv.startsWith("7.")) wg = new WGBarrel7();
|
||||
else if (wgv.startsWith("6.")) wg = new WGBarrelNew();
|
||||
else if (wgv.startsWith("5.")) wg = new WGBarrelOld();
|
||||
}
|
||||
if (wg == null) {
|
||||
P.p.errorLog("Failed loading WorldGuard Integration! Opening Barrels will NOT work!");
|
||||
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 and 7.0 of WorldGuard!");
|
||||
P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
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");
|
||||
|
||||
useCitadel = config.getBoolean("useCitadel", false) && getServer().getPluginManager().isPluginEnabled("Citadel");
|
||||
// The item util has been removed in Vault 1.7+
|
||||
hasVault = getServer().getPluginManager().isPluginEnabled("Vault")
|
||||
&& Integer.parseInt(getServer().getPluginManager().getPlugin("Vault").getDescription().getVersion().split("\\.")[1]) <= 6;
|
||||
|
||||
// various Settings
|
||||
DataSave.autosave = config.getInt("autosave", 3);
|
||||
@@ -609,7 +606,7 @@ public class P extends JavaPlugin {
|
||||
if (!cfg.exists()) {
|
||||
errorLog("No config.yml found, creating default file! You may want to choose a config according to your language!");
|
||||
errorLog("You can find them in plugins/Brewery/configs/");
|
||||
InputStream defconf = getResource("config/en/config.yml");
|
||||
InputStream defconf = getResource("config/" + (use1_13 ? "v13/" : "v12/") + "en/config.yml");
|
||||
if (defconf == null) {
|
||||
errorLog("default config file not found, your jarfile may be corrupt. Disabling Brewery!");
|
||||
return false;
|
||||
@@ -636,7 +633,7 @@ public class P extends JavaPlugin {
|
||||
for (String l : new String[] {"de", "en", "fr", "it"}) {
|
||||
File lfold = new File(configs, l);
|
||||
try {
|
||||
saveFile(getResource("config/" + l + "/config.yml"), lfold, "config.yml", overwrite);
|
||||
saveFile(getResource("config/" + (use1_13 ? "v13/" : "v12/") + l + "/config.yml"), lfold, "config.yml", overwrite);
|
||||
saveFile(getResource("languages/" + l + ".yml"), languages, l + ".yml", false); // Never overwrite languages for now
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -700,19 +697,13 @@ public class P extends JavaPlugin {
|
||||
|
||||
// Returns true if the Block can be destroyed by the Player or something else (null)
|
||||
public boolean blockDestroy(Block block, Player player) {
|
||||
switch (block.getType()) {
|
||||
case CAULDRON:
|
||||
Material type = block.getType();
|
||||
if (type == Material.CAULDRON) {
|
||||
// will only remove when existing
|
||||
BCauldron.remove(block);
|
||||
return true;
|
||||
case FENCE:
|
||||
case NETHER_FENCE:
|
||||
case ACACIA_FENCE:
|
||||
case BIRCH_FENCE:
|
||||
case DARK_OAK_FENCE:
|
||||
case IRON_FENCE:
|
||||
case JUNGLE_FENCE:
|
||||
case SPRUCE_FENCE:
|
||||
|
||||
} else if (LegacyUtil.isFence(type)) {
|
||||
// remove barrel and throw potions on the ground
|
||||
Barrel barrel = Barrel.getBySpigot(block);
|
||||
if (barrel != null) {
|
||||
@@ -724,8 +715,8 @@ public class P extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case SIGN_POST:
|
||||
case WALL_SIGN:
|
||||
|
||||
} else if (LegacyUtil.isSign(type)) {
|
||||
// remove small Barrels
|
||||
Barrel barrel2 = Barrel.getBySpigot(block);
|
||||
if (barrel2 != null) {
|
||||
@@ -741,13 +732,8 @@ public class P extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
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:
|
||||
|
||||
} else if (LegacyUtil.isWoodPlanks(type) || LegacyUtil.isWoodStairs(type)){
|
||||
Barrel barrel3 = Barrel.getByWood(block);
|
||||
if (barrel3 != null) {
|
||||
if (barrel3.hasPermsDestroy(player)) {
|
||||
@@ -756,9 +742,7 @@ public class P extends JavaPlugin {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,11 @@ public class ConfigUpdater {
|
||||
fromVersion = "1.5";
|
||||
}
|
||||
|
||||
if (!fromVersion.equals("1.5")) {
|
||||
if (fromVersion.equals("1.5")) {
|
||||
fromVersion = "1.6";
|
||||
}
|
||||
|
||||
if (!fromVersion.equals("1.6")) {
|
||||
P.p.log(P.p.languageReader.get("Error_ConfigUpdate", fromVersion));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,106 +1,107 @@
|
||||
package com.dre.brewery.filedata;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.dre.brewery.P;
|
||||
|
||||
public class DataUpdater {
|
||||
|
||||
private FileConfiguration data;
|
||||
private File file;
|
||||
|
||||
public DataUpdater(FileConfiguration data, File file) {
|
||||
this.data = data;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void update(String fromVersion) {
|
||||
if (fromVersion.equalsIgnoreCase("1.0")) {
|
||||
update10();
|
||||
//fromVersion = "1.1";
|
||||
}
|
||||
|
||||
try {
|
||||
data.save(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void update10() {
|
||||
|
||||
data.set("Version", DataSave.dataVersion);
|
||||
|
||||
ConfigurationSection section = data.getConfigurationSection("Ingredients");
|
||||
try {
|
||||
if (section != null) {
|
||||
for (String id : section.getKeys(false)) {
|
||||
ConfigurationSection matSection = section.getConfigurationSection(id + ".mats");
|
||||
if (matSection != null) {
|
||||
// matSection has all the materials + amount as Integers
|
||||
Map<String, Integer> ingredients = new HashMap<>();
|
||||
for (String ingredient : matSection.getKeys(false)) {
|
||||
// convert to Material
|
||||
Material mat = Material.getMaterial(P.p.parseInt(ingredient));
|
||||
if (mat != null) {
|
||||
ingredients.put(mat.name(), matSection.getInt(ingredient));
|
||||
}
|
||||
}
|
||||
section.set(id + ".mats", ingredients);
|
||||
} else {
|
||||
P.p.errorLog("Ingredient id: '" + id + "' incomplete in data.yml");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Getting Material by id may not work in the future
|
||||
P.p.errorLog("Error Converting Ingredient Section of the Data File, newer versions of Bukkit may not support the old Save File anymore:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
section = data.getConfigurationSection("BCauldron");
|
||||
if (section != null) {
|
||||
try {
|
||||
for (String uuid : section.getKeys(false)) {
|
||||
ConfigurationSection cauldrons = section.getConfigurationSection(uuid);
|
||||
if (cauldrons != null) {
|
||||
for (String id : cauldrons.getKeys(false)) {
|
||||
ConfigurationSection ingredientSection = cauldrons.getConfigurationSection(id + ".ingredients");
|
||||
if (ingredientSection != null) {
|
||||
// has all the materials + amount as Integers
|
||||
Map<String, Integer> ingredients = new HashMap<>();
|
||||
for (String ingredient : ingredientSection.getKeys(false)) {
|
||||
// convert to Material
|
||||
Material mat = Material.getMaterial(P.p.parseInt(ingredient));
|
||||
if (mat != null) {
|
||||
ingredients.put(mat.name(), ingredientSection.getInt(ingredient));
|
||||
}
|
||||
}
|
||||
cauldrons.set(id + ".ingredients", ingredients);
|
||||
} else {
|
||||
P.p.errorLog("BCauldron " + id + " is missing Ingredient Section");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Getting Material by id may not work in the future
|
||||
P.p.errorLog("Error Converting Ingredient Section of Cauldrons, newer versions of Bukkit may not support the old Save File anymore:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
package com.dre.brewery.filedata;
|
||||
|
||||
import com.dre.brewery.LegacyUtil;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
import com.dre.brewery.P;
|
||||
|
||||
public class DataUpdater {
|
||||
|
||||
private FileConfiguration data;
|
||||
private File file;
|
||||
|
||||
public DataUpdater(FileConfiguration data, File file) {
|
||||
this.data = data;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void update(String fromVersion) {
|
||||
if (fromVersion.equalsIgnoreCase("1.0")) {
|
||||
update10();
|
||||
//fromVersion = "1.1";
|
||||
}
|
||||
|
||||
try {
|
||||
data.save(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void update10() {
|
||||
|
||||
data.set("Version", DataSave.dataVersion);
|
||||
|
||||
ConfigurationSection section = data.getConfigurationSection("Ingredients");
|
||||
try {
|
||||
if (section != null) {
|
||||
for (String id : section.getKeys(false)) {
|
||||
ConfigurationSection matSection = section.getConfigurationSection(id + ".mats");
|
||||
if (matSection != null) {
|
||||
// matSection has all the materials + amount as Integers
|
||||
Map<String, Integer> ingredients = new HashMap<>();
|
||||
for (String ingredient : matSection.getKeys(false)) {
|
||||
// convert to Material
|
||||
Material mat = LegacyUtil.getMaterial(P.p.parseInt(ingredient));
|
||||
if (mat != null) {
|
||||
ingredients.put(mat.name(), matSection.getInt(ingredient));
|
||||
}
|
||||
}
|
||||
section.set(id + ".mats", ingredients);
|
||||
} else {
|
||||
P.p.errorLog("Ingredient id: '" + id + "' incomplete in data.yml");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Getting Material by id may not work in the future
|
||||
P.p.errorLog("Error Converting Ingredient Section of the Data File, newer versions of Bukkit may not support the old Save File anymore:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
section = data.getConfigurationSection("BCauldron");
|
||||
if (section != null) {
|
||||
try {
|
||||
for (String uuid : section.getKeys(false)) {
|
||||
ConfigurationSection cauldrons = section.getConfigurationSection(uuid);
|
||||
if (cauldrons != null) {
|
||||
for (String id : cauldrons.getKeys(false)) {
|
||||
ConfigurationSection ingredientSection = cauldrons.getConfigurationSection(id + ".ingredients");
|
||||
if (ingredientSection != null) {
|
||||
// has all the materials + amount as Integers
|
||||
Map<String, Integer> ingredients = new HashMap<>();
|
||||
for (String ingredient : ingredientSection.getKeys(false)) {
|
||||
// convert to Material
|
||||
Material mat = LegacyUtil.getMaterial(P.p.parseInt(ingredient));
|
||||
if (mat != null) {
|
||||
ingredients.put(mat.name(), ingredientSection.getInt(ingredient));
|
||||
}
|
||||
}
|
||||
cauldrons.set(id + ".ingredients", ingredients);
|
||||
} else {
|
||||
P.p.errorLog("BCauldron " + id + " is missing Ingredient Section");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// Getting Material by id may not work in the future
|
||||
P.p.errorLog("Error Converting Ingredient Section of Cauldrons, newer versions of Bukkit may not support the old Save File anymore:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,81 +1,119 @@
|
||||
package com.dre.brewery.integration;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.diddiz.LogBlock.Consumer;
|
||||
import de.diddiz.LogBlock.LogBlock;
|
||||
import de.diddiz.LogBlock.Logging;
|
||||
import static de.diddiz.LogBlock.config.Config.isLogging;
|
||||
import static de.diddiz.util.BukkitUtils.compareInventories;
|
||||
import static de.diddiz.util.BukkitUtils.compressInventory;
|
||||
import static de.diddiz.util.BukkitUtils.rawData;
|
||||
|
||||
public class LogBlockBarrel {
|
||||
private static final List<LogBlockBarrel> opened = new ArrayList<>();
|
||||
public static Consumer consumer = LogBlock.getInstance().getConsumer();
|
||||
|
||||
private HumanEntity player;
|
||||
private ItemStack[] items;
|
||||
private Location loc;
|
||||
|
||||
public LogBlockBarrel(HumanEntity player, ItemStack[] items, Location spigotLoc) {
|
||||
this.player = player;
|
||||
this.items = items;
|
||||
this.loc = spigotLoc;
|
||||
opened.add(this);
|
||||
}
|
||||
|
||||
private void compareInv(final ItemStack[] after) {
|
||||
if (consumer == null) {
|
||||
return;
|
||||
}
|
||||
final ItemStack[] diff = compareInventories(items, after);
|
||||
for (final ItemStack item : diff) {
|
||||
consumer.queueChestAccess(player.getName(), loc, loc.getWorld().getBlockTypeIdAt(loc), (short) item.getTypeId(), (short) item.getAmount(), rawData(item));
|
||||
}
|
||||
}
|
||||
|
||||
public static LogBlockBarrel get(HumanEntity player) {
|
||||
for (LogBlockBarrel open : opened) {
|
||||
if (open.player.equals(player)) {
|
||||
return open;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void openBarrel(HumanEntity player, Inventory inv, Location spigotLoc) {
|
||||
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
|
||||
new LogBlockBarrel(player, compressInventory(inv.getContents()), spigotLoc);
|
||||
}
|
||||
|
||||
public static void closeBarrel(HumanEntity player, Inventory inv) {
|
||||
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
|
||||
LogBlockBarrel open = get(player);
|
||||
if (open != null) {
|
||||
open.compareInv(compressInventory(inv.getContents()));
|
||||
opened.remove(open);
|
||||
}
|
||||
}
|
||||
|
||||
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
|
||||
if (consumer == null) {
|
||||
return;
|
||||
}
|
||||
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
||||
final ItemStack[] items = compressInventory(contents);
|
||||
for (final ItemStack item : items) {
|
||||
consumer.queueChestAccess(playerName, spigotLoc, spigotLoc.getWorld().getBlockTypeIdAt(spigotLoc), (short) item.getTypeId(), (short) (item.getAmount() * -1), rawData(item));
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
opened.clear();
|
||||
}
|
||||
}
|
||||
package com.dre.brewery.integration;
|
||||
|
||||
import com.dre.brewery.LegacyUtil;
|
||||
import com.dre.brewery.P;
|
||||
import de.diddiz.LogBlock.Actor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import de.diddiz.LogBlock.Consumer;
|
||||
import de.diddiz.LogBlock.LogBlock;
|
||||
import de.diddiz.LogBlock.Logging;
|
||||
import static de.diddiz.LogBlock.config.Config.isLogging;
|
||||
import de.diddiz.util.BukkitUtils;
|
||||
import static de.diddiz.util.BukkitUtils.compareInventories;
|
||||
import static de.diddiz.util.BukkitUtils.compressInventory;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
public class LogBlockBarrel {
|
||||
private static final List<LogBlockBarrel> opened = new ArrayList<>();
|
||||
public static Consumer consumer = LogBlock.getInstance().getConsumer();
|
||||
private static Method rawData;
|
||||
private static Method queueChestAccess;
|
||||
|
||||
static {
|
||||
if (!P.use1_13) {
|
||||
try {
|
||||
rawData = BukkitUtils.class.getDeclaredMethod("rawData", ItemStack.class);
|
||||
queueChestAccess = Consumer.class.getDeclaredMethod("queueChestAccess", String.class, Location.class, int.class, short.class, short.class, short.class);
|
||||
} catch (NoSuchMethodException e) {
|
||||
P.p.errorLog("Failed to hook into LogBlock to log barrels. Logging barrel contents is not going to work.");
|
||||
P.p.errorLog("Brewery was tested with version 1.12 to 1.13.1 of LogBlock.");
|
||||
P.p.errorLog("Disable LogBlock support in the configuration file and type /brew reload.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private HumanEntity player;
|
||||
private ItemStack[] items;
|
||||
private Location loc;
|
||||
|
||||
public LogBlockBarrel(HumanEntity player, ItemStack[] items, Location spigotLoc) {
|
||||
this.player = player;
|
||||
this.items = items;
|
||||
this.loc = spigotLoc;
|
||||
opened.add(this);
|
||||
}
|
||||
|
||||
private void compareInv(final ItemStack[] after) {
|
||||
if (consumer == null) {
|
||||
return;
|
||||
}
|
||||
final ItemStack[] diff = compareInventories(items, after);
|
||||
for (final ItemStack item : diff) {
|
||||
if (!P.use1_13) {
|
||||
try {
|
||||
queueChestAccess.invoke(consumer, player.getName(), loc, LegacyUtil.getBlockTypeIdAt(loc), (short) item.getType().getId(), (short) item.getAmount(), (short) rawData.invoke(null, item));
|
||||
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
consumer.queueChestAccess(Actor.actorFromEntity(player), loc, loc.getBlock().getBlockData(), item, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static LogBlockBarrel get(HumanEntity player) {
|
||||
for (LogBlockBarrel open : opened) {
|
||||
if (open.player.equals(player)) {
|
||||
return open;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void openBarrel(HumanEntity player, Inventory inv, Location spigotLoc) {
|
||||
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
|
||||
new LogBlockBarrel(player, compressInventory(inv.getContents()), spigotLoc);
|
||||
}
|
||||
|
||||
public static void closeBarrel(HumanEntity player, Inventory inv) {
|
||||
if (!isLogging(player.getWorld(), Logging.CHESTACCESS)) return;
|
||||
LogBlockBarrel open = get(player);
|
||||
if (open != null) {
|
||||
open.compareInv(compressInventory(inv.getContents()));
|
||||
opened.remove(open);
|
||||
}
|
||||
}
|
||||
|
||||
public static void breakBarrel(String playerName, ItemStack[] contents, Location spigotLoc) {
|
||||
if (consumer == null) {
|
||||
return;
|
||||
}
|
||||
if (!isLogging(spigotLoc.getWorld(), Logging.CHESTACCESS)) return;
|
||||
final ItemStack[] items = compressInventory(contents);
|
||||
for (final ItemStack item : items) {
|
||||
if (!P.use1_13) {
|
||||
try {
|
||||
queueChestAccess.invoke(consumer, playerName, spigotLoc, LegacyUtil.getBlockTypeIdAt(spigotLoc), (short) item.getType().getId(), (short) (item.getAmount() * -1), rawData.invoke(null, item));
|
||||
} catch(IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
consumer.queueChestAccess(Actor.actorFromString(playerName), spigotLoc, spigotLoc.getBlock().getBlockData(), item, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
opened.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,758 +0,0 @@
|
||||
package com.dre.brewery.integration;
|
||||
|
||||
/*
|
||||
* Copyright 2011-2013 Tyler Blair. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and contributors and should not be interpreted as representing official policies,
|
||||
* either expressed or implied, of anybody else.
|
||||
*/
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.logging.Level;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
public class Metrics {
|
||||
|
||||
/**
|
||||
* The current revision number
|
||||
*/
|
||||
private final static int REVISION = 7;
|
||||
|
||||
/**
|
||||
* The base url of the metrics domain
|
||||
*/
|
||||
private static final String BASE_URL = "http://report.mcstats.org";
|
||||
|
||||
/**
|
||||
* The url used to report a server's status
|
||||
*/
|
||||
private static final String REPORT_URL = "/plugin/%s";
|
||||
|
||||
/**
|
||||
* Interval of time to ping (in minutes)
|
||||
*/
|
||||
private static final int PING_INTERVAL = 15;
|
||||
|
||||
/**
|
||||
* The plugin this metrics submits for
|
||||
*/
|
||||
private final Plugin plugin;
|
||||
|
||||
/**
|
||||
* All of the custom graphs to submit to metrics
|
||||
*/
|
||||
private final Set<Graph> graphs = Collections.synchronizedSet(new HashSet<Graph>());
|
||||
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final YamlConfiguration configuration;
|
||||
|
||||
/**
|
||||
* The plugin configuration file
|
||||
*/
|
||||
private final File configurationFile;
|
||||
|
||||
/**
|
||||
* Unique server id
|
||||
*/
|
||||
private final String guid;
|
||||
|
||||
/**
|
||||
* Debug mode
|
||||
*/
|
||||
private final boolean debug;
|
||||
|
||||
/**
|
||||
* Lock for synchronization
|
||||
*/
|
||||
private final Object optOutLock = new Object();
|
||||
|
||||
/**
|
||||
* The scheduled task
|
||||
*/
|
||||
private volatile BukkitTask task = null;
|
||||
|
||||
public Metrics(final Plugin plugin) throws IOException {
|
||||
if (plugin == null) {
|
||||
throw new IllegalArgumentException("Plugin cannot be null");
|
||||
}
|
||||
|
||||
this.plugin = plugin;
|
||||
|
||||
// load the config
|
||||
configurationFile = getConfigFile();
|
||||
configuration = YamlConfiguration.loadConfiguration(configurationFile);
|
||||
|
||||
// add some defaults
|
||||
configuration.addDefault("opt-out", false);
|
||||
configuration.addDefault("guid", UUID.randomUUID().toString());
|
||||
configuration.addDefault("debug", false);
|
||||
|
||||
// Do we need to create the file?
|
||||
if (configuration.get("guid", null) == null) {
|
||||
configuration.options().header("http://mcstats.org").copyDefaults(true);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
|
||||
// Load the guid then
|
||||
guid = configuration.getString("guid");
|
||||
debug = configuration.getBoolean("debug", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
|
||||
* website. Plotters can be added to the graph object returned.
|
||||
*
|
||||
* @param name The name of the graph
|
||||
* @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
|
||||
*/
|
||||
public Graph createGraph(final String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("Graph name cannot be null");
|
||||
}
|
||||
|
||||
// Construct the graph object
|
||||
final Graph graph = new Graph(name);
|
||||
|
||||
// Now we can add our graph
|
||||
graphs.add(graph);
|
||||
|
||||
// and return back
|
||||
return graph;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
|
||||
*
|
||||
* @param graph The name of the graph
|
||||
*/
|
||||
public void addGraph(final Graph graph) {
|
||||
if (graph == null) {
|
||||
throw new IllegalArgumentException("Graph cannot be null");
|
||||
}
|
||||
|
||||
graphs.add(graph);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
|
||||
* initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
|
||||
* ticks.
|
||||
*
|
||||
* @return True if statistics measuring is running, otherwise false.
|
||||
*/
|
||||
public boolean start() {
|
||||
synchronized (optOutLock) {
|
||||
// Did we opt out?
|
||||
if (isOptOut()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Is metrics already running?
|
||||
if (task != null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Begin hitting the server with glorious data
|
||||
task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
|
||||
|
||||
private boolean firstPost = true;
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
// This has to be synchronized or it can collide with the disable method.
|
||||
synchronized (optOutLock) {
|
||||
// Disable Task, if it is running and the server owner decided to opt-out
|
||||
if (isOptOut() && task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
// Tell all plotters to stop gathering information.
|
||||
for (Graph graph : graphs) {
|
||||
graph.onOptOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We use the inverse of firstPost because if it is the first time we are posting,
|
||||
// it is not a interval ping, so it evaluates to FALSE
|
||||
// Each time thereafter it will evaluate to TRUE, i.e PING!
|
||||
postPlugin(!firstPost);
|
||||
|
||||
// After the first post we set firstPost to false
|
||||
// Each post thereafter will be a ping
|
||||
firstPost = false;
|
||||
} catch (IOException e) {
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, PING_INTERVAL * 1200);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Has the server owner denied plugin metrics?
|
||||
*
|
||||
* @return true if metrics should be opted out of it
|
||||
*/
|
||||
public boolean isOptOut() {
|
||||
synchronized (optOutLock) {
|
||||
try {
|
||||
// Reload the metrics file
|
||||
configuration.load(getConfigFile());
|
||||
} catch (IOException ex) {
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
} catch (InvalidConfigurationException ex) {
|
||||
if (debug) {
|
||||
Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return configuration.getBoolean("opt-out", false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void enable() throws IOException {
|
||||
// This has to be synchronized or it can collide with the check in the task.
|
||||
synchronized (optOutLock) {
|
||||
// Check if the server owner has already set opt-out, if not, set it.
|
||||
if (isOptOut()) {
|
||||
configuration.set("opt-out", false);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
|
||||
// Enable Task, if it is not running
|
||||
if (task == null) {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void disable() throws IOException {
|
||||
// This has to be synchronized or it can collide with the check in the task.
|
||||
synchronized (optOutLock) {
|
||||
// Check if the server owner has already set opt-out, if not, set it.
|
||||
if (!isOptOut()) {
|
||||
configuration.set("opt-out", true);
|
||||
configuration.save(configurationFile);
|
||||
}
|
||||
|
||||
// Disable Task, if it is running
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
|
||||
*
|
||||
* @return the File object for the config file
|
||||
*/
|
||||
public File getConfigFile() {
|
||||
// I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
|
||||
// is to abuse the plugin object we already have
|
||||
// plugin.getDataFolder() => base/plugins/PluginA/
|
||||
// pluginsFolder => base/plugins/
|
||||
// The base is not necessarily relative to the startup directory.
|
||||
File pluginsFolder = plugin.getDataFolder().getParentFile();
|
||||
|
||||
// return => base/plugins/PluginMetrics/config.yml
|
||||
return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic method that posts a plugin to the metrics website
|
||||
*/
|
||||
private void postPlugin(final boolean isPing) throws IOException {
|
||||
// Server software specific section
|
||||
PluginDescriptionFile description = plugin.getDescription();
|
||||
String pluginName = description.getName();
|
||||
boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
|
||||
String pluginVersion = description.getVersion();
|
||||
String serverVersion = Bukkit.getVersion();
|
||||
int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
|
||||
|
||||
// END server software specific section -- all code below does not use any code outside of this class / Java
|
||||
|
||||
// Construct the post data
|
||||
StringBuilder json = new StringBuilder(1024);
|
||||
json.append('{');
|
||||
|
||||
// The plugin's description file containg all of the plugin data such as name, version, author, etc
|
||||
appendJSONPair(json, "guid", guid);
|
||||
appendJSONPair(json, "plugin_version", pluginVersion);
|
||||
appendJSONPair(json, "server_version", serverVersion);
|
||||
appendJSONPair(json, "players_online", Integer.toString(playersOnline));
|
||||
|
||||
// New data as of R6
|
||||
String osname = System.getProperty("os.name");
|
||||
String osarch = System.getProperty("os.arch");
|
||||
String osversion = System.getProperty("os.version");
|
||||
String java_version = System.getProperty("java.version");
|
||||
int coreCount = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
// normalize os arch .. amd64 -> x86_64
|
||||
if (osarch.equals("amd64")) {
|
||||
osarch = "x86_64";
|
||||
}
|
||||
|
||||
appendJSONPair(json, "osname", osname);
|
||||
appendJSONPair(json, "osarch", osarch);
|
||||
appendJSONPair(json, "osversion", osversion);
|
||||
appendJSONPair(json, "cores", Integer.toString(coreCount));
|
||||
appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
|
||||
appendJSONPair(json, "java_version", java_version);
|
||||
|
||||
// If we're pinging, append it
|
||||
if (isPing) {
|
||||
appendJSONPair(json, "ping", "1");
|
||||
}
|
||||
|
||||
if (graphs.size() > 0) {
|
||||
synchronized (graphs) {
|
||||
json.append(',');
|
||||
json.append('"');
|
||||
json.append("graphs");
|
||||
json.append('"');
|
||||
json.append(':');
|
||||
json.append('{');
|
||||
|
||||
boolean firstGraph = true;
|
||||
|
||||
final Iterator<Graph> iter = graphs.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
Graph graph = iter.next();
|
||||
|
||||
StringBuilder graphJson = new StringBuilder();
|
||||
graphJson.append('{');
|
||||
|
||||
for (Plotter plotter : graph.getPlotters()) {
|
||||
appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
|
||||
}
|
||||
|
||||
graphJson.append('}');
|
||||
|
||||
if (!firstGraph) {
|
||||
json.append(',');
|
||||
}
|
||||
|
||||
json.append(escapeJSON(graph.getName()));
|
||||
json.append(':');
|
||||
json.append(graphJson);
|
||||
|
||||
firstGraph = false;
|
||||
}
|
||||
|
||||
json.append('}');
|
||||
}
|
||||
}
|
||||
|
||||
// close json
|
||||
json.append('}');
|
||||
|
||||
// Create the url
|
||||
URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
|
||||
|
||||
// Connect to the website
|
||||
URLConnection connection;
|
||||
|
||||
// Mineshafter creates a socks proxy, so we can safely bypass it
|
||||
// It does not reroute POST requests so we need to go around it
|
||||
if (isMineshafterPresent()) {
|
||||
connection = url.openConnection(Proxy.NO_PROXY);
|
||||
} else {
|
||||
connection = url.openConnection();
|
||||
}
|
||||
|
||||
|
||||
byte[] uncompressed = json.toString().getBytes();
|
||||
byte[] compressed = gzip(json.toString());
|
||||
|
||||
// Headers
|
||||
connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
|
||||
connection.addRequestProperty("Content-Type", "application/json");
|
||||
connection.addRequestProperty("Content-Encoding", "gzip");
|
||||
connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
|
||||
connection.addRequestProperty("Accept", "application/json");
|
||||
connection.addRequestProperty("Connection", "close");
|
||||
|
||||
connection.setDoOutput(true);
|
||||
|
||||
if (debug) {
|
||||
System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
|
||||
}
|
||||
|
||||
// Write the data
|
||||
OutputStream os = connection.getOutputStream();
|
||||
os.write(compressed);
|
||||
os.flush();
|
||||
|
||||
// Now read the response
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String response = reader.readLine();
|
||||
|
||||
// close resources
|
||||
os.close();
|
||||
reader.close();
|
||||
|
||||
if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
|
||||
if (response == null) {
|
||||
response = "null";
|
||||
} else if (response.startsWith("7")) {
|
||||
response = response.substring(response.startsWith("7,") ? 2 : 1);
|
||||
}
|
||||
|
||||
throw new IOException(response);
|
||||
} else {
|
||||
// Is this the first update this hour?
|
||||
if (response.equals("1") || response.contains("This is your first update this hour")) {
|
||||
synchronized (graphs) {
|
||||
final Iterator<Graph> iter = graphs.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
final Graph graph = iter.next();
|
||||
|
||||
for (Plotter plotter : graph.getPlotters()) {
|
||||
plotter.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* GZip compress a string of bytes
|
||||
*
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
public static byte[] gzip(String input) {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
GZIPOutputStream gzos = null;
|
||||
|
||||
try {
|
||||
gzos = new GZIPOutputStream(baos);
|
||||
gzos.write(input.getBytes("UTF-8"));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (gzos != null) try {
|
||||
gzos.close();
|
||||
} catch (IOException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if mineshafter is present. If it is, we need to bypass it to send POST requests
|
||||
*
|
||||
* @return true if mineshafter is installed on the server
|
||||
*/
|
||||
private boolean isMineshafterPresent() {
|
||||
try {
|
||||
Class.forName("mineshafter.MineServer");
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a json encoded key/value pair to the given string builder.
|
||||
*
|
||||
* @param json
|
||||
* @param key
|
||||
* @param value
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
|
||||
boolean isValueNumeric;
|
||||
|
||||
try {
|
||||
Double.parseDouble(value);
|
||||
isValueNumeric = true;
|
||||
} catch (NumberFormatException e) {
|
||||
isValueNumeric = false;
|
||||
}
|
||||
|
||||
if (json.charAt(json.length() - 1) != '{') {
|
||||
json.append(',');
|
||||
}
|
||||
|
||||
json.append(escapeJSON(key));
|
||||
json.append(':');
|
||||
|
||||
if (isValueNumeric) {
|
||||
json.append(value);
|
||||
} else {
|
||||
json.append(escapeJSON(value));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape a string to create a valid JSON string
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private static String escapeJSON(String text) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
builder.append('"');
|
||||
for (int index = 0; index < text.length(); index++) {
|
||||
char chr = text.charAt(index);
|
||||
|
||||
switch (chr) {
|
||||
case '"':
|
||||
case '\\':
|
||||
builder.append('\\');
|
||||
builder.append(chr);
|
||||
break;
|
||||
case '\b':
|
||||
builder.append("\\b");
|
||||
break;
|
||||
case '\t':
|
||||
builder.append("\\t");
|
||||
break;
|
||||
case '\n':
|
||||
builder.append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
builder.append("\\r");
|
||||
break;
|
||||
default:
|
||||
if (chr < ' ') {
|
||||
String t = "000" + Integer.toHexString(chr);
|
||||
builder.append("\\u" + t.substring(t.length() - 4));
|
||||
} else {
|
||||
builder.append(chr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
builder.append('"');
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode text as UTF-8
|
||||
*
|
||||
* @param text the text to encode
|
||||
* @return the encoded text, as UTF-8
|
||||
*/
|
||||
private static String urlEncode(final String text) throws UnsupportedEncodingException {
|
||||
return URLEncoder.encode(text, "UTF-8");
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a custom graph on the website
|
||||
*/
|
||||
public static class Graph {
|
||||
|
||||
/**
|
||||
* The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
|
||||
* rejected
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* The set of plotters that are contained within this graph
|
||||
*/
|
||||
private final Set<Plotter> plotters = new LinkedHashSet<Plotter>();
|
||||
|
||||
private Graph(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the graph's name
|
||||
*
|
||||
* @return the Graph's name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a plotter to the graph, which will be used to plot entries
|
||||
*
|
||||
* @param plotter the plotter to add to the graph
|
||||
*/
|
||||
public void addPlotter(final Plotter plotter) {
|
||||
plotters.add(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a plotter from the graph
|
||||
*
|
||||
* @param plotter the plotter to remove from the graph
|
||||
*/
|
||||
public void removePlotter(final Plotter plotter) {
|
||||
plotters.remove(plotter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
*
|
||||
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||
*/
|
||||
public Set<Plotter> getPlotters() {
|
||||
return Collections.unmodifiableSet(plotters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return name.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object object) {
|
||||
if (!(object instanceof Graph)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Graph graph = (Graph) object;
|
||||
return graph.name.equals(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
|
||||
*/
|
||||
protected void onOptOut() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface used to collect custom data for a plugin
|
||||
*/
|
||||
public static abstract class Plotter {
|
||||
|
||||
/**
|
||||
* The plot's name
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* Construct a plotter with the default plot name
|
||||
*/
|
||||
public Plotter() {
|
||||
this("Default");
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a plotter with a specific plot name
|
||||
*
|
||||
* @param name the name of the plotter to use, which will show up on the website
|
||||
*/
|
||||
public Plotter(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current value for the plotted point. Since this function defers to an external function it may or may
|
||||
* not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
|
||||
* from any thread so care should be taken when accessing resources that need to be synchronized.
|
||||
*
|
||||
* @return the current value for the point to be plotted.
|
||||
*/
|
||||
public abstract int getValue();
|
||||
|
||||
/**
|
||||
* Get the column name for the plotted point
|
||||
*
|
||||
* @return the plotted point's column name
|
||||
*/
|
||||
public String getColumnName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called after the website graphs have been updated
|
||||
*/
|
||||
public void reset() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getColumnName().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object object) {
|
||||
if (!(object instanceof Plotter)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Plotter plotter = (Plotter) object;
|
||||
return plotter.name.equals(name) && plotter.getValue() == getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.dre.brewery.integration;
|
||||
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.dre.brewery.P;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.internal.permission.RegionPermissionModel;
|
||||
import com.sk89q.worldguard.internal.platform.WorldGuardPlatform;
|
||||
import com.sk89q.worldguard.protection.flags.Flags;
|
||||
import com.sk89q.worldguard.protection.regions.RegionQuery;
|
||||
|
||||
public class WGBarrel7 implements WGBarrel {
|
||||
|
||||
public boolean checkAccess(Player player, Block spigot, Plugin plugin) {
|
||||
WorldGuardPlugin wg = (WorldGuardPlugin) plugin;
|
||||
WorldGuardPlatform platform = WorldGuard.getInstance().getPlatform();
|
||||
|
||||
World world = platform.getWorldByName(spigot.getWorld().getName());
|
||||
if (!platform.getGlobalStateManager().get(world).useRegions) return true; // Region support disabled
|
||||
WorldEditPlugin we = JavaPlugin.getPlugin(WorldEditPlugin.class);
|
||||
if (new RegionPermissionModel((Actor) we.wrapPlayer(player)).mayIgnoreRegionProtection(world)) return true; // Whitelisted cause
|
||||
|
||||
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)) {
|
||||
P.p.msg(player, P.p.languageReader.get("Error_NoBarrelAccess"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class PlayerListener implements Listener {
|
||||
if (materialInHand == null || materialInHand == Material.BUCKET) {
|
||||
return;
|
||||
|
||||
} else if (materialInHand == Material.WATCH) {
|
||||
} else if (materialInHand == LegacyUtil.CLOCK) {
|
||||
BCauldron.printTime(player, clickedBlock);
|
||||
return;
|
||||
|
||||
@@ -67,18 +67,17 @@ public class PlayerListener implements Listener {
|
||||
// reset cauldron when refilling to prevent unlimited source of potions
|
||||
} else if (materialInHand == Material.WATER_BUCKET) {
|
||||
if (!P.use1_9) {
|
||||
if (BCauldron.getFillLevel(clickedBlock) != 0 && BCauldron.getFillLevel(clickedBlock) < 2) {
|
||||
if (LegacyUtil.getFillLevel(clickedBlock) == 1) {
|
||||
// will only remove when existing
|
||||
BCauldron.remove(clickedBlock);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Check if fire alive below cauldron when adding ingredients
|
||||
Block down = clickedBlock.getRelative(BlockFace.DOWN);
|
||||
if (down.getType() == Material.FIRE || down.getType() == Material.STATIONARY_LAVA || down.getType() == Material.LAVA) {
|
||||
if (down.getType() == Material.FIRE || LegacyUtil.isLava(down.getType())) {
|
||||
|
||||
event.setCancelled(true);
|
||||
boolean handSwap = false;
|
||||
@@ -147,11 +146,11 @@ public class PlayerListener implements Listener {
|
||||
|
||||
// Access a Barrel
|
||||
Barrel barrel = null;
|
||||
if (type == Material.WOOD) {
|
||||
if (LegacyUtil.isWoodPlanks(type)) {
|
||||
if (openEverywhere) {
|
||||
barrel = Barrel.get(clickedBlock);
|
||||
}
|
||||
} else if (Barrel.isStairs(type)) {
|
||||
} else if (LegacyUtil.isWoodStairs(type)) {
|
||||
for (Barrel barrel2 : Barrel.barrels) {
|
||||
if (barrel2.hasStairsBlock(clickedBlock)) {
|
||||
if (openEverywhere || !barrel2.isLarge()) {
|
||||
@@ -160,7 +159,7 @@ public class PlayerListener implements Listener {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (Barrel.isFence(type) || type == Material.SIGN_POST || type == Material.WALL_SIGN) {
|
||||
} else if (LegacyUtil.isFence(type) || LegacyUtil.isSign(type)) {
|
||||
barrel = Barrel.getBySpigot(clickedBlock);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user