2014-04-03 02:08:50 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
2014-04-03 02:08:50 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
|
|
* for more details.
|
2014-04-03 02:08:50 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2014-04-03 02:08:50 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
package com.sk89q.worldedit.command;
|
|
|
|
|
|
|
|
import com.sk89q.minecraft.util.commands.Command;
|
|
|
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
|
|
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
2014-04-06 06:27:10 +00:00
|
|
|
import com.sk89q.worldedit.*;
|
2014-06-28 00:55:39 +00:00
|
|
|
import com.sk89q.worldedit.extension.platform.Actor;
|
2014-06-27 20:14:55 +00:00
|
|
|
import com.sk89q.worldedit.extension.platform.Capability;
|
2014-04-06 06:27:10 +00:00
|
|
|
import com.sk89q.worldedit.extension.platform.Platform;
|
|
|
|
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
|
|
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.TimeZone;
|
2014-04-03 02:08:50 +00:00
|
|
|
|
|
|
|
public class WorldEditCommands {
|
|
|
|
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
|
|
|
|
|
|
|
private final WorldEdit we;
|
|
|
|
|
|
|
|
public WorldEditCommands(WorldEdit we) {
|
|
|
|
this.we = we;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "version", "ver" },
|
|
|
|
usage = "",
|
|
|
|
desc = "Get WorldEdit version",
|
|
|
|
min = 0,
|
|
|
|
max = 0
|
|
|
|
)
|
2014-06-28 00:55:39 +00:00
|
|
|
public void version(Actor actor) throws WorldEditException {
|
|
|
|
actor.print("WorldEdit version " + WorldEdit.getVersion());
|
|
|
|
actor.print("https://github.com/sk89q/worldedit/");
|
2014-04-06 06:27:10 +00:00
|
|
|
|
|
|
|
PlatformManager pm = we.getPlatformManager();
|
|
|
|
|
2014-06-28 00:55:39 +00:00
|
|
|
actor.printDebug("----------- Platforms -----------");
|
2014-04-06 06:27:10 +00:00
|
|
|
for (Platform platform : pm.getPlatforms()) {
|
2014-06-28 00:55:39 +00:00
|
|
|
actor.printDebug(String.format("* %s (%s)", platform.getPlatformName(), platform.getPlatformVersion()));
|
2014-06-27 20:14:55 +00:00
|
|
|
}
|
|
|
|
|
2014-06-28 00:55:39 +00:00
|
|
|
actor.printDebug("----------- Capabilities -----------");
|
2014-06-27 20:14:55 +00:00
|
|
|
for (Capability capability : Capability.values()) {
|
|
|
|
Platform platform = pm.queryCapability(capability);
|
2014-06-28 00:55:39 +00:00
|
|
|
actor.printDebug(String.format("%s: %s", capability.name(), platform != null ? platform.getPlatformName() : "NONE"));
|
2014-04-06 06:27:10 +00:00
|
|
|
}
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "reload" },
|
|
|
|
usage = "",
|
|
|
|
desc = "Reload WorldEdit",
|
|
|
|
min = 0,
|
|
|
|
max = 0
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.reload")
|
2014-06-28 00:55:39 +00:00
|
|
|
public void reload(Actor actor) throws WorldEditException {
|
2014-04-03 02:08:50 +00:00
|
|
|
we.getServer().reload();
|
2014-06-28 00:55:39 +00:00
|
|
|
actor.print("Configuration reloaded!");
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "cui" },
|
|
|
|
usage = "",
|
|
|
|
desc = "Complete CUI handshake",
|
|
|
|
min = 0,
|
|
|
|
max = 0
|
|
|
|
)
|
|
|
|
public void cui(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
|
|
|
session.setCUISupport(true);
|
|
|
|
session.dispatchCUISetup(player);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "tz" },
|
|
|
|
usage = "[timezone]",
|
|
|
|
desc = "Set your timezone",
|
|
|
|
min = 1,
|
|
|
|
max = 1
|
|
|
|
)
|
|
|
|
public void tz(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
|
|
|
TimeZone tz = TimeZone.getTimeZone(args.getString(0));
|
|
|
|
session.setTimezone(tz);
|
|
|
|
player.print("Timezone set for this session to: " + tz.getDisplayName());
|
|
|
|
player.print("The current time in that timezone is: "
|
|
|
|
+ dateFormat.format(Calendar.getInstance(tz).getTime()));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "help" },
|
|
|
|
usage = "[<command>]",
|
|
|
|
desc = "Displays help for the given command or lists all commands.",
|
|
|
|
min = 0,
|
|
|
|
max = -1
|
|
|
|
)
|
|
|
|
@CommandPermissions("worldedit.help")
|
2014-06-28 00:55:39 +00:00
|
|
|
public void help(Actor actor, CommandContext args) throws WorldEditException {
|
|
|
|
UtilityCommands.help(args, we, actor);
|
2014-04-03 02:08:50 +00:00
|
|
|
}
|
|
|
|
}
|