コード例 #1
0
 public Package getMinecraftPackage() {
   try {
     if (this.minecraft == null) {
       return Package.getPackage(
           "net.minecraft.server."
               + Bukkit.getServer()
                   .getClass()
                   .getPackage()
                   .getName()
                   .replace(".", ",")
                   .split(",")[3]);
     } else {
       return this.minecraft;
     }
   } catch (Exception ex) {
     this.getServer()
         .getConsoleSender()
         .sendMessage(
             ChatWriter.pluginMessage(
                 ChatColor.RED
                     + Main._l(
                         "errors.packagenotfound",
                         ImmutableMap.of("package", "minecraft server"))));
     return null;
   }
 }
コード例 #2
0
  private boolean getIsSpigot() {
    try {
      Package spigotPackage = Package.getPackage("org.spigotmc");
      if (spigotPackage == null) {
        return false;
      }

      return true;
    } catch (Exception e) {
      // nope
    }

    return false;
  }