forked from Geoffrey/Geoffrey-MC-Plugin
42 lines
1.1 KiB
Java
42 lines
1.1 KiB
Java
package com.zerohighdef.geoffrey.Commands;
|
|
|
|
import com.zerohighdef.geoffrey.GeoffreyMC;
|
|
import org.bukkit.command.Command;
|
|
import org.bukkit.command.CommandExecutor;
|
|
import org.bukkit.command.CommandSender;
|
|
import xyz.etztech.core.web.CoreWeb;
|
|
import xyz.etztech.core.web.ICallback;
|
|
|
|
import java.util.Map;
|
|
|
|
public class GeoffreyCommand implements CommandExecutor {
|
|
private GeoffreyMC plugin;
|
|
|
|
static enum Method {
|
|
GET, POST
|
|
}
|
|
|
|
public GeoffreyCommand(GeoffreyMC plugin) {
|
|
this.plugin = plugin;
|
|
}
|
|
|
|
protected void RunCommand(String commandName, Map<String, String> params, Method requestType, ICallback callback) {
|
|
String url = plugin.getBaseURL() + "/command/" + commandName + "/";
|
|
params.put("api", plugin.getAPIToken());
|
|
|
|
if (requestType == Method.GET) {
|
|
CoreWeb.asyncGetCallback(plugin, url, params, callback);
|
|
}
|
|
else {
|
|
CoreWeb.asyncPostCallback(plugin, url, params, callback);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
return false;
|
|
}
|
|
}
|