mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 14:46:45 +01:00
Minor code tweaks
This commit is contained in:
parent
7760631751
commit
07b6942690
@ -171,7 +171,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
getLogger().info("-------- PlotSquared Update Check --------");
|
||||
if (throwable != null) {
|
||||
getLogger().severe(String
|
||||
.format("Could not check for update. Reason: %s",
|
||||
.format("Could not check for updates. Reason: %s",
|
||||
throwable.getMessage()));
|
||||
} else {
|
||||
if (updateDescription == null) {
|
||||
@ -180,8 +180,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
} else {
|
||||
getLogger()
|
||||
.info("There appears to be a PlotSquared update available!");
|
||||
getLogger().info(String.format("You are running version %s,"
|
||||
+ " the newest available version is %s",
|
||||
getLogger().info(String.format(
|
||||
"You are running version %s, the newest available version is %s",
|
||||
getPluginVersionString(), updateDescription.getVersion()));
|
||||
getLogger().info(
|
||||
String.format("Update URL: %s", updateDescription.getUrl()));
|
||||
@ -540,6 +540,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
case PUFFERFISH:
|
||||
case PHANTOM:
|
||||
case ILLUSIONER:
|
||||
case CAT:
|
||||
case PANDA:
|
||||
case FOX:
|
||||
case PILLAGER:
|
||||
case TRADER_LLAMA:
|
||||
case WANDERING_TRADER:
|
||||
case RAVAGER:
|
||||
//case BEE:
|
||||
default: {
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS) {
|
||||
Location location = entity.getLocation();
|
||||
|
@ -73,7 +73,9 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return this.platformGenerator;
|
||||
}
|
||||
|
||||
@Override @NotNull public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
||||
@Override
|
||||
@NotNull
|
||||
public List<BlockPopulator> getDefaultPopulators(@NotNull World world) {
|
||||
try {
|
||||
if (!this.loaded) {
|
||||
String name = world.getName();
|
||||
@ -117,7 +119,8 @@ public class BukkitPlotGenerator extends ChunkGenerator
|
||||
return toAdd;
|
||||
}
|
||||
|
||||
@Override @NotNull
|
||||
@Override
|
||||
@NotNull
|
||||
public ChunkData generateChunkData(@NotNull World world, @NotNull Random random, int x, int z,
|
||||
@NotNull BiomeGrid biome) {
|
||||
|
||||
|
@ -640,7 +640,7 @@ import java.util.regex.Pattern;
|
||||
Optional<List<String>> flag = plot.getFlag(Flags.BLOCKED_CMDS);
|
||||
if (flag.isPresent() && !Permissions
|
||||
.hasPermission(plotPlayer, Captions.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS)) {
|
||||
List<String> blocked_cmds = flag.get();
|
||||
List<String> blockedCommands = flag.get();
|
||||
String part = parts[0];
|
||||
if (parts[0].contains(":")) {
|
||||
part = parts[0].split(":")[1];
|
||||
@ -674,7 +674,7 @@ import java.util.regex.Pattern;
|
||||
if (!s1.equals(part)) {
|
||||
msg = msg.replace(s1, part);
|
||||
}
|
||||
for (String s : blocked_cmds) {
|
||||
for (String s : blockedCommands) {
|
||||
Pattern pattern;
|
||||
if (!RegExUtil.compiledPatterns.containsKey(s)) {
|
||||
RegExUtil.compiledPatterns.put(s, pattern = Pattern.compile(s));
|
||||
@ -745,8 +745,8 @@ import java.util.regex.Pattern;
|
||||
.text(" --------").color("$2").send(pp);
|
||||
new PlotMessage("There appears to be a PlotSquared update available!")
|
||||
.color("$1").send(pp);
|
||||
new PlotMessage(String.format("You are running version %s,"
|
||||
+ " the newest available version is %s",
|
||||
new PlotMessage(String.format(
|
||||
"You are running version %s, the newest available version is %s",
|
||||
bukkitMain.getPluginVersionString(),
|
||||
updateDescription.getVersion())).color("$1").send(pp);
|
||||
new PlotMessage("Update URL").color("$1").text(": ").color("$2")
|
||||
@ -1340,12 +1340,6 @@ import java.util.regex.Pattern;
|
||||
if (Flags.ICE_FORM.isFalse(plot)) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
return;
|
||||
case STONE:
|
||||
case OBSIDIAN:
|
||||
case COBBLESTONE:
|
||||
// TODO event ?
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1491,8 +1485,7 @@ import java.util.regex.Pattern;
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
List<Block> blocks = event.getBlocks();
|
||||
for (Block block1 : blocks) {
|
||||
for (Block block1 : event.getBlocks()) {
|
||||
Location bloc = BukkitUtil.getLocation(block1.getLocation());
|
||||
if (!area.contains(bloc.getX(), bloc.getZ()) || !area
|
||||
.contains(bloc.getX() + relative.getBlockX(), bloc.getZ() + relative.getBlockZ())) {
|
||||
@ -1650,11 +1643,11 @@ import java.util.regex.Pattern;
|
||||
location = BukkitUtil.getLocation(blocks.get(i).getLocation());
|
||||
Plot plot = area.getOwnedPlot(location);
|
||||
/*
|
||||
* plot -> the base plot of the merged area
|
||||
* origin -> the plot where the event gets called
|
||||
* plot → the base plot of the merged area
|
||||
* origin → the plot where the event gets called
|
||||
*/
|
||||
|
||||
// Are plot and origin not the same AND are both plots merged
|
||||
// Are plot and origin different AND are both plots merged
|
||||
if (!Objects.equals(plot, origin) && (!plot.isMerged() && !origin.isMerged())) {
|
||||
event.getBlocks().remove(i);
|
||||
}
|
||||
@ -2025,6 +2018,18 @@ import java.util.regex.Pattern;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (eventType == null) {
|
||||
PlotSquared.log("Please report this to PlotSquared Developers: ");
|
||||
PlotSquared.log("Action: " + event.getAction().toString());
|
||||
PlotSquared.log("HasItem: " + event.hasItem());
|
||||
PlotSquared.log("HasBlock: " + event.hasBlock());
|
||||
PlotSquared.log("getItem: " + (event.hasItem() ? Objects.requireNonNull(event.getItem())
|
||||
.toString() : "null"));
|
||||
PlotSquared.log("getBlockFace: " + (event.getBlockFace() != null ? event.getBlockFace().toString() : "null"));
|
||||
PlotSquared.log("isBlockInHand: " + (event.isBlockInHand()));
|
||||
PlotSquared.log("getClickedBlock: " + (event.getClickedBlock() != null ? event.getClickedBlock().toString() : "null"));
|
||||
return;
|
||||
}
|
||||
if (!EventUtil.manager.checkPlayerBlockEvent(pp, eventType, location, blocktype1, true)) {
|
||||
event.setCancelled(true);
|
||||
event.setUseInteractedBlock(Event.Result.DENY);
|
||||
@ -2372,6 +2377,11 @@ import java.util.regex.Pattern;
|
||||
return;
|
||||
}
|
||||
Player p = event.getPlayer();
|
||||
if (p != null) {
|
||||
PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
||||
Plot plot = area.getPlot(location);
|
||||
if (plot == null) {
|
||||
|
@ -22,105 +22,105 @@ import java.util.stream.IntStream;
|
||||
|
||||
public class BukkitInventoryUtil extends InventoryUtil {
|
||||
|
||||
@Override public void open(PlotInventory inv) {
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
Inventory inventory = Bukkit.createInventory(null, inv.size * 9, inv.getTitle());
|
||||
PlotItemStack[] items = inv.getItems();
|
||||
for (int i = 0; i < inv.size * 9; i++) {
|
||||
PlotItemStack item = items[i];
|
||||
if (item != null) {
|
||||
inventory.setItem(i, getItem(item));
|
||||
}
|
||||
@Override public void open(PlotInventory inv) {
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
Inventory inventory = Bukkit.createInventory(null, inv.size * 9, inv.getTitle());
|
||||
PlotItemStack[] items = inv.getItems();
|
||||
for (int i = 0; i < inv.size * 9; i++) {
|
||||
PlotItemStack item = items[i];
|
||||
if (item != null) {
|
||||
inventory.setItem(i, getItem(item));
|
||||
}
|
||||
}
|
||||
bp.player.openInventory(inventory);
|
||||
}
|
||||
bp.player.openInventory(inventory);
|
||||
}
|
||||
|
||||
@Override public void close(PlotInventory inv) {
|
||||
if (!inv.isOpen()) {
|
||||
return;
|
||||
@Override public void close(PlotInventory inv) {
|
||||
if (!inv.isOpen()) {
|
||||
return;
|
||||
}
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
bp.player.closeInventory();
|
||||
}
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
bp.player.closeInventory();
|
||||
}
|
||||
|
||||
@Override public void setItem(PlotInventory inv, int index, PlotItemStack item) {
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
InventoryView opened = bp.player.getOpenInventory();
|
||||
if (!inv.isOpen()) {
|
||||
return;
|
||||
@Override public void setItem(PlotInventory inv, int index, PlotItemStack item) {
|
||||
BukkitPlayer bp = (BukkitPlayer) inv.player;
|
||||
InventoryView opened = bp.player.getOpenInventory();
|
||||
if (!inv.isOpen()) {
|
||||
return;
|
||||
}
|
||||
opened.setItem(index, getItem(item));
|
||||
bp.player.updateInventory();
|
||||
}
|
||||
opened.setItem(index, getItem(item));
|
||||
bp.player.updateInventory();
|
||||
}
|
||||
|
||||
private static ItemStack getItem(PlotItemStack item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
private static ItemStack getItem(PlotItemStack item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount);
|
||||
ItemMeta meta = null;
|
||||
if (item.name != null) {
|
||||
meta = stack.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name));
|
||||
}
|
||||
if (item.lore != null) {
|
||||
if (meta == null) {
|
||||
meta = stack.getItemMeta();
|
||||
}
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String entry : item.lore) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', entry));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
}
|
||||
if (meta != null) {
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
ItemStack stack = new ItemStack(BukkitAdapter.adapt(item.getType()), item.amount);
|
||||
ItemMeta meta = null;
|
||||
if (item.name != null) {
|
||||
meta = stack.getItemMeta();
|
||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', item.name));
|
||||
}
|
||||
if (item.lore != null) {
|
||||
if (meta == null) {
|
||||
meta = stack.getItemMeta();
|
||||
}
|
||||
List<String> lore = new ArrayList<>();
|
||||
for (String entry : item.lore) {
|
||||
lore.add(ChatColor.translateAlternateColorCodes('&', entry));
|
||||
}
|
||||
meta.setLore(lore);
|
||||
}
|
||||
if (meta != null) {
|
||||
stack.setItemMeta(meta);
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
public PlotItemStack getItem(ItemStack item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
public PlotItemStack getItem(ItemStack item) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
// int id = item.getTypeId();
|
||||
Material id = item.getType();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
int amount = item.getAmount();
|
||||
String name = null;
|
||||
String[] lore = null;
|
||||
if (item.hasItemMeta()) {
|
||||
assert meta != null;
|
||||
if (meta.hasDisplayName()) {
|
||||
name = meta.getDisplayName();
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
List<String> itemLore = meta.getLore();
|
||||
assert itemLore != null;
|
||||
lore = itemLore.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
return new PlotItemStack(id.name(), amount, name, lore);
|
||||
}
|
||||
// int id = item.getTypeId();
|
||||
Material id = item.getType();
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
int amount = item.getAmount();
|
||||
String name = null;
|
||||
String[] lore = null;
|
||||
if (item.hasItemMeta()) {
|
||||
assert meta != null;
|
||||
if (meta.hasDisplayName()) {
|
||||
name = meta.getDisplayName();
|
||||
}
|
||||
if (meta.hasLore()) {
|
||||
List<String> itemLore = meta.getLore();
|
||||
assert itemLore != null;
|
||||
lore = itemLore.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
return new PlotItemStack(id.name(), amount, name, lore);
|
||||
}
|
||||
|
||||
@Override public PlotItemStack[] getItems(PlotPlayer player) {
|
||||
BukkitPlayer bp = (BukkitPlayer) player;
|
||||
PlayerInventory inv = bp.player.getInventory();
|
||||
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i)))
|
||||
.toArray(PlotItemStack[]::new);
|
||||
}
|
||||
@Override public PlotItemStack[] getItems(PlotPlayer player) {
|
||||
BukkitPlayer bp = (BukkitPlayer) player;
|
||||
PlayerInventory inv = bp.player.getInventory();
|
||||
return IntStream.range(0, 36).mapToObj(i -> getItem(inv.getItem(i)))
|
||||
.toArray(PlotItemStack[]::new);
|
||||
}
|
||||
|
||||
@Override public boolean isOpen(PlotInventory plotInventory) {
|
||||
if (!plotInventory.isOpen()) {
|
||||
return false;
|
||||
@Override public boolean isOpen(PlotInventory plotInventory) {
|
||||
if (!plotInventory.isOpen()) {
|
||||
return false;
|
||||
}
|
||||
BukkitPlayer bp = (BukkitPlayer) plotInventory.player;
|
||||
InventoryView opened = bp.player.getOpenInventory();
|
||||
if (plotInventory.isOpen()) {
|
||||
if (opened.getType() == InventoryType.CRAFTING) {
|
||||
opened.getTitle();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
BukkitPlayer bp = (BukkitPlayer) plotInventory.player;
|
||||
InventoryView opened = bp.player.getOpenInventory();
|
||||
if (plotInventory.isOpen()) {
|
||||
if (opened.getType() == InventoryType.CRAFTING) {
|
||||
opened.getTitle();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,4 @@ package com.github.intellectualsites.plotsquared.bukkit.util;
|
||||
|
||||
public class BukkitVersion {
|
||||
public static int[] v1_13_2 = {1, 13, 2};
|
||||
public static int[] v1_13_1 = {1, 13, 1};
|
||||
public static int[] v1_13_0 = {1, 13, 0};
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.google.common.base.Charsets;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
||||
@ -21,7 +22,7 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
|
||||
|
||||
@Override public UUID getUUID(OfflinePlayer player) {
|
||||
return UUID.nameUUIDFromBytes(
|
||||
("OfflinePlayer:" + player.getName().toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
("OfflinePlayer:" + Objects.requireNonNull(player.getName()).toLowerCase()).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
@Override public UUID getUUID(String name) {
|
||||
|
@ -52,8 +52,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
|
||||
try (PreparedStatement stmt = getConnection().prepareStatement(
|
||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username)"
|
||||
+ ')')) {
|
||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username))")) {
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
@ -237,7 +236,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class SQLUUIDHandlerException extends RuntimeException {
|
||||
private static class SQLUUIDHandlerException extends RuntimeException {
|
||||
|
||||
SQLUUIDHandlerException(String s, Throwable c) {
|
||||
super("SQLUUIDHandler caused an exception: " + s, c);
|
||||
|
@ -24,7 +24,7 @@ import java.util.regex.Matcher;
|
||||
* A block bucket is a container of block types, where each block
|
||||
* has a specified chance of being randomly picked
|
||||
*/
|
||||
@EqualsAndHashCode(of={"input"}) @SuppressWarnings({"unused", "WeakerAccess"})
|
||||
@EqualsAndHashCode(of = {"input"}) @SuppressWarnings({"unused", "WeakerAccess"})
|
||||
public final class BlockBucket implements ConfigurationSerializable {
|
||||
private boolean compiled;
|
||||
|
||||
@ -78,7 +78,7 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
private void addBlock(@NonNull final BlockState block, double chance) {
|
||||
if (chance == -1) chance = 1;
|
||||
String prefix = input.length() == 0 ? "" : ",";
|
||||
input.append(prefix).append(chance + "%" + prefix);
|
||||
input.append(prefix).append(chance).append("%").append(prefix);
|
||||
this.compiled = false;
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
this.single = BlockUtil.get(string);
|
||||
this.pattern = new BlockPattern(single);
|
||||
return;
|
||||
} catch (Exception ignore) {}
|
||||
} catch (Exception ignore) { }
|
||||
}
|
||||
for (int i = 0; i < blocksStr.length; i++) {
|
||||
String entry = blocksStr[i];
|
||||
@ -163,7 +163,7 @@ public final class BlockBucket implements ConfigurationSerializable {
|
||||
return ImmutableMap.of("blocks", this.toString());
|
||||
}
|
||||
|
||||
@Getter @EqualsAndHashCode @RequiredArgsConstructor private final static class Range {
|
||||
@Getter @EqualsAndHashCode @RequiredArgsConstructor private static final class Range {
|
||||
|
||||
private final int min;
|
||||
private final int max;
|
||||
|
@ -34,15 +34,15 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
public int getX() {
|
||||
return this.x;
|
||||
}
|
||||
|
||||
|
||||
public int getY() {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
|
||||
public int getZ() {
|
||||
return this.z;
|
||||
}
|
||||
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
this.blockVector3 = BlockVector3.at(x, y, z);
|
||||
@ -105,6 +105,10 @@ public class Location implements Cloneable, Comparable<Location> {
|
||||
return area != null && area.getPlotAbs(this) == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if anyone owns a plot at the current location.
|
||||
* @return true if the location is a road, not a plot area, or if the plot is unclaimed.
|
||||
*/
|
||||
public boolean isUnownedPlotArea() {
|
||||
PlotArea area = getPlotArea();
|
||||
return area != null && area.getOwnedPlotAbs(this) == null;
|
||||
|
@ -117,7 +117,7 @@ public abstract class PlotArea {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the region for this PlotArea or a CuboidRegion encompassing
|
||||
* Returns the region for this PlotArea, or a CuboidRegion encompassing
|
||||
* the whole world if none exists.
|
||||
*
|
||||
* @return CuboidRegion
|
||||
@ -627,7 +627,7 @@ public abstract class PlotArea {
|
||||
this.meta.put(key, value);
|
||||
}
|
||||
|
||||
@NotNull public <T> T getMeta(@Nullable final String key, @NotNull final T def) {
|
||||
@NotNull public <T> T getMeta(@NotNull final String key, @NotNull final T def) {
|
||||
final Object v = getMeta(key);
|
||||
return v == null ? def : (T) v;
|
||||
}
|
||||
@ -637,7 +637,8 @@ public abstract class PlotArea {
|
||||
* <br>
|
||||
* For persistent metadata use the flag system
|
||||
*/
|
||||
@Nullable public Object getMeta(@NotNull final String key) {
|
||||
@Nullable
|
||||
public Object getMeta(@NotNull final String key) {
|
||||
if (this.meta != null) {
|
||||
return this.meta.get(key);
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import com.github.intellectualsites.plotsquared.plot.object.worlds.SinglePlotAre
|
||||
import com.github.intellectualsites.plotsquared.plot.util.expiry.ExpireManager;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
@ -100,7 +101,7 @@ public abstract class EventUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer player, PlayerBlockEventType type,
|
||||
public boolean checkPlayerBlockEvent(PlotPlayer player, @NotNull PlayerBlockEventType type,
|
||||
Location location, BlockType blockType, boolean notifyPerms) {
|
||||
PlotArea area = location.getPlotArea();
|
||||
assert area != null;
|
||||
|
@ -5,6 +5,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -14,13 +15,13 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
public final BlockState[][][] result;
|
||||
private final int width;
|
||||
private final int length;
|
||||
private final int area;
|
||||
@Deprecated private final int area;
|
||||
private final BlockVector3 bot;
|
||||
private final BlockVector3 top;
|
||||
|
||||
public ChunkBlockQueue(BlockVector3 bot, BlockVector3 top, boolean biomes) {
|
||||
super(null, new Location(null, 0, 0, 0), new Location(null, 15, 255, 15));
|
||||
this.width = top.getX() - bot.getX()+ 1;
|
||||
this.width = top.getX() - bot.getX() + 1;
|
||||
this.length = top.getZ() - bot.getZ() + 1;
|
||||
this.area = width * length;
|
||||
this.result = new BlockState[256][][];
|
||||
@ -70,7 +71,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public BlockState getBlock(int x, int y, int z) {
|
||||
@Override
|
||||
@Nullable
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
BlockState[][] blocksY = result[y];
|
||||
if (blocksY != null) {
|
||||
BlockState[] blocksYZ = blocksY[z];
|
||||
@ -81,7 +84,9 @@ public class ChunkBlockQueue extends ScopedLocalBlockQueue {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public String getWorld() {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user