Added DebugPaste command, to upload settings.yml and latest.log

This commit is contained in:
Sauilitired
2015-07-18 19:18:15 +02:00
parent ea8f026105
commit 514cb8134a
5 changed files with 96 additions and 64 deletions

View File

@ -55,6 +55,7 @@ public enum Command {
ALLOWUNSAFE("debugallowunsafe"),
DEBUGLOADTEST("debugloadtest"),
DEBUGSAVETEST("debugsavetest"),
DEBUG_PASTE("debugpaste", "dp"),
UNCLAIM("unclaim"),
DEBUGCLEAR("debugclear", "fastclear"),
SWAP("swap"),

View File

@ -0,0 +1,38 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.BukkitMain;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.HastebinUtility;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
import org.bukkit.Bukkit;
import java.io.File;
import java.io.IOException;
public class DebugPaste extends SubCommand {
public DebugPaste() {
super(Command.DEBUG_PASTE, "Upload settings.yml & latest.log to hastebin", "", CommandCategory.DEBUG, false);
}
@Override
public boolean execute(final PlotPlayer plr, String... args) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
try {
String link = HastebinUtility.upload(PS.get().configFile);
MainUtil.sendMessage(plr, C.SETTINGS_PASTE_UPLOADED.s().replace("%url%", link));
link = HastebinUtility.upload(new File(BukkitMain.THIS.getDirectory(), "../../logs/latest.log"));
MainUtil.sendMessage(plr, C.LATEST_LOG_UPLOADED.s().replace("%url%", link));
} catch (IOException e) {
e.printStackTrace();
}
}
});
return true;
}
}