diff --git a/TwosideKeeper.jar b/TwosideKeeper.jar index d98cfa1..270c19c 100644 Binary files a/TwosideKeeper.jar and b/TwosideKeeper.jar differ diff --git a/src/plugin.yml b/src/plugin.yml index c0068f5..827c5dc 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: TwosideKeeper main: sig.plugin.TwosideKeeper.TwosideKeeper -version: 3.4.7a +version: 3.4.7bbbbb commands: money: description: Tells the player the amount of money they are holding. diff --git a/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java new file mode 100644 index 0000000..67d6cc1 --- /dev/null +++ b/src/sig/plugin/TwosideKeeper/AutoUpdatePlugin.java @@ -0,0 +1,144 @@ +package sig.plugin.TwosideKeeper; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.file.CopyOption; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +public class AutoUpdatePlugin implements Runnable { + List plugins; + boolean restarting=false; + + public AutoUpdatePlugin() { + plugins = new ArrayList(); + } + + @Override + public void run() { + try { + FetchPlugins(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + void FetchPlugins() throws IOException { + for (int i=0;i pluginlist) { + File config = new File(TwosideKeeper.filesave,"hashes.data"); + FileConfiguration workable = YamlConfiguration.loadConfiguration(config); + for (int i=0;i PartyList = new ArrayList(); @@ -262,6 +267,20 @@ public class TwosideKeeper extends JavaPlugin implements Listener { TwosideRecyclingCenter.loadConfig(); log("Recycling Centers Loaded: "+TwosideRecyclingCenter.getNumberOfNodes(),3); + pluginupdater = new AutoUpdatePlugin(); + pluginupdater.AddPlugin("TwosideKeeper", "https://github.com/sigonasr2/TwosideKeeper/raw/master/TwosideKeeper.jar"); + pluginupdater.AddPlugin("aPlugin", "https://dl.dropboxusercontent.com/u/62434995/aPlugin.jar"); + + if (SERVER_TYPE==ServerType.MAIN) { + //Try an update right away. + try { + pluginupdater.FetchPlugins(); + } catch (IOException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + //Create Spleef Games. TwosideSpleefGames = new SpleefManager(this); @@ -294,6 +313,8 @@ public class TwosideKeeper extends JavaPlugin implements Listener { playerdata = new HashMap(); banksessions = new HashMap(); + //tpstracker = new Lag(); + //Let's not assume there are no players online. Load their data. for (int i=0;i=10000) {weather="\u263D";} else {weather="\u2600";}} + return weather; + } + + public String getTimeOfDay() { + long time = Bukkit.getWorld("world").getTime(); + String tod = ""; if (time>0 && time<=3000) { - ev.setMotd("\u00A7bsig's Minecraft!\n"+weather+" \u00A7fCurrently: \u00A7eMORNING"); + tod="\u00A7eMORNING"; } else if (time>3000 && time<=10000) { - ev.setMotd("\u00A7bsig's Minecraft!\n"+weather+" \u00A7fCurrently: \u00A76AFTERNOON"); + tod="\u00A76AFTERNOON"; } else if (time>10000 && time<=13000) { - ev.setMotd("\u00A7bsig's Minecraft!\n"+weather+" \u00A7fCurrently: \u00A73EVENING"); + tod="\u00A73EVENING"; } else if (time>13000 && time<23000) { - ev.setMotd("\u00A7bsig's Minecraft!\n"+weather+" \u00A7fCurrently: \u00A79NIGHT"); + tod="\u00A79NIGHT"; } else { - ev.setMotd("\u00A7bsig's Minecraft!\n"+weather+" \u00A7fCurrently: \u00A7dDAWN"); + tod="\u00A7dDAWN"; } + return tod; + } + + public String getServerListPingString() { + long time = Bukkit.getWorld("world").getTime(); + return "\u00A7bsig's Minecraft!\n"+getWeatherIcon()+" \u00A7fCurrently: "+getTimeOfDay(); + } + + @EventHandler(priority=EventPriority.LOW) + public void onServerListPing(ServerListPingEvent ev) { + ev.setMotd(getServerListPingString()); } public void saveOurData(){