Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     /**
  2.      * Support for 1.12 item configs in 1.13.
  3.      */
  4.     public static Material getMaterial(String name) {
  5.         Material result = null;
  6.         try {
  7.             result = getMaterial(Integer.parseInt(name));
  8.         } catch (NumberFormatException handled) {
  9.         }
  10.         if(result == null) {
  11.             String filtered = name.toUpperCase().replaceAll("\\s+", "_").replaceAll("\\W", "");
  12.             result = Material.getMaterial(filtered);
  13.             if (result == null) {
  14.                 result = Material.getMaterial("LEGACY_" + filtered);
  15.             }
  16.         }
  17.         return (material == null) ? Material.AIR : result;
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement