Init
This commit is contained in:
commit
3e4f244552
6 changed files with 291 additions and 0 deletions
31
src/main/java/net/rubeta/legacyping/LegacyPing.java
Normal file
31
src/main/java/net/rubeta/legacyping/LegacyPing.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
package net.rubeta.legacyping;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class LegacyPing extends JavaPlugin {
|
||||
private ServerThread serverThread;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
this.saveDefaultConfig();
|
||||
final FileConfiguration config = this.getConfig();
|
||||
try {
|
||||
this.serverThread = new ServerThread(this.getServer(), config.getString("host", "0.0.0.0"), config.getInt("port", 25566));
|
||||
this.serverThread.start();
|
||||
} catch (IOException e) {
|
||||
this.getLogger().log(Level.WARNING, "Failed to create ServerSocket", e);
|
||||
this.getPluginLoader().disablePlugin(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
if (this.serverThread != null) {
|
||||
this.serverThread.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue