2013-02-10 23:24:30 +01:00
|
|
|
package com.dre.brewery;
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
import java.util.ArrayList;
|
2013-04-28 23:57:41 +02:00
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
2013-04-30 21:41:16 +02:00
|
|
|
import java.util.Map;
|
2013-04-28 23:57:41 +02:00
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
import org.bukkit.Material;
|
2013-12-22 03:49:50 +01:00
|
|
|
import org.bukkit.entity.HumanEntity;
|
2013-04-28 23:57:41 +02:00
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
import org.bukkit.block.Block;
|
2014-04-08 16:11:20 +02:00
|
|
|
import org.bukkit.event.player.PlayerInteractEvent;
|
2013-04-28 23:57:41 +02:00
|
|
|
import org.bukkit.inventory.Inventory;
|
|
|
|
import org.bukkit.inventory.ItemStack;
|
2013-09-01 21:45:02 +02:00
|
|
|
import org.bukkit.inventory.meta.PotionMeta;
|
2013-04-30 21:41:16 +02:00
|
|
|
import org.bukkit.configuration.ConfigurationSection;
|
2014-04-08 16:11:20 +02:00
|
|
|
import org.bukkit.plugin.Plugin;
|
|
|
|
|
2014-05-06 20:45:40 +02:00
|
|
|
import com.dre.brewery.integration.GriefPreventionBarrel;
|
2014-04-08 16:11:20 +02:00
|
|
|
import com.dre.brewery.integration.LWCBarrel;
|
2014-04-09 00:35:08 +02:00
|
|
|
import com.dre.brewery.integration.LogBlockBarrel;
|
2014-04-08 16:11:20 +02:00
|
|
|
import com.dre.brewery.integration.WGBarrel;
|
|
|
|
import org.apache.commons.lang.ArrayUtils;
|
2013-04-28 23:57:41 +02:00
|
|
|
|
2013-02-10 23:24:30 +01:00
|
|
|
public class Barrel {
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
public static CopyOnWriteArrayList<Barrel> barrels = new CopyOnWriteArrayList<Barrel>();
|
2013-04-28 23:57:41 +02:00
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
private Block spigot;
|
2014-04-08 16:11:20 +02:00
|
|
|
private int[] woodsloc = null; // location of wood Blocks
|
|
|
|
private int[] stairsloc = null; // location of stair Blocks
|
|
|
|
private byte signoffset;
|
|
|
|
private boolean checked = false;
|
2013-05-03 16:08:05 +02:00
|
|
|
private Inventory inventory;
|
|
|
|
private float time;
|
2013-04-28 23:57:41 +02:00
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
public Barrel(Block spigot, byte signoffset) {
|
2013-04-28 23:57:41 +02:00
|
|
|
this.spigot = spigot;
|
2014-04-08 16:11:20 +02:00
|
|
|
this.signoffset = signoffset;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// load from file
|
2014-04-08 16:11:20 +02:00
|
|
|
public Barrel(Block spigot, byte sign, String[] st, String[] wo, Map<String, Object> items, float time) {
|
2013-04-30 21:41:16 +02:00
|
|
|
this.spigot = spigot;
|
2014-04-08 16:11:20 +02:00
|
|
|
this.signoffset = sign;
|
2013-05-03 16:08:05 +02:00
|
|
|
if (isLarge()) {
|
2014-03-05 12:51:33 +01:00
|
|
|
this.inventory = org.bukkit.Bukkit.createInventory(null, 27, P.p.languageReader.get("Etc_Barrel"));
|
2013-04-30 21:41:16 +02:00
|
|
|
} else {
|
2014-03-05 12:51:33 +01:00
|
|
|
this.inventory = org.bukkit.Bukkit.createInventory(null, 9, P.p.languageReader.get("Etc_Barrel"));
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
if (items != null) {
|
|
|
|
for (String slot : items.keySet()) {
|
|
|
|
if (items.get(slot) instanceof ItemStack) {
|
|
|
|
this.inventory.setItem(P.p.parseInt(slot), (ItemStack) items.get(slot));
|
|
|
|
}
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
this.time = time;
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
int i = 0;
|
|
|
|
if (wo.length > 1) {
|
|
|
|
woodsloc = new int[wo.length];
|
|
|
|
for (String wos : wo) {
|
|
|
|
woodsloc[i] = P.p.parseInt(wos);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
i = 0;
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
if (st.length > 1) {
|
|
|
|
stairsloc = new int[st.length];
|
|
|
|
for (String sts : st) {
|
|
|
|
stairsloc[i] = P.p.parseInt(sts);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (woodsloc == null && stairsloc == null) {
|
|
|
|
Block broken = getBrokenBlock(true);
|
|
|
|
if (broken != null) {
|
2014-04-09 00:35:08 +02:00
|
|
|
remove(broken, null);
|
2014-04-08 16:11:20 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-30 21:41:16 +02:00
|
|
|
barrels.add(this);
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
public static void onUpdate() {
|
2013-04-28 23:57:41 +02:00
|
|
|
Block broken;
|
2013-05-03 16:08:05 +02:00
|
|
|
for (Barrel barrel : barrels) {
|
2014-04-08 16:11:20 +02:00
|
|
|
if (!barrel.checked) {
|
|
|
|
broken = barrel.getBrokenBlock(false);
|
|
|
|
if (broken != null) {
|
|
|
|
// remove the barrel if it was destroyed
|
2014-04-09 00:35:08 +02:00
|
|
|
barrel.willDestroy();
|
|
|
|
barrel.remove(broken, null);
|
2014-04-08 16:11:20 +02:00
|
|
|
continue;
|
|
|
|
} else {
|
|
|
|
// Dont check this barrel again, its enough to check it once after every restart
|
|
|
|
// as now this is only the backup if we dont register the barrel breaking, as sample
|
|
|
|
// when removing it with some world editor
|
|
|
|
barrel.checked = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Minecraft day is 20 min, so add 1/20 to the time every minute
|
|
|
|
barrel.time += (1.0 / 20.0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasPermsOpen(Player player, PlayerInteractEvent event) {
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useWG) {
|
|
|
|
Plugin plugin = P.p.getServer().getPluginManager().getPlugin("WorldGuard");
|
|
|
|
if (plugin != null) {
|
|
|
|
try {
|
|
|
|
if (!WGBarrel.checkAccess(player, spigot, plugin)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Check WorldGuard for Barrel Open Permissions!");
|
|
|
|
P.p.errorLog("Brewery was tested with version 5.8 of WorldGuard!");
|
|
|
|
e.printStackTrace();
|
|
|
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useGP) {
|
|
|
|
if (P.p.getServer().getPluginManager().isPluginEnabled("GriefPrevention")) {
|
|
|
|
try {
|
|
|
|
if (!GriefPreventionBarrel.checkAccess(player, spigot)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Check GriefPrevention for Barrel Open Permissions!");
|
|
|
|
P.p.errorLog("Brewery only works with the latest release of GriefPrevention (7.8)");
|
|
|
|
e.printStackTrace();
|
|
|
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
|
|
|
return false;
|
|
|
|
}
|
2014-05-06 20:45:40 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
|
2014-05-06 23:19:25 +02:00
|
|
|
if (event != null && P.p.useLWC) {
|
|
|
|
Plugin plugin = P.p.getServer().getPluginManager().getPlugin("LWC");
|
2014-04-08 16:11:20 +02:00
|
|
|
if (plugin != null) {
|
|
|
|
|
|
|
|
// If the Clicked Block was the Sign, LWC already knows and we dont need to do anything here
|
|
|
|
if (!isSign(event.getClickedBlock())) {
|
|
|
|
Block sign = getSignOfSpigot();
|
|
|
|
// If the Barrel does not have a Sign, it cannot be locked
|
|
|
|
if (!sign.equals(event.getClickedBlock())) {
|
2014-05-06 23:19:25 +02:00
|
|
|
try {
|
|
|
|
return LWCBarrel.checkAccess(player, sign, event, plugin);
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Check LWC for Barrel Open Permissions!");
|
|
|
|
P.p.errorLog("Brewery was tested with version 4.3.1 of LWC!");
|
|
|
|
e.printStackTrace();
|
|
|
|
P.p.msg(player, "&cError opening Barrel, please report to an Admin!");
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
}
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-09 00:35:08 +02:00
|
|
|
// Ask for permission to destroy barrel, remove protection if has
|
2014-04-08 16:11:20 +02:00
|
|
|
public boolean hasPermsDestroy(Player player) {
|
2014-04-09 00:35:08 +02:00
|
|
|
if (player == null) {
|
|
|
|
willDestroy();
|
|
|
|
return true;
|
|
|
|
}
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useLWC) {
|
|
|
|
try {
|
|
|
|
return LWCBarrel.checkDestroy(player, this);
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Check LWC for Barrel Break Permissions!");
|
|
|
|
e.printStackTrace();
|
|
|
|
P.p.msg(player, "&cError breaking Barrel, please report to an Admin!");
|
|
|
|
return false;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
|
2014-04-09 00:35:08 +02:00
|
|
|
// If something other than the Player is destroying the barrel, inform protection plugins
|
|
|
|
public void willDestroy() {
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useLWC) {
|
|
|
|
try {
|
|
|
|
LWCBarrel.remove(this);
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Remove LWC Lock from Barrel!");
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2014-04-09 00:35:08 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// player opens the barrel
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-05-03 16:08:05 +02:00
|
|
|
public void open(Player player) {
|
|
|
|
if (inventory == null) {
|
|
|
|
if (isLarge()) {
|
2014-03-05 12:51:33 +01:00
|
|
|
inventory = org.bukkit.Bukkit.createInventory(null, 27, P.p.languageReader.get("Etc_Barrel"));
|
2013-04-29 09:50:19 +02:00
|
|
|
} else {
|
2014-03-05 12:51:33 +01:00
|
|
|
inventory = org.bukkit.Bukkit.createInventory(null, 9, P.p.languageReader.get("Etc_Barrel"));
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
} else {
|
2013-09-05 17:09:20 +02:00
|
|
|
if (time > 0) {
|
|
|
|
// if nobody has the inventory opened
|
|
|
|
if (inventory.getViewers().isEmpty()) {
|
|
|
|
// if inventory contains potions
|
|
|
|
if (inventory.contains(373)) {
|
|
|
|
byte wood = getWood();
|
|
|
|
long loadTime = System.nanoTime();
|
|
|
|
for (ItemStack item : inventory.getContents()) {
|
|
|
|
if (item != null) {
|
|
|
|
Brew brew = Brew.get(item);
|
|
|
|
if (brew != null) {
|
|
|
|
brew.age(item, time, wood);
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
2013-09-05 17:09:20 +02:00
|
|
|
loadTime = System.nanoTime() - loadTime;
|
|
|
|
float ftime = (float) (loadTime / 1000000.0);
|
2013-09-09 16:28:35 +02:00
|
|
|
P.p.debugLog("opening Barrel with potions (" + ftime + "ms)");
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
// reset barreltime, potions have new age
|
2013-04-28 23:57:41 +02:00
|
|
|
time = 0;
|
2014-04-09 00:35:08 +02:00
|
|
|
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useLB) {
|
|
|
|
try {
|
|
|
|
LogBlockBarrel.openBarrel(player, inventory, spigot.getLocation());
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Log Barrel to LogBlock!");
|
|
|
|
P.p.errorLog("Brewery was tested with version 1.80 of LogBlock!");
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2014-04-09 00:35:08 +02:00
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
player.openInventory(inventory);
|
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
// Returns true if this Block is part of this Barrel
|
|
|
|
public boolean hasBlock(Block block) {
|
|
|
|
if (block != null) {
|
|
|
|
if (block.getType().equals(Material.WOOD)) {
|
|
|
|
if (hasWoodBlock(block)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else if (isStairs(block.getType())) {
|
|
|
|
if (hasStairsBlock(block)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasWoodBlock(Block block) {
|
|
|
|
if (woodsloc != null) {
|
|
|
|
if (spigot.getWorld() != null && spigot.getWorld().equals(block.getWorld())) {
|
|
|
|
if (woodsloc.length > 2) {
|
|
|
|
int x = block.getX();
|
|
|
|
if (Math.abs(x - woodsloc[0]) < 10) {
|
|
|
|
for (int i = 0; i < woodsloc.length - 2; i += 3) {
|
|
|
|
if (woodsloc[i] == x) {
|
|
|
|
if (woodsloc[i + 1] == block.getY()) {
|
|
|
|
if (woodsloc[i + 2] == block.getZ()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasStairsBlock(Block block) {
|
|
|
|
if (stairsloc != null) {
|
|
|
|
if (spigot.getWorld() != null && spigot.getWorld().equals(block.getWorld())) {
|
|
|
|
if (stairsloc.length > 2) {
|
|
|
|
int x = block.getX();
|
|
|
|
if (Math.abs(x - stairsloc[0]) < 10) {
|
|
|
|
for (int i = 0; i < stairsloc.length - 2; i += 3) {
|
|
|
|
if (stairsloc[i] == x) {
|
|
|
|
if (stairsloc[i + 1] == block.getY()) {
|
|
|
|
if (stairsloc[i + 2] == block.getZ()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns true if the Offset of the clicked Sign matches the Barrel.
|
|
|
|
// This prevents adding another sign to the barrel and clicking that.
|
|
|
|
public boolean isSignOfBarrel(byte offset) {
|
|
|
|
return offset == 0 || signoffset == 0 || signoffset == offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the Barrel by Block, null if that block is not part of a barrel
|
|
|
|
public static Barrel get(Block block) {
|
|
|
|
if (block != null) {
|
|
|
|
switch (block.getType()) {
|
|
|
|
case FENCE:
|
|
|
|
case NETHER_FENCE:
|
|
|
|
case SIGN:
|
|
|
|
case WALL_SIGN:
|
|
|
|
Barrel barrel = getBySpigot(block);
|
|
|
|
if (barrel != null) {
|
|
|
|
return barrel;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
case WOOD:
|
|
|
|
case WOOD_STAIRS:
|
|
|
|
case ACACIA_STAIRS:
|
|
|
|
case BIRCH_WOOD_STAIRS:
|
|
|
|
case DARK_OAK_STAIRS:
|
|
|
|
case JUNGLE_WOOD_STAIRS:
|
|
|
|
case SPRUCE_WOOD_STAIRS:
|
|
|
|
Barrel barrel2 = getByWood(block);
|
|
|
|
if (barrel2 != null) {
|
|
|
|
return barrel2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the Barrel by Sign or Spigot (Fastest)
|
|
|
|
public static Barrel getBySpigot(Block sign) {
|
2013-05-03 16:08:05 +02:00
|
|
|
// convert spigot if neccessary
|
2014-04-08 16:11:20 +02:00
|
|
|
Block spigot = getSpigotOfSign(sign);
|
|
|
|
|
|
|
|
byte signoffset = 0;
|
|
|
|
if (!spigot.equals(sign)) {
|
|
|
|
signoffset = (byte) (sign.getY() - spigot.getY());
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
for (Barrel barrel : barrels) {
|
2014-04-08 16:11:20 +02:00
|
|
|
if (barrel.isSignOfBarrel(signoffset)) {
|
|
|
|
if (barrel.spigot.equals(spigot)) {
|
|
|
|
if (barrel.signoffset == 0 && signoffset != 0) {
|
|
|
|
// Barrel has no signOffset even though we clicked a sign, may be old
|
|
|
|
barrel.signoffset = signoffset;
|
|
|
|
}
|
|
|
|
return barrel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the barrel by its corpus (Wood Planks, Stairs)
|
|
|
|
public static Barrel getByWood(Block wood) {
|
|
|
|
if (wood.getType().equals(Material.WOOD)) {
|
|
|
|
for (Barrel barrel : barrels) {
|
|
|
|
if (barrel.hasWoodBlock(wood)) {
|
|
|
|
return barrel;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (isStairs(wood.getType())) {
|
|
|
|
for (Barrel barrel : Barrel.barrels) {
|
|
|
|
if (barrel.hasStairsBlock(wood)) {
|
|
|
|
return barrel;
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// creates a new Barrel out of a sign
|
2014-04-08 16:11:20 +02:00
|
|
|
public static boolean create(Block sign) {
|
|
|
|
Block spigot = getSpigotOfSign(sign);
|
|
|
|
|
|
|
|
byte signoffset = 0;
|
|
|
|
if (!spigot.equals(sign)) {
|
|
|
|
signoffset = (byte) (sign.getY() - spigot.getY());
|
|
|
|
}
|
|
|
|
|
|
|
|
Barrel barrel = getBySpigot(spigot);
|
|
|
|
if (barrel == null) {
|
|
|
|
barrel = new Barrel(spigot, signoffset);
|
|
|
|
if (barrel.getBrokenBlock(true) == null) {
|
|
|
|
barrels.add(barrel);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (barrel.signoffset == 0 && signoffset != 0) {
|
|
|
|
barrel.signoffset = signoffset;
|
2013-04-28 23:57:41 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// removes a barrel, throwing included potions to the ground
|
2014-04-09 00:35:08 +02:00
|
|
|
public void remove(Block broken, Player breaker) {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (inventory != null) {
|
2013-12-22 03:49:50 +01:00
|
|
|
for (HumanEntity human : inventory.getViewers()) {
|
|
|
|
human.closeInventory();
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
ItemStack[] items = inventory.getContents();
|
2014-05-06 23:19:25 +02:00
|
|
|
if (P.p.useLB && breaker != null) {
|
|
|
|
try {
|
|
|
|
LogBlockBarrel.breakBarrel(breaker.getName(), items, spigot.getLocation());
|
|
|
|
} catch (Exception e) {
|
|
|
|
P.p.errorLog("Failed to Log Barrel-break to LogBlock!");
|
|
|
|
P.p.errorLog("Brewery was tested with version 1.80 of LogBlock!");
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
2014-04-09 00:35:08 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
for (ItemStack item : items) {
|
|
|
|
if (item != null) {
|
2013-08-30 21:19:49 +02:00
|
|
|
Brew brew = Brew.get(item);
|
|
|
|
if (brew != null) {
|
2013-05-03 16:08:05 +02:00
|
|
|
// Brew before throwing
|
2013-08-30 21:19:49 +02:00
|
|
|
brew.age(item, time, getWood());
|
2013-09-01 21:45:02 +02:00
|
|
|
PotionMeta meta = (PotionMeta) item.getItemMeta();
|
|
|
|
if (Brew.hasColorLore(meta)) {
|
|
|
|
brew.convertLore(meta, false);
|
|
|
|
item.setItemMeta(meta);
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
// "broken" is the block that destroyed, throw them there!
|
|
|
|
if (broken != null) {
|
2013-05-09 21:47:58 +02:00
|
|
|
broken.getWorld().dropItem(broken.getLocation(), item);
|
2013-04-28 23:57:41 +02:00
|
|
|
} else {
|
2013-05-09 21:47:58 +02:00
|
|
|
spigot.getWorld().dropItem(spigot.getLocation(), item);
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
|
2013-04-28 23:57:41 +02:00
|
|
|
barrels.remove(this);
|
|
|
|
}
|
|
|
|
|
2013-05-09 21:47:58 +02:00
|
|
|
//unloads barrels that are in a unloading world
|
|
|
|
public static void onUnload(String name) {
|
|
|
|
for (Barrel barrel : barrels) {
|
|
|
|
if (barrel.spigot.getWorld().getName().equals(name)) {
|
|
|
|
barrels.remove(barrel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
// If the Sign of a Large Barrel gets destroyed, set signOffset to 0
|
|
|
|
public void destroySign() {
|
|
|
|
signoffset = 0;
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// Saves all data
|
2013-05-10 00:01:28 +02:00
|
|
|
public static void save(ConfigurationSection config, ConfigurationSection oldData) {
|
2013-07-28 23:53:35 +02:00
|
|
|
P.p.createWorldSections(config);
|
|
|
|
|
2013-05-28 16:25:06 +02:00
|
|
|
if (!barrels.isEmpty()) {
|
|
|
|
int id = 0;
|
|
|
|
for (Barrel barrel : barrels) {
|
2013-06-05 19:44:30 +02:00
|
|
|
|
|
|
|
String worldName = barrel.spigot.getWorld().getName();
|
2014-04-08 16:11:20 +02:00
|
|
|
String prefix;
|
2013-06-05 19:44:30 +02:00
|
|
|
|
|
|
|
if (worldName.startsWith("DXL_")) {
|
|
|
|
prefix = P.p.getDxlName(worldName) + "." + id;
|
|
|
|
} else {
|
|
|
|
prefix = barrel.spigot.getWorld().getUID().toString() + "." + id;
|
|
|
|
}
|
|
|
|
|
2013-05-28 16:25:06 +02:00
|
|
|
// block: x/y/z
|
|
|
|
config.set(prefix + ".spigot", barrel.spigot.getX() + "/" + barrel.spigot.getY() + "/" + barrel.spigot.getZ());
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
if (barrel.signoffset != 0) {
|
|
|
|
config.set(prefix + ".sign", barrel.signoffset);
|
|
|
|
}
|
|
|
|
if (barrel.stairsloc != null && barrel.stairsloc.length > 0) {
|
|
|
|
StringBuilder st = new StringBuilder();
|
|
|
|
for (int i : barrel.stairsloc) {
|
|
|
|
st.append(i).append(",");
|
|
|
|
}
|
|
|
|
config.set(prefix + ".st", st.substring(0, st.length() - 1));
|
|
|
|
}
|
|
|
|
if (barrel.woodsloc != null && barrel.woodsloc.length > 0) {
|
|
|
|
StringBuilder wo = new StringBuilder();
|
|
|
|
for (int i : barrel.woodsloc) {
|
|
|
|
wo.append(i).append(",");
|
|
|
|
}
|
|
|
|
config.set(prefix + ".wo", wo.substring(0, wo.length() - 1));
|
|
|
|
}
|
|
|
|
|
2013-05-28 16:25:06 +02:00
|
|
|
if (barrel.inventory != null) {
|
|
|
|
int slot = 0;
|
2014-04-08 16:11:20 +02:00
|
|
|
ItemStack item;
|
2013-05-28 16:25:06 +02:00
|
|
|
ConfigurationSection invConfig = null;
|
|
|
|
while (slot < barrel.inventory.getSize()) {
|
|
|
|
item = barrel.inventory.getItem(slot);
|
|
|
|
if (item != null) {
|
|
|
|
if (invConfig == null) {
|
|
|
|
if (barrel.time != 0) {
|
|
|
|
config.set(prefix + ".time", barrel.time);
|
|
|
|
}
|
|
|
|
invConfig = config.createSection(prefix + ".inv");
|
2013-05-09 21:47:58 +02:00
|
|
|
}
|
2013-05-28 16:25:06 +02:00
|
|
|
// ItemStacks are configurationSerializeable, makes them
|
|
|
|
// really easy to save
|
|
|
|
invConfig.set(slot + "", item);
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
|
|
|
|
2013-05-28 16:25:06 +02:00
|
|
|
slot++;
|
|
|
|
}
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
|
|
|
|
2013-05-28 16:25:06 +02:00
|
|
|
id++;
|
|
|
|
}
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
2013-05-09 21:47:58 +02:00
|
|
|
// also save barrels that are not loaded
|
2013-05-10 00:01:28 +02:00
|
|
|
if (oldData != null){
|
|
|
|
for (String uuid : oldData.getKeys(false)) {
|
|
|
|
if (!config.contains(uuid)) {
|
|
|
|
config.set(uuid, oldData.get(uuid));
|
|
|
|
}
|
2013-05-09 21:47:58 +02:00
|
|
|
}
|
|
|
|
}
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// direction of the barrel from the spigot
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-05-03 16:08:05 +02:00
|
|
|
public static int getDirection(Block spigot) {
|
|
|
|
int direction = 0;// 1=x+ 2=x- 3=z+ 4=z-
|
|
|
|
int typeId = spigot.getRelative(0, 0, 1).getTypeId();
|
2014-04-08 16:11:20 +02:00
|
|
|
if (typeId == 5 || isStairs(typeId)) {
|
2013-04-28 23:57:41 +02:00
|
|
|
direction = 3;
|
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
typeId = spigot.getRelative(0, 0, -1).getTypeId();
|
2014-04-08 16:11:20 +02:00
|
|
|
if (typeId == 5 || isStairs(typeId)) {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
direction = 4;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
typeId = spigot.getRelative(1, 0, 0).getTypeId();
|
2014-04-08 16:11:20 +02:00
|
|
|
if (typeId == 5 || isStairs(typeId)) {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
direction = 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
typeId = spigot.getRelative(-1, 0, 0).getTypeId();
|
2014-04-08 16:11:20 +02:00
|
|
|
if (typeId == 5 || isStairs(typeId)) {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
direction = 2;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return direction;
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// is this a Large barrel?
|
|
|
|
public boolean isLarge() {
|
2014-04-08 16:11:20 +02:00
|
|
|
return !isSign(spigot);
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// true for small barrels
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-05-03 16:08:05 +02:00
|
|
|
public static boolean isSign(Block spigot) {
|
2014-04-08 16:11:20 +02:00
|
|
|
return spigot.getTypeId() == 63 || spigot.getTypeId() == 68;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// woodtype of the block the spigot is attached to
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-05-03 16:08:05 +02:00
|
|
|
public byte getWood() {
|
|
|
|
int direction = getDirection(this.spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
2014-04-08 16:11:20 +02:00
|
|
|
Block wood;
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
return 0;
|
2013-05-03 16:08:05 +02:00
|
|
|
} else if (direction == 1) {
|
|
|
|
wood = this.spigot.getRelative(1, 0, 0);
|
|
|
|
} else if (direction == 2) {
|
|
|
|
wood = this.spigot.getRelative(-1, 0, 0);
|
|
|
|
} else if (direction == 3) {
|
|
|
|
wood = this.spigot.getRelative(0, 0, 1);
|
2013-04-28 23:57:41 +02:00
|
|
|
} else {
|
2013-05-03 16:08:05 +02:00
|
|
|
wood = this.spigot.getRelative(0, 0, -1);
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
if (wood.getTypeId() == 5) {
|
2013-09-05 17:09:20 +02:00
|
|
|
byte data = wood.getData();
|
|
|
|
if (data == 0x0) {
|
|
|
|
return 2;
|
|
|
|
} else if (data == 0x1) {
|
|
|
|
return 4;
|
|
|
|
} else if (data == 0x2) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 3;
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
if (wood.getTypeId() == 53) {
|
2013-09-05 17:09:20 +02:00
|
|
|
return 2;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
if (wood.getTypeId() == 134) {
|
2013-09-05 17:09:20 +02:00
|
|
|
return 4;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
if (wood.getTypeId() == 135) {
|
2013-09-05 17:09:20 +02:00
|
|
|
return 1;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-05-03 16:08:05 +02:00
|
|
|
if (wood.getTypeId() == 136) {
|
2013-09-05 17:09:20 +02:00
|
|
|
return 3;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
// returns the Sign of a large barrel, the spigot if there is none
|
|
|
|
public Block getSignOfSpigot() {
|
|
|
|
if (signoffset != 0) {
|
|
|
|
if (isSign(spigot)) {
|
|
|
|
return spigot;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isSign(spigot.getRelative(0, signoffset, 0))) {
|
|
|
|
return spigot.getRelative(0, signoffset, 0);
|
|
|
|
} else {
|
|
|
|
signoffset = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return spigot;
|
|
|
|
}
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
// returns the fence above/below a block, itself if there is none
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
2013-05-03 16:08:05 +02:00
|
|
|
public static Block getSpigotOfSign(Block block) {
|
2013-04-30 21:41:16 +02:00
|
|
|
|
|
|
|
int y = -2;
|
2013-05-03 16:08:05 +02:00
|
|
|
while (y <= 1) {
|
|
|
|
// Fence and Netherfence
|
2014-04-08 16:11:20 +02:00
|
|
|
Block relative = block.getRelative(0, y, 0);
|
|
|
|
if (relative.getTypeId() == 85 || relative.getTypeId() == 113) {
|
|
|
|
return (relative);
|
2013-04-30 21:41:16 +02:00
|
|
|
}
|
|
|
|
y++;
|
|
|
|
}
|
|
|
|
return block;
|
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
public static boolean isStairs(Material mat) {
|
|
|
|
return isStairs(mat.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean isStairs(int id) {
|
|
|
|
return id == 53 || id == 134 || id == 135 || id == 136 || id == 163 || id == 164;
|
|
|
|
}
|
|
|
|
|
|
|
|
// returns null if Barrel is correctly placed; the block that is missing when not
|
2013-05-03 16:08:05 +02:00
|
|
|
// the barrel needs to be formed correctly
|
2014-04-08 16:11:20 +02:00
|
|
|
// flag force to also check if chunk is not loaded
|
|
|
|
public Block getBrokenBlock(boolean force) {
|
|
|
|
if (force || spigot.getChunk().isLoaded()) {
|
2013-06-30 23:41:37 +02:00
|
|
|
spigot = getSpigotOfSign(spigot);
|
|
|
|
if (isSign(spigot)) {
|
2014-04-08 16:11:20 +02:00
|
|
|
return checkSBarrel();
|
2013-06-30 23:41:37 +02:00
|
|
|
} else {
|
2014-04-08 16:11:20 +02:00
|
|
|
return checkLBarrel();
|
2013-06-30 23:41:37 +02:00
|
|
|
}
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
2013-06-30 23:41:37 +02:00
|
|
|
return null;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
public Block checkSBarrel() {
|
2013-05-03 16:08:05 +02:00
|
|
|
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
return spigot;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
int startX;
|
|
|
|
int startZ;
|
2013-04-29 09:50:19 +02:00
|
|
|
int endX;
|
|
|
|
int endZ;
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
ArrayList<Integer> stairs = new ArrayList<Integer>();
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 1) {
|
2013-04-29 09:50:19 +02:00
|
|
|
startX = 1;
|
|
|
|
endX = startX + 1;
|
|
|
|
startZ = -1;
|
|
|
|
endZ = 0;
|
2013-05-03 16:08:05 +02:00
|
|
|
} else if (direction == 2) {
|
2013-04-29 09:50:19 +02:00
|
|
|
startX = -2;
|
|
|
|
endX = startX + 1;
|
|
|
|
startZ = 0;
|
|
|
|
endZ = 1;
|
2013-05-03 16:08:05 +02:00
|
|
|
} else if (direction == 3) {
|
2013-04-29 09:50:19 +02:00
|
|
|
startX = 0;
|
|
|
|
endX = 1;
|
|
|
|
startZ = 1;
|
|
|
|
endZ = startZ + 1;
|
|
|
|
} else {
|
|
|
|
startX = -1;
|
|
|
|
endX = 0;
|
|
|
|
startZ = -2;
|
|
|
|
endZ = startZ + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int typeId;
|
|
|
|
int x = startX;
|
|
|
|
int y = 0;
|
|
|
|
int z = startZ;
|
2013-05-03 16:08:05 +02:00
|
|
|
while (y <= 1) {
|
|
|
|
while (x <= endX) {
|
|
|
|
while (z <= endZ) {
|
2014-04-08 16:11:20 +02:00
|
|
|
Block block = spigot.getRelative(x, y, z);
|
|
|
|
typeId = block.getTypeId();
|
2013-05-03 16:08:05 +02:00
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
if (isStairs(typeId)) {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (y == 0) {
|
|
|
|
// stairs have to be upside down
|
2014-04-08 16:11:20 +02:00
|
|
|
if (block.getData() < 4) {
|
|
|
|
return block;
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
stairs.add(block.getX());
|
|
|
|
stairs.add(block.getY());
|
|
|
|
stairs.add(block.getZ());
|
2013-04-29 09:50:19 +02:00
|
|
|
z++;
|
|
|
|
} else {
|
2013-05-03 16:08:05 +02:00
|
|
|
return spigot.getRelative(x, y, z);
|
2013-04-29 09:50:19 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
z = startZ;
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
z = startZ;
|
|
|
|
x = startX;
|
|
|
|
y++;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
stairsloc = ArrayUtils.toPrimitive(stairs.toArray(new Integer[stairs.size()]));
|
2013-04-29 09:50:19 +02:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
public Block checkLBarrel() {
|
2013-05-03 16:08:05 +02:00
|
|
|
int direction = getDirection(spigot);// 1=x+ 2=x- 3=z+ 4=z-
|
|
|
|
if (direction == 0) {
|
2013-04-28 23:57:41 +02:00
|
|
|
return spigot;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
int startX;
|
|
|
|
int startZ;
|
2013-04-28 23:57:41 +02:00
|
|
|
int endX;
|
|
|
|
int endZ;
|
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
ArrayList<Integer> stairs = new ArrayList<Integer>();
|
|
|
|
ArrayList<Integer> woods = new ArrayList<Integer>();
|
|
|
|
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 1) {
|
2013-04-28 23:57:41 +02:00
|
|
|
startX = 1;
|
|
|
|
endX = startX + 3;
|
|
|
|
startZ = -1;
|
|
|
|
endZ = 1;
|
2013-05-03 16:08:05 +02:00
|
|
|
} else if (direction == 2) {
|
2013-04-28 23:57:41 +02:00
|
|
|
startX = -4;
|
|
|
|
endX = startX + 3;
|
|
|
|
startZ = -1;
|
|
|
|
endZ = 1;
|
2013-05-03 16:08:05 +02:00
|
|
|
} else if (direction == 3) {
|
2013-04-28 23:57:41 +02:00
|
|
|
startX = -1;
|
|
|
|
endX = 1;
|
|
|
|
startZ = 1;
|
|
|
|
endZ = startZ + 3;
|
|
|
|
} else {
|
|
|
|
startX = -1;
|
|
|
|
endX = 1;
|
|
|
|
startZ = -4;
|
|
|
|
endZ = startZ + 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
int typeId;
|
|
|
|
int x = startX;
|
|
|
|
int y = 0;
|
|
|
|
int z = startZ;
|
2013-05-03 16:08:05 +02:00
|
|
|
while (y <= 2) {
|
|
|
|
while (x <= endX) {
|
|
|
|
while (z <= endZ) {
|
2014-04-08 16:11:20 +02:00
|
|
|
Block block = spigot.getRelative(x, y, z);
|
|
|
|
typeId = block.getTypeId();
|
2013-05-03 16:08:05 +02:00
|
|
|
if (direction == 1 || direction == 2) {
|
|
|
|
if (y == 1 && z == 0) {
|
2014-04-08 16:11:20 +02:00
|
|
|
if (x == -1 || x == -4 || x == 1 || x == 4) {
|
|
|
|
woods.add(block.getX());
|
|
|
|
woods.add(block.getY());
|
|
|
|
woods.add(block.getZ());
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
z++;
|
|
|
|
continue;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
} else {
|
2013-05-03 16:08:05 +02:00
|
|
|
if (y == 1 && x == 0) {
|
2014-04-08 16:11:20 +02:00
|
|
|
if (z == -1 || z == -4 || z == 1 || z == 4) {
|
|
|
|
woods.add(block.getX());
|
|
|
|
woods.add(block.getY());
|
|
|
|
woods.add(block.getZ());
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
z++;
|
|
|
|
continue;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
if (typeId == 5 || isStairs(typeId)) {
|
|
|
|
if (typeId == 5) {
|
|
|
|
woods.add(block.getX());
|
|
|
|
woods.add(block.getY());
|
|
|
|
woods.add(block.getZ());
|
|
|
|
} else {
|
|
|
|
stairs.add(block.getX());
|
|
|
|
stairs.add(block.getY());
|
|
|
|
stairs.add(block.getZ());
|
|
|
|
}
|
2013-04-28 23:57:41 +02:00
|
|
|
z++;
|
|
|
|
} else {
|
2014-04-08 16:11:20 +02:00
|
|
|
return block;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
z = startZ;
|
|
|
|
x++;
|
|
|
|
}
|
|
|
|
z = startZ;
|
|
|
|
x = startX;
|
|
|
|
y++;
|
|
|
|
}
|
2014-04-08 16:11:20 +02:00
|
|
|
stairsloc = ArrayUtils.toPrimitive(stairs.toArray(new Integer[stairs.size()]));
|
|
|
|
woodsloc = ArrayUtils.toPrimitive(woods.toArray(new Integer[woods.size()]));
|
2013-04-28 23:57:41 +02:00
|
|
|
|
2014-04-08 16:11:20 +02:00
|
|
|
return null;
|
2013-04-28 23:57:41 +02:00
|
|
|
}
|
|
|
|
|
2013-02-10 23:24:30 +01:00
|
|
|
}
|