Example #1
0
 @Override
 public void onPluginEnable(PluginEnableEvent event) {
   if (!this.methods.hasMethod()) {
     if (this.methods.setMethod(event.getPlugin())) {
       Citizens.setMethod(this.methods.getMethod());
       EconomyManager.setServerEconomyEnabled(true);
       Messaging.log(
           "Payment method found ("
               + methods.getMethod().getName()
               + " version: "
               + methods.getMethod().getVersion()
               + ")");
     }
   }
 }
Example #2
0
 // Check the Citizens thread on the Bukkit forums if there is a new version
 // available
 public static void checkForUpdates(Player player) {
   try {
     URI baseURI = new URI("http://forums.bukkit.org/threads/7173/");
     HttpURLConnection con = (HttpURLConnection) baseURI.toURL().openConnection();
     con.setInstanceFollowRedirects(false);
     if (con.getHeaderField("Location") == null) {
       Messaging.log("Couldn't connect to Citizens thread to check for updates.");
       return;
     }
     String url = new URI(con.getHeaderField("Location")).toString();
     if (!url.contains(Citizens.getVersion().replace(".", "-"))) {
       Messaging.send(
           player,
           null,
           ChatColor.YELLOW
               + "**ALERT** "
               + ChatColor.GREEN
               + "There is a new version of Citizens available!");
       return;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }