ソースを参照

removed auto updater

mastercake10 7 年 前
コミット
56244be1bc

+ 0 - 1
TimeIsMoney2/src/config.yml

@@ -1,6 +1,5 @@
 configuration-version: 12
 
-auto-update: true
 debug-log: false
 
 # You can disable the plugin's payout feature in certain worlds

+ 3 - 31
TimeIsMoney2/src/de/Linus122/TimeIsMoney/Main.java

@@ -37,7 +37,6 @@ import org.bukkit.plugin.java.JavaPlugin;
 
 import modules.atm.ATM;
 import net.milkbowl.vault.economy.Economy;
-import webapi.VersionChecker;
 
 public class Main extends JavaPlugin{
 	
@@ -145,37 +144,10 @@ public class Main extends JavaPlugin{
 		}
 		
 		loadPayouts();
-		if(this.getConfig().getBoolean("auto-update")){
-
-			Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, new Runnable(){
-				public void run(){
-					if(Main.PL_VERSION < VersionChecker.getVersion()){
-						clogger.sendMessage("[TimeIsMoney] §cYou are using an old version, I will update this plugin for you.");
-						//Update
-						URL loc = Bukkit.getPluginManager().getPlugin("TimeIsMoney").getClass().getProtectionDomain().getCodeSource().getLocation();
-						Bukkit.getUpdateFolderFile().mkdir();
-						File file = new File(Bukkit.getUpdateFolderFile().getPath() + "/" + loc.getFile().split("/")[loc.getFile().split("/").length - 1]);
-						
-						try {
-							VersionChecker.download(file);
-						} catch (IOException e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-						clogger.sendMessage("[TimeIsMoney] §aSuccess! Downloaded v" + VersionChecker.getVersion());
-						try {
-							reloadPlugin("TimeIsMoney");
-						} catch (Exception e) {
-							// TODO Auto-generated catch block
-							e.printStackTrace();
-						}
-					}
-				}
-			},0L, 20L * 60 * 20);
-		}
 		
 		
-		 String packageName = this.getServer().getClass().getPackage().getName();
+		
+		String packageName = this.getServer().getClass().getPackage().getName();
         // Get full package string of CraftServer.
         // org.bukkit.craftbukkit.version
         String Bukkitversion = packageName.substring(packageName.lastIndexOf('.') + 1);
@@ -197,7 +169,7 @@ public class Main extends JavaPlugin{
 		if(Bukkit.getPluginManager().isPluginEnabled("Essentials")){
 			clogger.sendMessage("Time is Money: Essentials found. Hook in it -> Will use Essentials's AFK feature if afk is enabled.");
 		}
-		clogger.sendMessage("§aTime is Money §2v" + PL_VERSION + " started.");
+		clogger.sendMessage("§aTime is Money §2v" + PL_VERSION + " §astarted.");
 	}
 	@Override
 	public void onDisable(){

+ 1 - 1
TimeIsMoney2/src/plugin.yml

@@ -3,7 +3,7 @@ depends: [Vault]
 soft-depends: [Essentials]
 author: Linus122
 main: de.Linus122.TimeIsMoney.Main
-version: 1948
+version: 1949
 description: Gives money for online time
 commands:
    timeismoney:

+ 0 - 76
TimeIsMoney2/src/webapi/VersionChecker.java

@@ -1,76 +0,0 @@
-package webapi;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
-
-import de.Linus122.TimeIsMoney.Main;
-
-public class VersionChecker {
-	public static String url_check_version = "http://avendria.de/tim/checkversion.php?version=";
-	public static String url_download = "http://avendria.de/tim/download.php";
-
-	public static int getVersion() {
-
-		try {
-			URLConnection con = new URL(url_check_version + Main.PL_VERSION).openConnection();
-			con.setRequestProperty("User-Agent",
-					"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
-
-			return Integer.parseInt(get_content(con));
-
-		} catch (IOException e) {
-			return 0;
-		}
-
-	}
-
-	public static void download(File location) throws IOException {
-		URLConnection con = new URL(url_download).openConnection();
-		con.setRequestProperty("User-Agent",
-				"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.95 Safari/537.11");
-		InputStream in = con.getInputStream();
-		FileOutputStream fos = new FileOutputStream(location);
-		byte[] buf = new byte[512];
-		while (true) {
-			int len = in.read(buf);
-			if (len == -1) {
-				break;
-			}
-			fos.write(buf, 0, len);
-		}
-		in.close();
-		fos.flush();
-		fos.close();
-	}
-
-	public static String get_content(URLConnection con) {
-		String content = "";
-		if (con != null) {
-
-			try {
-
-				BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
-
-				String input;
-				while ((input = br.readLine()) != null) {
-					content += input;
-				}
-				br.close();
-
-			} catch (IOException e) {
-				
-			}
-
-		}
-		if(content.length() == 0){
-			return "0";
-		}
-		return content;
-	}
-}