Ejemplo n.º 1
0
 public static void savePorts() {
   Collection<JumpPort> jports = ports.values();
   for (JumpPort port : jports) {
     port.save();
     JumpPortsPlugin.log(Lang.get("plugin.saved") + ": " + port.getName());
   }
 }
Ejemplo n.º 2
0
  public void onDisable() {
    db.close();

    lang.saveLang();
    Shops.saveShops();
    log("Plugin disabled. - By TruDan");
  }
Ejemplo n.º 3
0
 public static void loadPorts() {
   File[] files = new File("plugins/JumpPorts/ports").listFiles();
   for (File file : files) {
     String name = file.getName();
     int pos = name.lastIndexOf('.');
     String ext = name.substring(pos + 1);
     if (ext.equalsIgnoreCase("yml")) {
       name = name.replaceAll(".yml", "");
       JumpPort port = new JumpPort(name);
       port.load();
       ports.put(name, port);
       JumpPortsPlugin.log(Lang.get("plugin.loaded") + ": " + name);
     }
   }
 }
Ejemplo n.º 4
0
  @Override
  public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    try {
      this.commands.execute(cmd.getName(), args, sender, sender);
    } catch (CommandPermissionsException e) {
      sender.sendMessage(ChatColor.RED + lang.get("exceptions.noPermission"));
    } catch (MissingNestedCommandException e) {
      sender.sendMessage(ChatColor.RED + e.getUsage());
    } catch (CommandUsageException e) {
      sender.sendMessage(ChatColor.RED + e.getMessage());
      sender.sendMessage(ChatColor.RED + e.getUsage());
    } catch (WrappedCommandException e) {
      if (e.getCause() instanceof NumberFormatException) {
        sender.sendMessage(ChatColor.RED + lang.get("exceptions.numExpected"));
      } else {
        sender.sendMessage(ChatColor.RED + lang.get("exceptions.errorOccurred"));
        e.printStackTrace();
      }
    } catch (CommandException e) {
      sender.sendMessage(ChatColor.RED + e.getMessage());
    }

    return true;
  }