mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-26 18:54:43 +02:00
Added DebugPaste command, to upload settings.yml and latest.log
This commit is contained in:
@ -55,6 +55,7 @@ public enum Command {
|
||||
ALLOWUNSAFE("debugallowunsafe"),
|
||||
DEBUGLOADTEST("debugloadtest"),
|
||||
DEBUGSAVETEST("debugsavetest"),
|
||||
DEBUG_PASTE("debugpaste", "dp"),
|
||||
UNCLAIM("unclaim"),
|
||||
DEBUGCLEAR("debugclear", "fastclear"),
|
||||
SWAP("swap"),
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user