Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.modnmetl</groupId>
<artifactId>virtualrealty</artifactId>
<version>2.2.0</version>
<version>2.2.1</version>
<packaging>jar</packaging>

<description>A plot creation and management plugin for Minecraft</description>
Expand Down Expand Up @@ -127,19 +127,19 @@
<dependency>
<groupId>eu.okaeri</groupId>
<artifactId>okaeri-configs-yaml-bukkit</artifactId>
<version>4.0.0-beta9</version>
<version>4.0.0-beta21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.okaeri</groupId>
<artifactId>okaeri-configs-serdes-bukkit</artifactId>
<version>4.0.0-beta9</version>
<version>4.0.0-beta21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.okaeri</groupId>
<artifactId>okaeri-configs-validator-okaeri</artifactId>
<version>4.0.0-beta9</version>
<version>4.0.0-beta21</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
56 changes: 29 additions & 27 deletions src/main/java/com/modnmetl/virtualrealty/objects/Plot.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -410,7 +412,7 @@ public Set<Block> 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));
}
}
}
Expand Down Expand Up @@ -459,7 +461,7 @@ public Set<Block> 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;
Expand Down Expand Up @@ -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;
}
}
Expand All @@ -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() + ";" +
Expand Down
Loading