2011-02-19 09:22:28 +00:00
|
|
|
// $Id$
|
|
|
|
/*
|
|
|
|
* WorldEdit
|
2012-01-05 21:38:23 +00:00
|
|
|
* Copyright (C) 2010, 2011 sk89q <http://www.sk89q.com> and contributors
|
2011-02-19 09:22:28 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package com.sk89q.worldedit.commands;
|
|
|
|
|
2011-03-14 03:36:28 +00:00
|
|
|
import java.text.DateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.TimeZone;
|
2011-02-19 09:22:28 +00:00
|
|
|
import com.sk89q.minecraft.util.commands.Command;
|
|
|
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
|
|
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
2011-12-15 12:28:25 +00:00
|
|
|
import com.sk89q.minecraft.util.commands.Console;
|
2011-02-19 09:22:28 +00:00
|
|
|
import com.sk89q.worldedit.EditSession;
|
|
|
|
import com.sk89q.worldedit.LocalPlayer;
|
|
|
|
import com.sk89q.worldedit.LocalSession;
|
|
|
|
import com.sk89q.worldedit.WorldEdit;
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
|
|
|
|
|
|
|
public class WorldEditCommands {
|
2011-12-18 07:45:12 +00:00
|
|
|
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;
|
|
|
|
}
|
2011-11-23 01:29:48 +00:00
|
|
|
|
2011-02-19 09:22:28 +00:00
|
|
|
@Command(
|
2011-09-19 05:14:43 +00:00
|
|
|
aliases = { "version", "ver" },
|
2011-02-19 09:22:28 +00:00
|
|
|
usage = "",
|
|
|
|
desc = "Get WorldEdit version",
|
|
|
|
min = 0,
|
|
|
|
max = 0
|
|
|
|
)
|
2011-12-15 12:28:25 +00:00
|
|
|
@Console
|
2011-12-18 07:45:12 +00:00
|
|
|
public void version(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
2011-02-19 09:22:28 +00:00
|
|
|
|
|
|
|
player.print("WorldEdit version " + WorldEdit.getVersion());
|
|
|
|
player.print("http://www.sk89q.com/projects/worldedit/");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Command(
|
2011-09-19 05:14:43 +00:00
|
|
|
aliases = { "reload" },
|
2011-02-19 09:22:28 +00:00
|
|
|
usage = "",
|
|
|
|
desc = "Reload WorldEdit",
|
|
|
|
min = 0,
|
|
|
|
max = 0
|
|
|
|
)
|
2011-09-19 05:14:43 +00:00
|
|
|
@CommandPermissions("worldedit.reload")
|
2011-12-15 12:28:25 +00:00
|
|
|
@Console
|
2011-12-18 07:45:12 +00:00
|
|
|
public void reload(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
2011-02-19 09:22:28 +00:00
|
|
|
|
|
|
|
we.getServer().reload();
|
|
|
|
player.print("Configuration reloaded!");
|
|
|
|
}
|
2011-03-12 06:43:02 +00:00
|
|
|
|
|
|
|
@Command(
|
2011-09-19 05:14:43 +00:00
|
|
|
aliases = { "cui" },
|
2011-03-12 06:43:02 +00:00
|
|
|
usage = "",
|
|
|
|
desc = "Complete CUI handshake",
|
|
|
|
min = 0,
|
2012-01-01 04:16:39 +00:00
|
|
|
max = 0
|
2011-03-12 06:43:02 +00:00
|
|
|
)
|
2011-12-18 07:45:12 +00:00
|
|
|
public void cui(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
2011-03-12 06:43:02 +00:00
|
|
|
session.setCUISupport(true);
|
|
|
|
session.dispatchCUISetup(player);
|
|
|
|
}
|
2011-03-14 03:36:28 +00:00
|
|
|
|
|
|
|
@Command(
|
2011-09-19 05:14:43 +00:00
|
|
|
aliases = { "tz" },
|
2011-03-14 03:36:28 +00:00
|
|
|
usage = "[timezone]",
|
|
|
|
desc = "Set your timezone",
|
|
|
|
min = 1,
|
|
|
|
max = 1
|
|
|
|
)
|
2011-12-15 12:28:25 +00:00
|
|
|
@Console
|
2011-12-18 07:45:12 +00:00
|
|
|
public void tz(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
2011-03-14 03:36:28 +00:00
|
|
|
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()));
|
|
|
|
}
|
2011-12-15 12:28:25 +00:00
|
|
|
|
|
|
|
@Command(
|
|
|
|
aliases = { "help" },
|
|
|
|
usage = "[<command>]",
|
|
|
|
desc = "Displays help for the given command or lists all commands.",
|
|
|
|
min = 0,
|
|
|
|
max = -1
|
|
|
|
)
|
2012-12-22 21:52:40 +00:00
|
|
|
@CommandPermissions("worldedit.help")
|
2011-12-15 12:28:25 +00:00
|
|
|
@Console
|
2011-12-22 10:35:43 +00:00
|
|
|
public void help(CommandContext args, LocalSession session, LocalPlayer player,
|
|
|
|
EditSession editSession) throws WorldEditException {
|
2011-12-15 12:28:25 +00:00
|
|
|
|
|
|
|
UtilityCommands.help(args, we, session, player, editSession);
|
|
|
|
}
|
2011-02-19 09:22:28 +00:00
|
|
|
}
|