diff --git a/plugin.yml b/plugin.yml
index 57ae179a1..334c6bb70 100644
--- a/plugin.yml
+++ b/plugin.yml
@@ -1,5 +1,6 @@
main: ${project.groupId}.${project.name}
name: ${project.name}
+api-version: 1.13
version: ${project.version}
website: ${project.url}
description: ${project.description}
diff --git a/pom.xml b/pom.xml
index 251f87d2c..f945eb9b4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.massivecraft.massivesuper
MassiveSuper
- 2.14.1-SNAPSHOT
+ 2.15.1-SNAPSHOT
../MassiveSuper
@@ -39,7 +39,7 @@
com.sk89q.worldguard
- worldguard-legacy
+ worldguard-bukkit
diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java
index a707383eb..96bf57778 100644
--- a/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java
+++ b/src/com/massivecraft/factions/cmd/CmdFactionsSeeChunkOld.java
@@ -68,8 +68,8 @@ public static void showPillar(Player player, World world, int blockX, int blockZ
{
Location loc = new Location(world, blockX, blockY, blockZ);
if (loc.getBlock().getType() != Material.AIR) continue;
- int typeId = blockY % 5 == 0 ? Material.GLOWSTONE.getId() : Material.GLASS.getId();
- VisualizeUtil.addLocation(player, loc, typeId);
+ Material type = blockY % 5 == 0 ? Material.GLOWSTONE : Material.GLASS;
+ VisualizeUtil.addLocation(player, loc, type);
}
}
diff --git a/src/com/massivecraft/factions/engine/EngineExploit.java b/src/com/massivecraft/factions/engine/EngineExploit.java
index 5dc683eab..593e894a6 100644
--- a/src/com/massivecraft/factions/engine/EngineExploit.java
+++ b/src/com/massivecraft/factions/engine/EngineExploit.java
@@ -1,6 +1,7 @@
package com.massivecraft.factions.engine;
import com.massivecraft.factions.entity.MConf;
+import com.massivecraft.factions.util.EnumerationUtil;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.collections.MassiveList;
import com.massivecraft.massivecore.ps.PS;
@@ -45,9 +46,9 @@ public void obsidianGenerators(BlockFromToEvent event)
// thanks to ObGenBlocker and WorldGuard for this method
Block block = event.getToBlock();
- int source = event.getBlock().getTypeId();
- int target = block.getTypeId();
- if ((target == 55 || target == 132) && (source == 0 || source == 10 || source == 11))
+ Material source = event.getBlock().getType();
+ Material target = block.getType();
+ if ((target == Material.REDSTONE_WIRE || target == Material.TRIPWIRE) && (source == Material.AIR || source == Material.CAVE_AIR || source == Material.VOID_AIR || source == Material.LAVA))
{
block.setType(Material.AIR);
}
@@ -70,8 +71,8 @@ public void enderPearlClipping(PlayerTeleportEvent event)
// blocks who occupy less than 1 block width or length wise need to be handled differently
Material mat = event.getTo().getBlock().getType();
if (
- ((mat == Material.THIN_GLASS || mat == Material.IRON_FENCE) && clippingThrough(target, from, 0.65))
- || ((mat == Material.FENCE || mat == Material.NETHER_FENCE) && clippingThrough(target, from, 0.45))
+ ((EnumerationUtil.isMaterialGlassPane(mat) || mat == Material.IRON_BARS) && clippingThrough(target, from, 0.65))
+ || (EnumerationUtil.isMaterialFence(mat) && clippingThrough(target, from, 0.45))
)
{
event.setTo(from);
@@ -123,9 +124,18 @@ public void tntWaterlog(EntityExplodeEvent event)
targets.add(center.getRelative(-1, 0, 0));
for (Block target : targets)
{
- int id = target.getTypeId();
+ Material type = target.getType();
// ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet
- if (id != 0 && (id < 7 || id > 11) && id != 49 && id != 90 && id != 116 && id != 119 && id != 120 && id != 130)
+ if (type != Material.AIR && type != Material.CAVE_AIR && type != Material.VOID_AIR
+ && type != Material.BEDROCK
+ && type != Material.WATER
+ && type != Material.LAVA
+ && type != Material.OBSIDIAN
+ && type != Material.NETHER_PORTAL
+ && type != Material.ENCHANTING_TABLE
+ && type != Material.END_PORTAL
+ && type != Material.END_PORTAL_FRAME
+ && type != Material.ENDER_CHEST)
{
target.breakNaturally();
}
@@ -240,7 +250,7 @@ public static List getPortal(Block from)
{
for (int z = -(NETHER_TRAP_RADIUS_CHECK); z <= NETHER_TRAP_RADIUS_CHECK; z ++)
{
- if (from.getRelative(x, y, z).getType() == Material.PORTAL) ret.add(from.getRelative(x, y, z));
+ if (from.getRelative(x, y, z).getType() == Material.NETHER_PORTAL) ret.add(from.getRelative(x, y, z));
}
}
}
diff --git a/src/com/massivecraft/factions/entity/MConf.java b/src/com/massivecraft/factions/entity/MConf.java
index 91fe20aa7..d62c33d05 100644
--- a/src/com/massivecraft/factions/entity/MConf.java
+++ b/src/com/massivecraft/factions/entity/MConf.java
@@ -542,6 +542,12 @@ public MConf load(MConf that)
// Interacting with these materials placed in the terrain results in door toggling.
public BackstringSet materialsDoor = new BackstringSet<>(Material.class);
+
+ // Interacting with these materials placed in the terrain results in IDK.
+ public BackstringSet materialsGlassPane = new BackstringSet<>(Material.class);
+
+ // Interacting with these materials placed in the terrain results in IDK.
+ public BackstringSet materialsFence = new BackstringSet<>(Material.class);
// Interacting with these materials placed in the terrain results in opening a container.
public BackstringSet materialsContainer = new BackstringSet<>(Material.class);
diff --git a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java
index 603f4e280..ac5df90a7 100644
--- a/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java
+++ b/src/com/massivecraft/factions/integration/worldguard/EngineWorldGuard.java
@@ -6,9 +6,10 @@
import com.massivecraft.factions.event.EventFactionsChunksChange;
import com.massivecraft.massivecore.Engine;
import com.massivecraft.massivecore.ps.PS;
-import com.sk89q.worldedit.BlockVector;
+import com.sk89q.worldedit.bukkit.BukkitAdapter;
+import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldguard.LocalPlayer;
-import com.sk89q.worldguard.bukkit.WGBukkit;
+import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
import com.sk89q.worldguard.protection.managers.RegionManager;
import com.sk89q.worldguard.protection.regions.GlobalProtectedRegion;
@@ -46,7 +47,7 @@ public void setActiveInner(boolean active)
{
if (active)
{
- this.worldGuard = WGBukkit.getPlugin();
+ this.worldGuard = WorldGuardPlugin.inst();
}
else
{
@@ -119,11 +120,11 @@ public List getProtectedRegionsFor(PS ps)
int worldHeight = ps.asBukkitWorld().getMaxHeight();
- BlockVector minChunk = new BlockVector(minChunkX, 0, minChunkZ);
- BlockVector maxChunk = new BlockVector(maxChunkX, worldHeight, maxChunkZ);
-
- RegionManager regionManager = this.worldGuard.getRegionManager(ps.asBukkitWorld());
+ BlockVector3 minChunk = BlockVector3.at(minChunkX, 0, minChunkZ);
+ BlockVector3 maxChunk = BlockVector3.at(maxChunkX, worldHeight, maxChunkZ);
+ RegionManager regionManager = WorldGuard.getInstance().getPlatform().getRegionContainer().get(BukkitAdapter.adapt(ps.asBukkitWorld()));
+
String regionName = "factions_temp";
ProtectedCuboidRegion region = new ProtectedCuboidRegion(regionName, minChunk, maxChunk);
diff --git a/src/com/massivecraft/factions/util/EnumerationUtil.java b/src/com/massivecraft/factions/util/EnumerationUtil.java
index e7d617742..a3b29206a 100644
--- a/src/com/massivecraft/factions/util/EnumerationUtil.java
+++ b/src/com/massivecraft/factions/util/EnumerationUtil.java
@@ -81,6 +81,62 @@ public static boolean isMaterialDoor(Material material)
{
return MATERIALS_DOOR.contains(material) || MConf.get().materialsDoor.contains(material);
}
+
+ // -------------------------------------------- //
+ // MATERIAL GLASS_PANE
+ // -------------------------------------------- //
+
+ // Interacting with these materials placed in the terrain results in door toggling.
+ public static final BackstringSet MATERIALS_GLASS_PANE = new BackstringSet<>(Material.class,
+ Material.GLASS_PANE,
+ Material.BLACK_STAINED_GLASS_PANE,
+ Material.BLUE_STAINED_GLASS_PANE,
+ Material.BROWN_STAINED_GLASS_PANE,
+ Material.CYAN_STAINED_GLASS_PANE,
+ Material.GRAY_STAINED_GLASS_PANE,
+ Material.GREEN_STAINED_GLASS_PANE,
+ Material.LIGHT_BLUE_STAINED_GLASS_PANE,
+ Material.LIGHT_GRAY_STAINED_GLASS_PANE,
+ Material.LIME_STAINED_GLASS_PANE,
+ Material.MAGENTA_STAINED_GLASS_PANE,
+ Material.ORANGE_STAINED_GLASS_PANE,
+ Material.PINK_STAINED_GLASS_PANE,
+ Material.PURPLE_STAINED_GLASS_PANE,
+ Material.RED_STAINED_GLASS_PANE,
+ Material.WHITE_STAINED_GLASS_PANE
+ );
+
+ public static boolean isMaterialGlassPane(Material material)
+ {
+ return MATERIALS_GLASS_PANE.contains(material) || MConf.get().materialsGlassPane.contains(material);
+ }
+
+ // -------------------------------------------- //
+ // MATERIAL FENCE
+ // -------------------------------------------- //
+
+ // Interacting with these materials placed in the terrain results in door toggling.
+ public static final BackstringSet MATERIALS_FENCE = new BackstringSet<>(Material.class,
+ Material.NETHER_BRICK_FENCE,
+ Material.ACACIA_FENCE,
+ Material.BIRCH_FENCE,
+ Material.DARK_OAK_FENCE,
+ Material.JUNGLE_FENCE,
+ Material.OAK_FENCE,
+ Material.SPRUCE_FENCE,
+ Material.COBBLESTONE_WALL,
+ Material.MOSSY_COBBLESTONE_WALL,
+ Material.ACACIA_FENCE_GATE,
+ Material.BIRCH_FENCE_GATE,
+ Material.DARK_OAK_FENCE_GATE,
+ Material.JUNGLE_FENCE_GATE,
+ Material.OAK_FENCE_GATE
+ );
+
+ public static boolean isMaterialFence(Material material)
+ {
+ return MATERIALS_FENCE.contains(material) || MConf.get().materialsFence.contains(material);
+ }
// -------------------------------------------- //
// MATERIAL CONTAINER
diff --git a/src/com/massivecraft/factions/util/VisualizeUtil.java b/src/com/massivecraft/factions/util/VisualizeUtil.java
index 1f998a2dc..0f3af7356 100644
--- a/src/com/massivecraft/factions/util/VisualizeUtil.java
+++ b/src/com/massivecraft/factions/util/VisualizeUtil.java
@@ -1,6 +1,7 @@
package com.massivecraft.factions.util;
import org.bukkit.Location;
+import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
@@ -39,17 +40,17 @@ public static Set getPlayerLocations(UUID uuid)
// -------------------------------------------- //
@SuppressWarnings("deprecation")
- public static void addLocation(Player player, Location location, int typeId, byte data)
+ public static void addLocation(Player player, Location location, Material type, byte data)
{
getPlayerLocations(player).add(location);
- player.sendBlockChange(location, typeId, data);
+ player.sendBlockChange(location, type, data);
}
@SuppressWarnings("deprecation")
- public static void addLocation(Player player, Location location, int typeId)
+ public static void addLocation(Player player, Location location, Material type)
{
getPlayerLocations(player).add(location);
- player.sendBlockChange(location, typeId, (byte) 0);
+ player.sendBlockChange(location, type, (byte) 0);
}
// -------------------------------------------- //
@@ -57,10 +58,10 @@ public static void addLocation(Player player, Location location, int typeId)
// -------------------------------------------- //
@SuppressWarnings("deprecation")
- public static void addLocations(Player player, Map locationMaterialIds)
+ public static void addLocations(Player player, Map locationMaterials)
{
Set ploc = getPlayerLocations(player);
- for (Entry entry : locationMaterialIds.entrySet())
+ for (Entry entry : locationMaterials.entrySet())
{
ploc.add(entry.getKey());
player.sendBlockChange(entry.getKey(), entry.getValue(), (byte) 0);
@@ -68,25 +69,25 @@ public static void addLocations(Player player, Map locationMa
}
@SuppressWarnings("deprecation")
- public static void addLocations(Player player, Collection locations, int typeId)
+ public static void addLocations(Player player, Collection locations, Material type)
{
Set ploc = getPlayerLocations(player);
for (Location location : locations)
{
ploc.add(location);
- player.sendBlockChange(location, typeId, (byte) 0);
+ player.sendBlockChange(location, type, (byte) 0);
}
}
@SuppressWarnings("deprecation")
- public static void addBlocks(Player player, Collection blocks, int typeId)
+ public static void addBlocks(Player player, Collection blocks, Material type)
{
Set ploc = getPlayerLocations(player);
for (Block block : blocks)
{
Location location = block.getLocation();
ploc.add(location);
- player.sendBlockChange(location, typeId, (byte) 0);
+ player.sendBlockChange(location, type, (byte) 0);
}
}
@@ -102,7 +103,7 @@ public static void clear(Player player)
for (Location location : locations)
{
Block block = location.getWorld().getBlockAt(location);
- player.sendBlockChange(location, block.getTypeId(), block.getData());
+ player.sendBlockChange(location, block.getType(), block.getData());
}
locations.clear();
}