124 lines
4.8 KiB
Java
124 lines
4.8 KiB
Java
package com.zerohighdef.geoffrey;
|
|
|
|
import com.zerohighdef.geoffrey.Commands.*;
|
|
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 baseAPIURL;
|
|
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");
|
|
baseAPIURL = config.getString("geoffrey_api.api_base_url");
|
|
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);
|
|
|
|
EditPosCommand editPosCommand = new EditPosCommand(this);
|
|
this.getCommand("geoffrey_edit_pos").setExecutor(editPosCommand);
|
|
|
|
AddTunnelCommand editTunnelCommand = new AddTunnelCommand(this);
|
|
this.getCommand("geoffrey_edit_tunnel").setExecutor(editTunnelCommand);
|
|
|
|
FindAroundCommand findAroundCommand = new FindAroundCommand(this);
|
|
this.getCommand("geoffrey_find_around").setExecutor(findAroundCommand);
|
|
|
|
FindFarmCommand findFarmCommand = new FindFarmCommand(this);
|
|
this.getCommand("geoffrey_find_farm").setExecutor(findFarmCommand);
|
|
|
|
InfoCommand infoCommand = new InfoCommand(this);
|
|
this.getCommand("geoffrey_info").setExecutor(infoCommand);
|
|
|
|
LocationsCommand locationsCommand = new LocationsCommand(this);
|
|
this.getCommand("geoffrey_locations").setExecutor(locationsCommand);
|
|
|
|
RemoveResidentCommand removeResidentCommand = new RemoveResidentCommand(this);
|
|
this.getCommand("geoffrey_remove_resident").setExecutor(removeResidentCommand);
|
|
}
|
|
|
|
}
|
|
|
|
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 getBaseAPIURL() {
|
|
return baseAPIURL;
|
|
}
|
|
|
|
public String getBaseURL() {
|
|
return baseURL;
|
|
}
|
|
}
|