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
6 changes: 3 additions & 3 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.1.0</version>
<version>2.2.0</version>
<packaging>jar</packaging>

<description>A plot creation and management plugin for Minecraft</description>
Expand Down Expand Up @@ -103,7 +103,7 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
<version>23.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -169,7 +169,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
<version>1.18.24</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/modnmetl/virtualrealty/VirtualRealty.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,9 @@ public void onEnable() {
}
if (!pluginConfiguration.license.key.isEmpty() && !pluginConfiguration.license.email.isEmpty()) {
try {
new Loader(pluginConfiguration.license.key, pluginConfiguration.license.email, this.getDescription().getVersion(), getLoader(), false);
new Loader(pluginConfiguration.license.key, pluginConfiguration.license.email, this.getDescription().getVersion(), getLoader(), VirtualRealty.getPluginConfiguration().loaderDebugMode);
} catch (IOException | InstantiationException | IllegalAccessException | ClassNotFoundException e) {
e.printStackTrace();
getLogger().log(Level.WARNING, "Load of premium features failed.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class PermissionsConfiguration extends OkaeriConfig {
@Comment(" - ENTITY_DAMAGE")
@Comment(" - SWITCH")
@Comment(" - ITEM_USE")
@Comment(" - DOORS")
@Comment(" ")
@Comment("Set permissions for players who are not members of the plot.")
private final List<RegionPermission> defaultNonMembers = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public class PluginConfiguration extends OkaeriConfig {
@Comment("Debug mode")
public boolean debugMode = false;

@Comment("Loader debug mode (only for devs)")
public boolean loaderDebugMode = false;

@Comment("Here you put your license details")
public License license = new License();

Expand All @@ -44,6 +47,9 @@ public static class License extends OkaeriConfig {
@CustomKey("default-plot-gamemode")
public String plotGamemode = "SURVIVAL";

@Comment("Disable natural spawning of hostile mobs in plots/areas")
public boolean disablePlotMobsSpawn = false;

@Comment("Lock gamemode to plot default when player enters their plot (disables '/plot gm' command)")
public boolean lockPlotGamemode = false;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.modnmetl.virtualrealty.enums.materials;

public enum DoorMaterial {

WOODEN_DOOR,
IRON_DOOR_BLOCK,
ACACIA_DOOR,
WARPED_DOOR,
CRIMSON_DOOR,
BIRCH_DOOR,
DARK_OAK_DOOR,
IRON_DOOR,
JUNGLE_DOOR,
OAK_DOOR,
SPRUCE_DOOR

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,28 @@

public enum InteractMaterial {

WOODEN_DOOR,
IRON_DOOR_BLOCK,
SMITHING_TABLE,
LOOM,
GRINDSTONE,
CARTOGRAPY_TABLE,

WARPED_FENCE_GATE,
CRIMSON_FENCE_GATE,
WARPED_DOOR,
CRIMSON_DOOR,

ACACIA_DOOR,
BIRCH_TRAPDOOR,
ACACIA_TRAPDOOR,
DARK_OAK_TRAPDOOR,
IRON_TRAPDOOR,
TRAP_DOOR,
CRIMSON_TRAPDOOR,
WARPED_TRAPDOOR,
OAK_TRAPDOOR,
SPRUCE_TRAPDOOR,
JUNGLE_TRAPDOOR,

ACACIA_FENCE_GATE,
ACACIA_BUTTON,
ACACIA_TRAPDOOR,

ANVIL,
ARMOR_STAND,
BARREL,
Expand All @@ -21,17 +32,13 @@ public enum InteractMaterial {
BELL,
BIRCH_BOAT,
BIRCH_BUTTON,
BIRCH_DOOR,
BIRCH_FENCE_GATE,
BIRCH_TRAPDOOR,

BLACK_BED,
BLACK_SHULKER_BOX,
BLAST_FURNACE,
BLUE_BED,
BLUE_SHULKER_BOX,
BREWING_STAND,
BROWN_BED,
BROWN_SHULKER_BOX,
CAMPFIRE,
CAULDRON,
CHEST,
Expand All @@ -44,13 +51,11 @@ public enum InteractMaterial {
COMPOSTER,
CRAFTING_TABLE,
CYAN_BED,
CYAN_SHULKER_BOX,
DAMAGED_ANVIL,
DARK_OAK_BOAT,
DARK_OAK_BUTTON,
DARK_OAK_FENCE_GATE,
DARK_OAK_TRAPDOOR,
DARK_OAK_DOOR,

DAYLIGHT_DETECTOR,
DAYLIGHT_DETECTOR_INVERTED,
DIODE,
Expand All @@ -69,45 +74,34 @@ public enum InteractMaterial {
EXPLOSIVE_MINECART,
FARMLAND,
FLETCHING_TABLE,
FLOWER_POT,
FURNACE,
FURNACE_MINECART,
GRAY_BED,
GRAY_SHULKER_BOX,
GREEN_BED,
GREEN_SHULKER_BOX,
HOPPER,
HOPPER_MINECART,
IRON_DOOR,
IRON_TRAPDOOR,

ITEM_FRAME,
JUKEBOX,
JUNGLE_BUTTON,
JUNGLE_BOAT,
JUNGLE_DOOR,
JUNGLE_FENCE_GATE,
LEVER,
LIGHT_BLUE_BED,
LIGHT_BLUE_SHULKER_BOX,
LIGHT_GRAY_BED,
LIGHT_GRAY_SHULKER_BOX,
LIME_BED,
LIME_SHULKER_BOX,
MAGENTA_BED,
MAGENTA_SHULKER_BOX,
MINECART,
NOTE_BLOCK,
OAK_BOAT,
OAK_BUTTON,
OAK_DOOR,
OAK_FENCE_GATE,
ORANGE_BED,
ORANGE_SHULKER_BOX,
PINK_BED,
PINK_SHULKER_BOX,
POWERED_MINECART,
PURPLE_BED,
PURPLE_SHULKER_BOX,
RED_BED,
RED_SHULKER_BOX,
REDSTONE_ORE,
Expand All @@ -122,23 +116,18 @@ public enum InteractMaterial {
SHULKER_BOX,
SIGN,
SIGN_POST,
SMITHING_TABLE,
SMOKER,
SPRUCE_BOAT,
SPRUCE_BUTTON,
SPRUCE_DOOR,
SPRUCE_FENCE_GATE,
STONECUTTER,
STONE_BUTTON,
STORAGE_MINECART,
TNT_MINECART,
TNT,
TRAP_DOOR,
TRAPPED_CHEST,
WHITE_BED,
WHITE_SHULKER_BOX,
WOOD_BUTTON,
YELLOW_BED,
YELOW_SHULKER_BOX;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.modnmetl.virtualrealty.enums.materials;

public enum StorageMaterial {

CHEST,
TRAPPED_CHEST,
CHEST_MINECART,
ENDER_CHEST,

DISPENSER,
DROPPER,
HOPPER,
SMOKER,
BARREL,

SHULKER_BOX,
CYAN_SHULKER_BOX,
YELLOW_SHULKER_BOX,
LIGHT_BLUE_SHULKER_BOX,
GRAY_SHULKER_BOX,
GREEN_SHULKER_BOX,
RED_SHULKER_BOX,
ORANGE_SHULKER_BOX,
MAGENTA_SHULKER_BOX,
LIME_SHULKER_BOX,
PINK_SHULKER_BOX,
LIGHT_GRAY_SHULKER_BOX,
PURPLE_SHULKER_BOX,
BLUE_SHULKER_BOX,
BLACK_SHULKER_BOX,
WHITE_SHULKER_BOX,
BROWN_SHULKER_BOX,

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public enum SwitchMaterial {
ACACIA_BUTTON,
DARK_OAK_BUTTON,
WARPED_BUTTON,
CRIMSON_BUTTON,
POLISHED_BLACKSTONE_BUTTON,

TRIPWIRE,
COMPARATOR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,29 @@ public enum RegionPermission {
ARMOR_STAND(3, "Armor Stand", new ItemBuilder(Material.ARMOR_STAND)),
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));
ITEM_USE(6, "Item Use", new ItemBuilder(Material.FLINT_AND_STEEL)),
DOORS(7, "Doors", new ItemBuilder(Material.OAK_DOOR));

private final int slot;
private final int index;
private final String name;
private final ItemBuilder item;

RegionPermission(int slot, String name, ItemBuilder item) {
this.slot = slot;
RegionPermission(int index, String name, ItemBuilder item) {
this.index = index;
this.name = name;
this.item = item;
}

public static RegionPermission getPermission(int i) {
int currentSlot = 0;
int endings = 0;
for (RegionPermission value : values()) {
if (value.getSlot() == i) return value;
if ((currentSlot-endings)%7==0 && currentSlot!=0) {
currentSlot+=2;
endings+=2;
}
if (currentSlot == i) return value;
currentSlot++;
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class PlotEntranceListener extends VirtualListener {

Expand All @@ -32,13 +33,14 @@ public void onPlotMove(PlayerMoveEvent e) {
if (e.isCancelled()) return;
Player player = e.getPlayer();
Location to = e.getTo();
if (to == null) return;
Plot plot = PlotManager.getPlot(to);
if (plot != null) {
OfflinePlayer offlinePlayer;
String enterPlotString = VirtualRealty.getMessages().enteredAvailablePlot;
if (plot.getOwnedBy() != null) {
offlinePlayer = Bukkit.getOfflinePlayer(plot.getOwnedBy());
enterPlotString = VirtualRealty.getMessages().enteredOwnedPlot.replaceAll("%owner%", offlinePlayer.getName()).replaceAll("%plot_id%", plot.getID() + "");
enterPlotString = VirtualRealty.getMessages().enteredOwnedPlot.replaceAll("%owner%", Objects.requireNonNull(offlinePlayer.getName())).replaceAll("%plot_id%", plot.getID() + "");
}
if (!enteredPlot.containsKey(player)) {
enteredPlot.put(player, new AbstractMap.SimpleEntry<>(plot, true));
Expand Down Expand Up @@ -72,34 +74,33 @@ public void onPlotMove(PlayerMoveEvent e) {
}
}
} else {
if (enteredPlot.containsKey(player)) {
if (enteredPlot.get(player).getValue()) {
OfflinePlayer offlinePlayer;
String leavePlotString = VirtualRealty.getMessages().leftAvailablePlot;
if (enteredPlot.get(player).getKey().getOwnedBy() != null) {
offlinePlayer = Bukkit.getOfflinePlayer(enteredPlot.get(player).getKey().getOwnedBy());
leavePlotString = VirtualRealty.getMessages().leftOwnedPlot.replaceAll("%owner%", offlinePlayer.getName()).replaceAll("%plot_id%", enteredPlot.get(player).getKey().getID() + "");
if (VirtualRealty.getPluginConfiguration().enablePlotGamemode) {
if (enteredPlot.get(player).getKey().hasMembershipAccess(player.getUniqueId())) {
player.setGameMode(Bukkit.getServer().getDefaultGameMode());
}
if (!enteredPlot.containsKey(player)) return;
if (enteredPlot.get(player).getValue()) {
OfflinePlayer offlinePlayer;
String leavePlotString = VirtualRealty.getMessages().leftAvailablePlot;
if (enteredPlot.get(player).getKey().getOwnedBy() != null) {
offlinePlayer = Bukkit.getOfflinePlayer(enteredPlot.get(player).getKey().getOwnedBy());
leavePlotString = VirtualRealty.getMessages().leftOwnedPlot.replaceAll("%owner%", Objects.requireNonNull(offlinePlayer.getName())).replaceAll("%plot_id%", enteredPlot.get(player).getKey().getID() + "");
if (VirtualRealty.getPluginConfiguration().enablePlotGamemode) {
if (enteredPlot.get(player).getKey().hasMembershipAccess(player.getUniqueId())) {
player.setGameMode(Bukkit.getServer().getDefaultGameMode());
}
}
if (!VirtualRealty.getInstance().getServer().getBukkitVersion().startsWith("1.8")) {
if (VirtualRealty.getPluginConfiguration().plotSound) {
player.playSound(player.getLocation(), Sound.BLOCK_WOODEN_TRAPDOOR_CLOSE, 0.3f, 1f);
}
if (enteredPlot.get(player).getKey().getPlotSize() == PlotSize.AREA) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(VirtualRealty.getMessages().leftProtectedArea));
} else {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(leavePlotString));
}
}
if (!VirtualRealty.getInstance().getServer().getBukkitVersion().startsWith("1.8")) {
if (VirtualRealty.getPluginConfiguration().plotSound) {
player.playSound(player.getLocation(), Sound.BLOCK_WOODEN_TRAPDOOR_CLOSE, 0.3f, 1f);
}
if (enteredPlot.get(player).getKey().getPlotSize() == PlotSize.AREA) {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(VirtualRealty.getMessages().leftProtectedArea));
} else {
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(leavePlotString));
}
enteredPlot.remove(player);
return;
}
enteredPlot.replace(player, new AbstractMap.SimpleEntry<>(enteredPlot.get(player).getKey(), false));
enteredPlot.remove(player);
return;
}
enteredPlot.replace(player, new AbstractMap.SimpleEntry<>(enteredPlot.get(player).getKey(), false));
}
}

Expand Down
Loading