Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
at develop 1.9 kB view raw
1package com.projectposeidon.johnymuffin; 2 3public class ConnectionPause { 4 private String pluginName; 5 private String connectionPauseName; 6 private LoginProcessHandler loginProcessHandler; 7 private long creationTime; 8 9 private long completionTime; 10 private boolean active; 11 12 public ConnectionPause(String PluginName, String connectionPauseName, LoginProcessHandler loginProcessHandler) { 13 this.pluginName = PluginName; 14 this.connectionPauseName = connectionPauseName; 15 this.loginProcessHandler = loginProcessHandler; 16 this.creationTime = System.currentTimeMillis(); 17 this.active = true; 18 } 19 20 /** 21 * This method is still undecided, please don't use it in production. 22 */ 23 public void removeConnectionPause() { 24 loginProcessHandler.removeConnectionPause(this); 25 } 26 27 public String getPluginName() { 28 return this.pluginName; 29 } 30 31 public String getConnectionPauseName() { 32 return this.connectionPauseName; 33 } 34 35 36 public long getCreationTime() { 37 return creationTime; 38 } 39 40 public boolean isActive() { 41 return active; 42 } 43 44 /** 45 * This method is for Poseidon, not plugin use. DON'T TOUCH THIS IF YOU DON'T KNOW WHAT YOU ARE DOING. 46 */ 47 public void setActive(boolean active) { 48 if (!active) this.completionTime = System.currentTimeMillis(); 49 this.active = active; 50 } 51 52 public int getRunningTime() { 53 int running; 54 if (active) { 55 running = (int) (System.currentTimeMillis() - creationTime); 56 } else { 57 running = (int) (completionTime - creationTime); 58 } 59 running = running / 1000; 60 return running; 61 } 62 63 64 public LoginProcessHandler getLoginProcessHandler() { 65 return loginProcessHandler; 66 } 67 68 public long getCompletionTime() { 69 return completionTime; 70 } 71}