diff --git a/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacks1_8.java b/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacks1_8.java index be896fc8b0..f5f401b629 100644 --- a/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacks1_8.java +++ b/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacks1_8.java @@ -837,12 +837,12 @@ public boolean canMineBlock(MaterialData blockMaterial, ItemStack tool) { || (nmsTool != null && nmsTool.canDestroySpecialBlock(nmsBlock))); } - Field worldServerField = ReflectionUtils.getField(CraftWorld.class, "world"); - Field dimensionField = ReflectionUtils.getField(WorldServer.class, "dimension"); - Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers"); - @Override public void resetDimension(World world) { + Field worldServerField = ReflectionUtils.getField(CraftWorld.class, "world"); + Field dimensionField = ReflectionUtils.getField(WorldServer.class, "dimension"); + Field modifiersField = ReflectionUtils.getField(Field.class, "modifiers"); + try { modifiersField.setInt(dimensionField, dimensionField.getModifiers() & ~Modifier.FINAL); diff --git a/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacksSportPaper.java b/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacksSportPaper.java index 1221040eee..6cc8d9ffd9 100644 --- a/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacksSportPaper.java +++ b/util/src/main/java/tc/oc/pgm/util/nms/v1_8/NMSHacksSportPaper.java @@ -16,7 +16,9 @@ import org.bukkit.ChunkSnapshot; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.BlockState; +import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack; import org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam; import org.bukkit.entity.EntityType; @@ -185,6 +187,15 @@ public Skin getPlayerSkinForViewer(Player player, Player viewer) { : getPlayerSkin(player); } + @Override + public void resetDimension(World world) { + try { + ((CraftWorld) world).getHandle().dimension = 11; + } catch (IllegalAccessError e) { + super.resetDimension(world); + } + } + @Override public void setCanDestroy(ItemMeta itemMeta, Collection materials) { itemMeta.setCanDestroy(materials);