Пример #1
0
 public static ItemStack addGlow(ItemStack item) {
   switch (Version.getVersion()) {
     case TOO_NEW:
       Bukkit.getLogger()
           .log(
               Level.SEVERE,
               "[Crazy Crates]>> Your server is too new for this plugin. "
                   + "Please update or remove this plugin to stop further Errors.");
       break;
     case v1_10_R1:
       return NMS_v1_10_R1.addGlow(item);
     case v1_9_R2:
       return NMS_v1_9_R2.addGlow(item);
     case v1_9_R1:
       return NMS_v1_9_R1.addGlow(item);
     case v1_8_R3:
       return NMS_v1_8_R3.addGlow(item);
     case v1_8_R2:
       return NMS_v1_8_R2.addGlow(item);
     case v1_8_R1:
       return NMS_v1_8_R1.addGlow(item);
     case TOO_OLD:
       Bukkit.getLogger()
           .log(
               Level.SEVERE,
               "[Crazy Crates]>> Your server is too far out of date. "
                   + "Please update or remove this plugin to stop further Errors.");
       break;
   }
   return item;
 }
Пример #2
0
 @SuppressWarnings("deprecation")
 public static void setItemInHand(Player player, ItemStack item) {
   if (Version.getVersion().getVersionInteger() >= Version.v1_9_R1.getVersionInteger()) {
     player.getInventory().setItemInMainHand(item);
   } else {
     player.setItemInHand(item);
   }
 }
Пример #3
0
 @SuppressWarnings("deprecation")
 public static ItemStack getItemInHand(Player player) {
   if (Version.getVersion().getVersionInteger() >= Version.v1_9_R1.getVersionInteger()) {
     return player.getInventory().getItemInMainHand();
   } else {
     return player.getItemInHand();
   }
 }
Пример #4
0
 public static void playChestAction(Block b, boolean open) {
   Location location = b.getLocation();
   Material type = b.getType();
   if (type == Material.CHEST || type == Material.TRAPPED_CHEST || type == Material.ENDER_CHEST) {
     switch (Version.getVersion()) {
       case TOO_NEW:
         Bukkit.getLogger()
             .log(
                 Level.SEVERE,
                 "[Crazy Crates]>> Your server is too new for this plugin. "
                     + "Please update or remove this plugin to stop further Errors.");
         break;
       case v1_10_R1:
         NMS_v1_10_R1.openChest(b, location, open);
         break;
       case v1_9_R2:
         NMS_v1_9_R2.openChest(b, location, open);
         break;
       case v1_9_R1:
         NMS_v1_9_R1.openChest(b, location, open);
         break;
       case v1_8_R3:
         NMS_v1_8_R3.openChest(b, location, open);
         break;
       case v1_8_R2:
         NMS_v1_8_R2.openChest(b, location, open);
         break;
       case v1_8_R1:
         NMS_v1_8_R1.openChest(b, location, open);
         break;
       case TOO_OLD:
         Bukkit.getLogger()
             .log(
                 Level.SEVERE,
                 "[Crazy Crates]>> Your server is too far out of date. "
                     + "Please update or remove this plugin to stop further Errors.");
         break;
     }
   }
 }
Пример #5
0
 public static List<Location> getLocations(String shem, Location loc) {
   switch (Version.getVersion()) {
     case TOO_NEW:
       Bukkit.getLogger()
           .log(
               Level.SEVERE,
               "[Crazy Crates]>> Your server is too new for this plugin. "
                   + "Please update or remove this plugin to stop further Errors.");
       break;
     case v1_10_R1:
       return NMS_v1_10_R1.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case v1_9_R2:
       return NMS_v1_9_R2.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case v1_9_R1:
       return NMS_v1_9_R1.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case v1_8_R3:
       return NMS_v1_8_R3.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case v1_8_R2:
       return NMS_v1_8_R2.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case v1_8_R1:
       return NMS_v1_8_R1.getLocations(
           new File(plugin.getDataFolder() + "/Schematics/" + shem), loc);
     case TOO_OLD:
       Bukkit.getLogger()
           .log(
               Level.SEVERE,
               "[Crazy Crates]>> Your server is too far out of date. "
                   + "Please update or remove this plugin to stop further Errors.");
       break;
   }
   return null;
 }