Geoffrey-MC-Plugin/src/main/java/com/zerohighdef/geoffrey/GeoffreyMC.java

98 lines
3.7 KiB
Java

package com.zerohighdef.geoffrey;
import com.zerohighdef.geoffrey.Commands.*;
import com.zerohighdef.geoffrey.Models.GeoffreyItemListing;
import com.zerohighdef.geoffrey.Models.GeoffreyLocation;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.logging.Logger;
public final class GeoffreyMC extends JavaPlugin {
private String APIToken;
private String baseURL;
private static FileConfiguration config;
private Logger log = Logger.getLogger( "Minecraft" );
@Override
public void onEnable() {
// Plugin startup logic
saveDefaultConfig();
reloadConfig();
if (isEnabled()) {
APIToken = config.getString("geoffrey_api.key");
baseURL = config.getString("geoffrey_api.base_url");
FindCommand findCommand = new FindCommand(this);
this.getCommand("geoffrey_find").setExecutor(findCommand);
SellingCommand sellingCommand = new SellingCommand(this);
this.getCommand("geoffrey_selling").setExecutor(sellingCommand);
this.getCommand("geoffrey_selling_price").setExecutor(sellingCommand);
AddLocationCommand addLocationCommand = new AddLocationCommand(this);
this.getCommand("geoffrey_add_base").setExecutor(addLocationCommand);
this.getCommand("geoffrey_add_shop").setExecutor(addLocationCommand);
this.getCommand("geoffrey_add_town").setExecutor(addLocationCommand);
this.getCommand("geoffrey_add_farm").setExecutor(addLocationCommand);
this.getCommand("geoffrey_add_attraction").setExecutor(addLocationCommand);
RegisterCommand registerCommand = new RegisterCommand(this);
this.getCommand("geoffrey_register").setExecutor(registerCommand);
AddItemCommand addItemCommand = new AddItemCommand(this);
this.getCommand("geoffrey_add_item").setExecutor(addItemCommand);
AddResidentCommand addResidentCommand = new AddResidentCommand(this);
this.getCommand("geoffrey_add_resident").setExecutor(addResidentCommand);
AddOwnerCommand addOwnerCommand = new AddOwnerCommand(this);
this.getCommand("geoffrey_add_owner").setExecutor(addOwnerCommand);
AddResourceCommand addResourceCommand = new AddResourceCommand(this);
this.getCommand("geoffrey_add_resource").setExecutor(addResourceCommand);
AddTunnelCommand addTunnelCommand = new AddTunnelCommand(this);
this.getCommand("geoffrey_add_tunnel").setExecutor(addTunnelCommand);
DeleteCommand deleteCommand = new DeleteCommand(this);
this.getCommand("geoffrey_delete").setExecutor(deleteCommand);
DeleteItemCommand deleteItemCommand = new DeleteItemCommand(this);
this.getCommand("geoffrey_delete_item").setExecutor(deleteItemCommand);
DeleteResourceCommand deleteResourceCommand = new DeleteResourceCommand(this);
this.getCommand("geoffrey_delete_resource").setExecutor(deleteResourceCommand);
EditNameCommand editNameCommand = new EditNameCommand(this);
this.getCommand("geoffrey_edit_name").setExecutor(editNameCommand);
}
}
public void log(String message) {
log.info( "[GeoffreyMC]: " + message );
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
@Override
public void reloadConfig() {
super.reloadConfig();
config = Bukkit.getPluginManager().getPlugin("GeoffreyMC").getConfig();
}
public String getAPIToken() {
return APIToken;
}
public String getBaseURL() {
return baseURL;
}
}