Updated to 1.13

This commit is contained in:
Mowstyl 2019-04-09 14:18:48 +02:00
parent 40a0951d9a
commit 135f733155
7 changed files with 103 additions and 28 deletions

View File

@ -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}

View File

@ -68,8 +68,8 @@ public class CmdFactionsSeeChunkOld extends FactionsCommand
{
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);
}
}

View File

@ -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 class EngineExploit extends Engine
// 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 class EngineExploit extends Engine
// 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 class EngineExploit extends Engine
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 class EngineExploit extends Engine
{
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));
}
}
}

View File

@ -542,6 +542,12 @@ public class MConf extends Entity<MConf>
// Interacting with these materials placed in the terrain results in door toggling.
public BackstringSet<Material> materialsDoor = new BackstringSet<>(Material.class);
// Interacting with these materials placed in the terrain results in IDK.
public BackstringSet<Material> materialsGlassPane = new BackstringSet<>(Material.class);
// Interacting with these materials placed in the terrain results in IDK.
public BackstringSet<Material> materialsFence = new BackstringSet<>(Material.class);
// Interacting with these materials placed in the terrain results in opening a container.
public BackstringSet<Material> materialsContainer = new BackstringSet<>(Material.class);

View File

@ -6,9 +6,10 @@ import com.massivecraft.factions.entity.MPlayer;
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 class EngineWorldGuard extends Engine
{
if (active)
{
this.worldGuard = WGBukkit.getPlugin();
this.worldGuard = WorldGuardPlugin.inst();
}
else
{
@ -119,11 +120,11 @@ public class EngineWorldGuard extends Engine
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);

View File

@ -81,6 +81,62 @@ public class EnumerationUtil
{
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<Material> 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<Material> 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

View File

@ -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 class VisualizeUtil
// -------------------------------------------- //
@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 class VisualizeUtil
// -------------------------------------------- //
@SuppressWarnings("deprecation")
public static void addLocations(Player player, Map<Location, Integer> locationMaterialIds)
public static void addLocations(Player player, Map<Location, Material> locationMaterials)
{
Set<Location> ploc = getPlayerLocations(player);
for (Entry<Location, Integer> entry : locationMaterialIds.entrySet())
for (Entry<Location, Material> entry : locationMaterials.entrySet())
{
ploc.add(entry.getKey());
player.sendBlockChange(entry.getKey(), entry.getValue(), (byte) 0);
@ -68,25 +69,25 @@ public class VisualizeUtil
}
@SuppressWarnings("deprecation")
public static void addLocations(Player player, Collection<Location> locations, int typeId)
public static void addLocations(Player player, Collection<Location> locations, Material type)
{
Set<Location> 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<Block> blocks, int typeId)
public static void addBlocks(Player player, Collection<Block> blocks, Material type)
{
Set<Location> 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 class VisualizeUtil
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();
}