diff --git a/pom.xml b/pom.xml
index e435ac1..512b4fb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.modnmetl
virtualrealty
- 2.2.0
+ 2.2.1
jar
A plot creation and management plugin for Minecraft
@@ -127,19 +127,19 @@
eu.okaeri
okaeri-configs-yaml-bukkit
- 4.0.0-beta9
+ 4.0.0-beta21
compile
eu.okaeri
okaeri-configs-serdes-bukkit
- 4.0.0-beta9
+ 4.0.0-beta21
compile
eu.okaeri
okaeri-configs-validator-okaeri
- 4.0.0-beta9
+ 4.0.0-beta21
compile
diff --git a/src/main/java/com/modnmetl/virtualrealty/VirtualRealty.java b/src/main/java/com/modnmetl/virtualrealty/VirtualRealty.java
index 44c8093..5a9cf3e 100644
--- a/src/main/java/com/modnmetl/virtualrealty/VirtualRealty.java
+++ b/src/main/java/com/modnmetl/virtualrealty/VirtualRealty.java
@@ -231,7 +231,7 @@ private void registerCommands() {
PluginCommand vrCommand = this.getCommand("virtualrealty");
assert vrCommand != null;
vrCommand.setExecutor(new VirtualRealtyCommand());
- vrCommand.setTabCompleter( new CommandManager());
+ vrCommand.setTabCompleter(new CommandManager());
registerSubCommands(VirtualRealtyCommand.class);
}
diff --git a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/GmSubCommand.java b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/GmSubCommand.java
index 7bc52e0..8537c28 100644
--- a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/GmSubCommand.java
+++ b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/GmSubCommand.java
@@ -39,23 +39,24 @@ public void exec(CommandSender sender, Command command, String label, String[] a
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().gamemodeFeatureDisabled);
return;
}
- GameMode gameMode;
- int gameModeID;
+ GameMode gameMode = null;
try {
- gameMode = GameMode.valueOf(args[1]);
- gameModeID = gameMode.getValue();
- } catch (IllegalArgumentException e) {
+ gameMode = GameMode.valueOf(args[1].toUpperCase());
+ } catch (Exception ignored) {}
+ if (gameMode == null) {
try {
- gameModeID = Integer.parseInt(args[1]);
+ int gameModeInt = Integer.parseInt(args[1]);
+ gameMode = GameMode.getByValue(gameModeInt);
} catch (IllegalArgumentException ex) {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().incorrectGamemode);
return;
}
}
+ int gameModeID = gameMode.getValue();
GameMode defaultGamemode = VirtualRealty.getInstance().getServer().getDefaultGameMode();
GameMode configGamemode = VirtualRealty.getPluginConfiguration().getDefaultPlotGamemode();
if (!(gameModeID != configGamemode.getValue() && gameModeID != defaultGamemode.getValue())) {
- gameMode = GameMode.getByValue(Integer.parseInt(args[1]));
+ gameMode = GameMode.getByValue(gameModeID);
} else {
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().gamemodeDisabled);
return;
diff --git a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/KickSubCommand.java b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/KickSubCommand.java
index de668fd..3f1bdda 100644
--- a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/KickSubCommand.java
+++ b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/KickSubCommand.java
@@ -79,8 +79,12 @@ public void exec(CommandSender sender, Command command, String label, String[] a
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().cantKickYourself);
return;
}
-
- plot.removeMember(plotMember);
+ PlotMember member = plot.getMember(offlinePlayer.getUniqueId());
+ if (member == null) {
+ sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().playerNotFoundWithUsername);
+ return;
+ }
+ plot.removeMember(member);
sender.sendMessage(VirtualRealty.PREFIX + VirtualRealty.getMessages().playerKick.replaceAll("%player%", offlinePlayer.getName()));
}
diff --git a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/StakeSubCommand.java b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/StakeSubCommand.java
index 5a82939..7c06133 100644
--- a/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/StakeSubCommand.java
+++ b/src/main/java/com/modnmetl/virtualrealty/commands/plot/subcommand/StakeSubCommand.java
@@ -112,6 +112,7 @@ public void run() {
}.runTaskLater(VirtualRealty.getInstance(), 20);
DraftListener.DRAFT_MAP.remove(this.getSender());
ConfirmationManager.removeStakeConfirmations(this.getConfirmationType(), this.getSender().getUniqueId());
+ plot.update();
}
@Override
diff --git a/src/main/java/com/modnmetl/virtualrealty/commands/vrplot/subcommand/ItemSubCommand.java b/src/main/java/com/modnmetl/virtualrealty/commands/vrplot/subcommand/ItemSubCommand.java
index 5013fc5..1e54e18 100644
--- a/src/main/java/com/modnmetl/virtualrealty/commands/vrplot/subcommand/ItemSubCommand.java
+++ b/src/main/java/com/modnmetl/virtualrealty/commands/vrplot/subcommand/ItemSubCommand.java
@@ -69,10 +69,12 @@ public void exec(CommandSender sender, Command command, String label, String[] a
} else {
if (args[5 - backwardArgs].equalsIgnoreCase("default")) {
floorData = new AbstractMap.SimpleEntry<>(plotSize.getFloorMaterial().name(), plotSize.getFloorData());
- } else floorData = new AbstractMap.SimpleEntry<>(Material.valueOf(args[5 - backwardArgs].split(":")[0].toUpperCase()).name(), Byte.valueOf(args[5 - backwardArgs].split(":")[1]));
+ } else
+ floorData = new AbstractMap.SimpleEntry<>(Material.valueOf(args[5 - backwardArgs].split(":")[0].toUpperCase()).name(), Byte.valueOf(args[5 - backwardArgs].split(":")[1]));
if (args[6 - backwardArgs].equalsIgnoreCase("default")) {
borderData = new AbstractMap.SimpleEntry<>(plotSize.getBorderMaterial().name(), plotSize.getBorderData());
- } else borderData = new AbstractMap.SimpleEntry<>(Material.valueOf(args[6 - backwardArgs].split(":")[0].toUpperCase()).name(), Byte.valueOf(args[6 - backwardArgs].split(":")[1]));
+ } else
+ borderData = new AbstractMap.SimpleEntry<>(Material.valueOf(args[6 - backwardArgs].split(":")[0].toUpperCase()).name(), Byte.valueOf(args[6 - backwardArgs].split(":")[1]));
}
} else {
if (isNatural) {
diff --git a/src/main/java/com/modnmetl/virtualrealty/enums/permissions/RegionPermission.java b/src/main/java/com/modnmetl/virtualrealty/enums/permissions/RegionPermission.java
index 581364b..fa33974 100644
--- a/src/main/java/com/modnmetl/virtualrealty/enums/permissions/RegionPermission.java
+++ b/src/main/java/com/modnmetl/virtualrealty/enums/permissions/RegionPermission.java
@@ -16,7 +16,7 @@ public enum RegionPermission {
ENTITY_DAMAGE(4, "Entity Damage", new ItemBuilder(Material.IRON_SWORD).addItemFlag(ItemFlag.HIDE_ATTRIBUTES)),
SWITCH(5, "Switch", new ItemBuilder(Material.LEVER)),
ITEM_USE(6, "Item Use", new ItemBuilder(Material.FLINT_AND_STEEL)),
- DOORS(7, "Doors", new ItemBuilder(Material.OAK_DOOR));
+ DOORS(7, "Doors", new ItemBuilder(VirtualRealty.legacyVersion ? Material.getMaterial("WOODEN_DOOR") : Material.OAK_DOOR));
private final int index;
private final String name;
diff --git a/src/main/java/com/modnmetl/virtualrealty/objects/Plot.java b/src/main/java/com/modnmetl/virtualrealty/objects/Plot.java
index 5bc294c..eaf5317 100644
--- a/src/main/java/com/modnmetl/virtualrealty/objects/Plot.java
+++ b/src/main/java/com/modnmetl/virtualrealty/objects/Plot.java
@@ -157,8 +157,10 @@ public String getBorderMaterialName() {
}
public void teleportPlayer(Player player) {
- Location location = new Location(createdLocation.getWorld(), getCenter().getBlockX(), getCenter().getBlockY() + 1, getCenter().getBlockZ());
- if (!Objects.requireNonNull(createdLocation.getWorld()).getName().endsWith("_nether")) {
+ World world = Bukkit.getWorld(createdWorld);
+ if (world == null) return;
+ Location location = new Location(world, getCenter().getBlockX(), getCenter().getBlockY() + 1, getCenter().getBlockZ());
+ if (!world.getName().endsWith("_nether")) {
location.setY(Objects.requireNonNull(location.getWorld()).getHighestBlockAt(location.getBlockX(), location.getBlockZ()).getY() + 1);
}
player.teleport(location);
@@ -287,11 +289,11 @@ public void setBorderMaterial(Material borderMaterial, byte data) {
}
public BlockVector3 getCenter() {
- return new Cuboid(bottomLeftCorner, topRightCorner, createdLocation.getWorld()).getCenterVector();
+ return new Cuboid(bottomLeftCorner, topRightCorner, getCreatedWorld()).getCenterVector();
}
public Cuboid getCuboid() {
- return new Cuboid(bottomLeftCorner, topRightCorner, createdLocation.getWorld());
+ return new Cuboid(bottomLeftCorner, topRightCorner, getCreatedWorld());
}
public org.bukkit.World getCreatedWorld() {
@@ -324,31 +326,31 @@ public void prepareCorners() {
Location border2;
switch(direction) {
case SOUTH: {
- location1 = new Location(location.getWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
- location2 = new Location(location.getWorld(), location.getBlockX() - width + 1, location.getBlockY() + height, location.getBlockZ() + length - 1);
- border1 = new Location(location.getWorld(), location.getBlockX() + 1, location.getBlockY() - 10, location.getBlockZ() - 1);
- border2 = new Location(location.getWorld(), location.getBlockX() - width, location.getBlockY() + height, location.getBlockZ() + length);
+ location1 = new Location(getCreatedWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
+ location2 = new Location(getCreatedWorld(), location.getBlockX() - width + 1, location.getBlockY() + height, location.getBlockZ() + length - 1);
+ border1 = new Location(getCreatedWorld(), location.getBlockX() + 1, location.getBlockY() - 10, location.getBlockZ() - 1);
+ border2 = new Location(getCreatedWorld(), location.getBlockX() - width, location.getBlockY() + height, location.getBlockZ() + length);
break;
}
case WEST: {
- location1 = new Location(location.getWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
- location2 = new Location(location.getWorld(), location.getBlockX() - length + 1, location.getBlockY() + height, location.getBlockZ() - width + 1);
- border1 = new Location(location.getWorld(), location.getBlockX() + 1, location.getBlockY() - 10, location.getBlockZ() + 1);
- border2 = new Location(location.getWorld(), location.getBlockX() - length, location.getBlockY() + height, location.getBlockZ() - width);
+ location1 = new Location(getCreatedWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
+ location2 = new Location(getCreatedWorld(), location.getBlockX() - length + 1, location.getBlockY() + height, location.getBlockZ() - width + 1);
+ border1 = new Location(getCreatedWorld(), location.getBlockX() + 1, location.getBlockY() - 10, location.getBlockZ() + 1);
+ border2 = new Location(getCreatedWorld(), location.getBlockX() - length, location.getBlockY() + height, location.getBlockZ() - width);
break;
}
case NORTH: {
- location1 = new Location(location.getWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
- location2 = new Location(location.getWorld(), location.getBlockX() + width - 1, location.getBlockY() + height, location.getBlockZ() - length + 1);
- border1 = new Location(location.getWorld(), location.getBlockX() - 1, location.getBlockY() - 10, location.getBlockZ() + 1);
- border2 = new Location(location.getWorld(), location.getBlockX() + width, location.getBlockY() + height, location.getBlockZ() - length);
+ location1 = new Location(getCreatedWorld(), location.getBlockX(), location.getBlockY() - 10, location.getBlockZ());
+ location2 = new Location(getCreatedWorld(), location.getBlockX() + width - 1, location.getBlockY() + height, location.getBlockZ() - length + 1);
+ border1 = new Location(getCreatedWorld(), location.getBlockX() - 1, location.getBlockY() - 10, location.getBlockZ() + 1);
+ border2 = new Location(getCreatedWorld(), location.getBlockX() + width, location.getBlockY() + height, location.getBlockZ() - length);
break;
}
case EAST: {
- location1 = new Location(location.getWorld(), location.getBlockX() + length - 1, location.getBlockY() - 10, location.getBlockZ());
- location2 = new Location(location.getWorld(), location.getBlockX(), location.getBlockY() + height, location.getBlockZ() + width - 1);
- border1 = new Location(location.getWorld(), location.getBlockX() + length, location.getBlockY() - 10, location.getBlockZ() - 1);
- border2 = new Location(location.getWorld(), location.getBlockX() - 1, location.getBlockY() + height, location.getBlockZ() + width);
+ location1 = new Location(getCreatedWorld(), location.getBlockX() + length - 1, location.getBlockY() - 10, location.getBlockZ());
+ location2 = new Location(getCreatedWorld(), location.getBlockX(), location.getBlockY() + height, location.getBlockZ() + width - 1);
+ border1 = new Location(getCreatedWorld(), location.getBlockX() + length, location.getBlockY() - 10, location.getBlockZ() - 1);
+ border2 = new Location(getCreatedWorld(), location.getBlockX() - 1, location.getBlockY() + height, location.getBlockZ() + width);
break;
}
default:
@@ -410,7 +412,7 @@ public Set getBorderBlocks() {
for (int x = minX - 1; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
if (x == minX - 1 || z == minZ || x == maxX - 1 || z == maxZ - 1) {
- blocks.add(Objects.requireNonNull(location.getWorld()).getBlockAt(x, location.getBlockY() + 1, z));
+ blocks.add(Objects.requireNonNull(getCreatedWorld()).getBlockAt(x, location.getBlockY() + 1, z));
}
}
}
@@ -459,7 +461,7 @@ public Set getFloorBlocks() {
}
for (int x = minX - 1; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
- blocks.add(location.getWorld().getBlockAt(x, location.getBlockY(), z));
+ blocks.add(getCreatedWorld().getBlockAt(x, location.getBlockY(), z));
}
}
return blocks;
@@ -573,19 +575,19 @@ public void unloadPlot() {
Location location = null;
switch (createdDirection) {
case SOUTH: {
- location = new Location(createdLocation.getWorld(), createdLocation.getBlockX() - width, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - 1);
+ location = new Location(getCreatedWorld(), createdLocation.getBlockX() - width, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - 1);
break;
}
case WEST: {
- location = new Location(createdLocation.getWorld(), createdLocation.getBlockX() - length, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - width);
+ location = new Location(getCreatedWorld(), createdLocation.getBlockX() - length, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - width);
break;
}
case NORTH: {
- location = new Location(createdLocation.getWorld(), createdLocation.getBlockX() - 1, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - length);
+ location = new Location(getCreatedWorld(), createdLocation.getBlockX() - 1, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - length);
break;
}
case EAST: {
- location = new Location(createdLocation.getWorld(), createdLocation.getBlockX() - 1, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - 1);
+ location = new Location(getCreatedWorld(), createdLocation.getBlockX() - 1, createdLocation.getBlockY() - 10, createdLocation.getBlockZ() - 1);
break;
}
}
@@ -605,7 +607,7 @@ private void modified() {
@SneakyThrows
public void insert() {
String serializedLocation =
- Objects.requireNonNull(this.createdLocation.getWorld()).getName() + ";" +
+ Objects.requireNonNull(this.getCreatedWorld()).getName() + ";" +
this.createdLocation.getX() + ";" +
this.createdLocation.getY() + ";" +
this.createdLocation.getZ() + ";" +
diff --git a/src/main/java/com/modnmetl/virtualrealty/objects/region/GridStructure.java b/src/main/java/com/modnmetl/virtualrealty/objects/region/GridStructure.java
index ac29980..1537d2b 100644
--- a/src/main/java/com/modnmetl/virtualrealty/objects/region/GridStructure.java
+++ b/src/main/java/com/modnmetl/virtualrealty/objects/region/GridStructure.java
@@ -9,6 +9,7 @@
import com.modnmetl.virtualrealty.utils.data.VirtualBlock;
import lombok.Data;
import lombok.SneakyThrows;
+import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -31,7 +32,7 @@ public class GridStructure {
private int width;
private int cuboidId;
private final Set changedBlocks;
- private final World world;
+ private final String world;
private boolean displayingBlocks;
private long displayTicks;
@@ -46,7 +47,7 @@ public GridStructure(Player viewer, int length, int height, int width, int cuboi
this.width = width;
this.cuboidId = cuboidId;
this.changedBlocks = new HashSet<>();
- this.world = world;
+ this.world = world.getName();
this.displayTicks = displayTicks;
this.previewLocation = previewLocation;
}
@@ -55,12 +56,18 @@ public static boolean isCuboidGridDisplaying(Player player, int cuboidId) {
return ACTIVE_GRIDS.containsKey(player.getUniqueId()) && ACTIVE_GRIDS.get(player.getUniqueId()).contains(cuboidId);
}
+ public World getCreatedWorld() {
+ return Bukkit.getWorld(this.world);
+ }
+
public void preview(boolean visualization, boolean colliding) {
preview(null, visualization, colliding);
}
public void preview(Location playerPreviewLocation, boolean visualization, boolean colliding) {
- int maxDistance = viewer.getClientViewDistance() * 16;
+ int maxDistance = 16 * 16;
+ if (!VirtualRealty.legacyVersion)
+ maxDistance = viewer.getClientViewDistance() * 16;
changedBlocks.clear();
Plot plot = PlotManager.getPlot(cuboidId);
LinkedList blocks = new LinkedList<>();
@@ -109,7 +116,7 @@ public void preview(Location playerPreviewLocation, boolean visualization, boole
for (int x = minX - 1; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
if (x == minX - 1 || z == minZ || x == maxX - 1 || z == maxZ - 1) {
- Block block = previewLocation.getWorld().getBlockAt(x, previewLocation.getBlockY(), z);
+ Block block = getCreatedWorld().getBlockAt(x, previewLocation.getBlockY(), z);
if (distanceCalculateLoc.distance(block.getLocation()) < maxDistance) {
borderBlocks.add(block);
}
@@ -124,23 +131,23 @@ public void preview(Location playerPreviewLocation, boolean visualization, boole
} else {
switch (direction) {
case SOUTH: {
- bottomLeftCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() + 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() - 1);
- topRightCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() - getWidth(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() + getLength());
+ bottomLeftCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() + 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() - 1);
+ topRightCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() - getWidth(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() + getLength());
break;
}
case WEST: {
- bottomLeftCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() + 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() + 1);
- topRightCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() - getLength(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() - getWidth());
+ bottomLeftCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() + 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() + 1);
+ topRightCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() - getLength(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() - getWidth());
break;
}
case NORTH: {
- bottomLeftCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() - 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() + 1);
- topRightCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() + getWidth(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() - getLength());
+ bottomLeftCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() - 1, previewLocation.getBlockY() - 10, previewLocation.getBlockZ() + 1);
+ topRightCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() + getWidth(), previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() - getLength());
break;
}
case EAST: {
- bottomLeftCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() + getLength(), previewLocation.getBlockY() - 10, previewLocation.getBlockZ() - 1);
- topRightCorner = new Location(previewLocation.getWorld(), previewLocation.getBlockX() - 1, previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() + getWidth());
+ bottomLeftCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() + getLength(), previewLocation.getBlockY() - 10, previewLocation.getBlockZ() - 1);
+ topRightCorner = new Location(getCreatedWorld(), previewLocation.getBlockX() - 1, previewLocation.getBlockY() + getHeight(), previewLocation.getBlockZ() + getWidth());
break;
}
default:
@@ -169,22 +176,22 @@ public void preview(Location playerPreviewLocation, boolean visualization, boole
BlockVector2 previewV = BlockVector2.at(distanceCalculateLoc.getBlockX(), distanceCalculateLoc.getBlockZ());
if (VectorUtils.distance(previewV, firstPillarV) < maxDistance) {
for (int y = bottomLeftCorner.getBlockY(); y < bottomLeftCorner.getBlockY() + getHeight() + 10; y++) {
- blocks.add(firstPillarV.toLocation(this.world, y).getBlock());
+ blocks.add(firstPillarV.toLocation(getCreatedWorld(), y).getBlock());
}
}
if (VectorUtils.distance(previewV, secondPillarV) < maxDistance) {
for (int y = bottomLeftCorner.getBlockY(); y < bottomLeftCorner.getBlockY() + getHeight() + 10; y++) {
- blocks.add(secondPillarV.toLocation(this.world, y).getBlock());
+ blocks.add(secondPillarV.toLocation(getCreatedWorld(), y).getBlock());
}
}
if (VectorUtils.distance(previewV, thirdPillarV) < maxDistance) {
for (int y = bottomLeftCorner.getBlockY(); y < bottomLeftCorner.getBlockY() + getHeight() + 10; y++) {
- blocks.add(thirdPillarV.toLocation(this.world, y).getBlock());
+ blocks.add(thirdPillarV.toLocation(getCreatedWorld(), y).getBlock());
}
}
if (VectorUtils.distance(previewV, fourthPillarV) < maxDistance) {
for (int y = bottomLeftCorner.getBlockY(); y < bottomLeftCorner.getBlockY() + getHeight() + 10; y++) {
- blocks.add(fourthPillarV.toLocation(this.world, y).getBlock());
+ blocks.add(fourthPillarV.toLocation(getCreatedWorld(), y).getBlock());
}
}
swapBlocks(
@@ -204,7 +211,7 @@ public void run() {
@SneakyThrows
public void removeGrid() {
for (VirtualBlock changedBlock : changedBlocks) {
- Block changedBukkitBlock = changedBlock.getBlock(world);
+ Block changedBukkitBlock = changedBlock.getBlock(getCreatedWorld());
if (VirtualRealty.legacyVersion) {
viewer.sendBlockChange(changedBukkitBlock.getLocation(), changedBukkitBlock.getType(), changedBukkitBlock.getData());
} else {
diff --git a/src/main/java/com/modnmetl/virtualrealty/utils/data/OldSchematicUtil.java b/src/main/java/com/modnmetl/virtualrealty/utils/data/OldSchematicUtil.java
index 5684567..d5164a1 100644
--- a/src/main/java/com/modnmetl/virtualrealty/utils/data/OldSchematicUtil.java
+++ b/src/main/java/com/modnmetl/virtualrealty/utils/data/OldSchematicUtil.java
@@ -27,8 +27,8 @@ public static void paste(int plotID, Location l) {
String[] blocks = load(plotID);
if (blocks == null) return;
Plot plot = PlotManager.getPlot(plotID);
- Location location = new Location(plot.getCreatedLocation().getWorld(), plot.getBorderBottomLeftCorner().getBlockX(), plot.getBorderBottomLeftCorner().getBlockY(), plot.getBorderBottomLeftCorner().getBlockZ());
- Location location2 = new Location(plot.getCreatedLocation().getWorld(), plot.getBorderTopRightCorner().getBlockX(), plot.getBorderTopRightCorner().getBlockY(), plot.getBorderTopRightCorner().getBlockZ());
+ Location location = new Location(plot.getCreatedWorld(), plot.getBorderBottomLeftCorner().getBlockX(), plot.getBorderBottomLeftCorner().getBlockY(), plot.getBorderBottomLeftCorner().getBlockZ());
+ Location location2 = new Location(plot.getCreatedWorld(), plot.getBorderTopRightCorner().getBlockX(), plot.getBorderTopRightCorner().getBlockY(), plot.getBorderTopRightCorner().getBlockZ());
Block pos1Block = location.getBlock();
Block pos2Block = location2.getBlock();
int minX = Math.min(pos1Block.getX(), pos2Block.getX());
diff --git a/src/main/java/com/modnmetl/virtualrealty/utils/multiversion/Chat.java b/src/main/java/com/modnmetl/virtualrealty/utils/multiversion/Chat.java
index 95a2597..c714dcd 100644
--- a/src/main/java/com/modnmetl/virtualrealty/utils/multiversion/Chat.java
+++ b/src/main/java/com/modnmetl/virtualrealty/utils/multiversion/Chat.java
@@ -22,22 +22,7 @@ public Chat(String text) {
}
public void sendTo(CommandSender sender) {
- if (sender instanceof Player) {
- Player player = (Player) sender;
- if (VirtualRealty.legacyVersion) {
- try {
- Method m = Player.class.getDeclaredMethod("sendMessage", BaseComponent.class);
- m.setAccessible(true);
- m.invoke(player, text);
- } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
- e.printStackTrace();
- }
- } else {
- player.spigot().sendMessage(text);
- }
- } else {
- sender.sendMessage(text.toLegacyText());
- }
+ sender.spigot().sendMessage(text);
}