WIP
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Commands;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.Command;
|
||||
|
@ -1,55 +0,0 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Custom;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class FileManager {
|
||||
|
||||
|
||||
public List<String> listFiles(String path) {
|
||||
String[] t = new File(path).list();
|
||||
if(t == null) return null;
|
||||
else return Arrays.asList(t);
|
||||
}
|
||||
|
||||
public List<String> listFiles(File path) {
|
||||
String[] t = path.list();
|
||||
if(t == null) return null;
|
||||
else return Arrays.asList(t);
|
||||
}
|
||||
|
||||
public void delete(File path) {
|
||||
path.delete();
|
||||
}
|
||||
|
||||
public void delete(String path) {
|
||||
File file = new File(path);
|
||||
file.delete();
|
||||
}
|
||||
|
||||
public void createFile(String path) {
|
||||
try {
|
||||
new File(path).createNewFile();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void createFile(File path) {
|
||||
try {
|
||||
path.createNewFile();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void createFolder(File path) {
|
||||
path.mkdirs();
|
||||
}
|
||||
|
||||
public void createFolder(String path) {
|
||||
new File(path).mkdirs();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP.Custom;
|
||||
package net.DeltaWings.Minecraft.BetterTP.Libs;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Main;
|
||||
|
@ -1,11 +1,11 @@
|
||||
package net.DeltaWings.Minecraft.BetterTP;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.Commands.*;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Custom.Config;
|
||||
import net.DeltaWings.Minecraft.BetterTP.Libs.Config;
|
||||
|
||||
import net.DeltaWings.Minecraft.BetterTP.TabCompleter.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -13,47 +13,69 @@ import java.util.logging.Level;
|
||||
|
||||
public final class Main extends JavaPlugin {
|
||||
|
||||
public static void log(String Message) {
|
||||
Bukkit.getLogger().log(Level.INFO, Message);
|
||||
}
|
||||
|
||||
private static Main instance;
|
||||
public static Main getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static void log(String message) {
|
||||
getInstance().getLogger().log(Level.INFO, message);
|
||||
}
|
||||
|
||||
public static void debug(String message) {
|
||||
if(new Config("", "config").getBoolean("debug", false)) Main.getInstance().getLogger().info("[Debug] " + message);
|
||||
if(new Config("", "config").getBoolean("debug", true)) getInstance().getLogger().log(Level.INFO, "[Debug] > " + message);
|
||||
}
|
||||
|
||||
public static void error(String message) {
|
||||
getInstance().getLogger().log(Level.WARNING, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
instance = this;
|
||||
getCommand("Spawn").setExecutor(new Spawn());
|
||||
getCommand("Lobby").setExecutor(new Lobby());
|
||||
getCommand("Home").setExecutor(new Home());
|
||||
debug("Loading Variables");
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
PluginCommand bettertp = getCommand("Bettertp");
|
||||
bettertp.setExecutor(new Bettertp());
|
||||
bettertp.setTabCompleter(new BettertpTab());
|
||||
getCommand("Sethome").setExecutor(new Sethome());
|
||||
getCommand("Delhome").setExecutor(new Delhome());
|
||||
getCommand("Homelist").setExecutor(new Homelist());
|
||||
debug("Loaded variables");
|
||||
|
||||
new Metrics(this);
|
||||
debug("Loading Configuration");
|
||||
try {
|
||||
config();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
log("Shutting Down for security...");
|
||||
error("Error Config not generated");
|
||||
error("Shutting Down for security...");
|
||||
this.getPluginLoader().disablePlugin(this);
|
||||
}
|
||||
debug("Loaded Configuration !");
|
||||
|
||||
log("Plugin Loaded !");
|
||||
debug("Loading Events");
|
||||
//pm.registerEvents(new Event(), this);
|
||||
debug("Loaded Events");
|
||||
|
||||
debug("Loading Commands");
|
||||
//getCommand("Command").setExecutor(new Command());
|
||||
bettertp.setExecutor(new Bettertp());
|
||||
bettertp.setTabCompleter(new BettertpTab());
|
||||
getCommand("Spawn").setExecutor(new Spawn());
|
||||
getCommand("Lobby").setExecutor(new Lobby());
|
||||
getCommand("Home").setExecutor(new Home());
|
||||
getCommand("Sethome").setExecutor(new Sethome());
|
||||
getCommand("Delhome").setExecutor(new Delhome());
|
||||
getCommand("Homelist").setExecutor(new Homelist());
|
||||
|
||||
debug("Loaded Commands");
|
||||
|
||||
debug("Enabling Metrics");
|
||||
//new Metrics(this);
|
||||
log("Metrics Started : https://bstats.org/plugin/bukkit/plugin/");
|
||||
|
||||
log("Loaded !");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
log("Plugin Unloaded !");
|
||||
log("Unloaded !");
|
||||
}
|
||||
|
||||
private void config() throws IOException {
|
||||
|
Reference in New Issue
Block a user