SHARE
TWEET

How do you replace it? to 1.15.x

a guest Feb 21st, 2020 116 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. try {
  2.         int id = Integer.parseInt(arr[0]);
  3.         return new MaterialData(Material.getMaterial(id), data);
  4.       } catch (Exception exception) {
  5. me da error en esta line
  6. return new MaterialData(Material.getMaterial(id));
  7.  
  8.  
  9.  
  10. =======================================================
  11. code complete
  12. =======================================================
  13.  public MaterialData deserialize(String name) {
  14.     if (name.contains(":")) {
  15.       byte data; String[] arr = name.split(":");
  16.  
  17.      
  18.       try {
  19.         data = Byte.parseByte(arr[1]);
  20.       } catch (Exception e) {
  21.         throw new IllegalArgumentException("Data (" + arr[1] + ") must be a number", e);
  22.       }
  23.      
  24.       try {
  25.         int id = Integer.parseInt(arr[0]);
  26.         return new MaterialData(Material.getMaterial(id), data);
  27.       } catch (Exception exception) {
  28.  
  29.        
  30.         try {
  31.          
  32.           Material mat = Material.valueOf(arr[0].toUpperCase());
  33.           return new MaterialData(mat, data);
  34.         } catch (Exception e) {
  35.           throw new IllegalArgumentException("Unknown material name - " + arr[0], e);
  36.         }
  37.       }
  38.     }  try {
  39.       int id = Integer.parseInt(name);
  40.       return new MaterialData(Material.getMaterial(id));
  41.     } catch (Exception exception) {
  42.  
  43.      
  44.       try {
  45.        
  46.         Material mat = Material.valueOf(name.toUpperCase());
  47.         return new MaterialData(mat);
  48.       } catch (Exception e) {
  49.         throw new IllegalArgumentException("Unknown material name - " + name, e);
  50.       }
  51.     }
  52.   }
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top