From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 23 Feb 2019 11:26:21 -0500 Subject: [PATCH] Paper Utils diff --git a/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java new file mode 100644 index 0000000000000000000000000000000000000000..9db0056ab94145819628b3ad8d8d26130d117fcf --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/SneakyThrow.java @@ -0,0 +1,16 @@ +package com.destroystokyo.paper.util; + +import org.jetbrains.annotations.NotNull; + +public class SneakyThrow { + + public static void sneaky(@NotNull Throwable exception) { + SneakyThrow.throwSneaky(exception); + } + + @SuppressWarnings("unchecked") + private static void throwSneaky(@NotNull Throwable exception) throws T { + throw (T) exception; + } + +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java index 2d334dbdd9e2c9a020899097e0620152758dc078..639d275b8318d19afd18996e1daa4e800927a84d 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -5,6 +5,7 @@ import org.bukkit.advancement.Advancement; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeModifier; import org.bukkit.block.Biome; +import org.bukkit.block.BlockType; import org.bukkit.block.data.BlockData; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -47,6 +48,7 @@ public interface UnsafeValues { Material fromLegacy(MaterialData material, boolean itemPriority); Material toMaterial(ItemType itemType); + Material blockTypeToMaterial(BlockType blockType); // Paper BlockData fromLegacy(Material material, byte data);