Search in sources :

Example 1 with DebugSubmit

use of net.aufdemrand.denizen.utilities.debugging.DebugSubmit in project Denizen-For-Bukkit by DenizenScript.

the class DenizenCommandHandler method submit.

// <--[language]
// @name denizen permissions
// @group Console Commands
// @description
// The following is a list of all permission nodes Denizen uses within Bukkit.
//
// denizen.basic         # use the basics of the /denizen command
// denizen.notable       # use the /notable command
// denizen.notable.basic # functionality within the /notable command, such as add or list
// denizen.ex            # use the /ex command
// denizen.debug         # use the /denizen debug command
// denizen.submit        # use the /denizen submit command
//
// Additionally:
// denizen.npc.health, denizen.npc.sneak,
// denizen.npc.effect, denizen.npc.fish, denizen.npc.sleep, denizen.npc.stand,
// denizen.npc.sit, denizen.npc.nameplate, denizen.npc.nickname, denizen.npc.trigger,
// denizen.npc.assign, denizen.npc.constants, denizen.npc.pushable
//
// However, we recommend just giving op to whoever needs to access Denizen - they can
// op themselves through Denizen anyway, why not save the trouble?
// ( EG, /ex execute as_server "op <player.name>" )
//
// -->
// <--[language]
// @name /denizen submit command
// @group Console Commands
// @description
// Use the '/denizen submit' command with '/denizen debug -r' to record debug output and post
// it online for assisting developers to see.
//
// To begin recording, simply use '/denizen debug -r'. After that, any debug output sent to the
// console and any player chat will be added to an internal record. Once enabled, you should then
// fire off scripts and events that aren't working fully. Finally, you use the '/denizen submit'
// command to take all the recording information and paste it to an online pastebin hosted by
// the Denizen team. It will give you back a direct link to the full debug output, which you
// can view yourself and send to other helpers without trouble.
//
// There is no limit to the recording size, to prevent any important information from being trimmed
// away. Be careful not to leave debug recording enabled by accident, as it may eventually begin
// using up large amounts of memory. (The submit command will automatically disable recording,
// or you can instead just use '/denizen debug -r' again.)
//
// -->
@Command(aliases = { "denizen" }, usage = "submit", desc = "Submits recorded logs triggered by /denizen debug -r", modifiers = { "submit" }, min = 1, max = 3, permission = "denizen.submit")
public void submit(CommandContext args, final CommandSender sender) throws CommandException {
    if (!dB.record) {
        Messaging.sendError(sender, "Use /denizen debug -r  to record debug information to be submitted");
        return;
    }
    dB.record = false;
    Messaging.send(sender, "Submitting...");
    final DebugSubmit submit = new DebugSubmit();
    submit.recording = dB.Recording.toString();
    dB.Recording = new StringBuilder();
    submit.start();
    BukkitRunnable task = new BukkitRunnable() {

        public void run() {
            if (!submit.isAlive()) {
                if (submit.Result == null) {
                    Messaging.sendError(sender, "Error while submitting.");
                } else {
                    Messaging.send(sender, "Successfully submitted to http://old.mcmonkey.org" + submit.Result);
                }
                this.cancel();
            }
        }
    };
    task.runTaskTimer(DenizenAPI.getCurrentInstance(), 0, 10);
}
Also used : DebugSubmit(net.aufdemrand.denizen.utilities.debugging.DebugSubmit) BukkitRunnable(org.bukkit.scheduler.BukkitRunnable) Command(net.aufdemrand.denizen.utilities.command.Command)

Aggregations

Command (net.aufdemrand.denizen.utilities.command.Command)1 DebugSubmit (net.aufdemrand.denizen.utilities.debugging.DebugSubmit)1 BukkitRunnable (org.bukkit.scheduler.BukkitRunnable)1