mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Made /butcher, /searchitem and /worldedit work on the console and added /we help as an alias for //help.
This commit is contained in:
parent
370ddeb9ff
commit
a4d82be697
@ -22,6 +22,7 @@ package com.sk89q.worldedit.commands;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
|
import com.sk89q.minecraft.util.commands.Console;
|
||||||
import com.sk89q.minecraft.util.commands.NestedCommand;
|
import com.sk89q.minecraft.util.commands.NestedCommand;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
import com.sk89q.worldedit.blocks.ItemType;
|
import com.sk89q.worldedit.blocks.ItemType;
|
||||||
@ -145,6 +146,7 @@ public class GeneralCommands {
|
|||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
|
@Console
|
||||||
public static void searchItem(CommandContext args, WorldEdit we,
|
public static void searchItem(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
@ -219,6 +221,7 @@ public class GeneralCommands {
|
|||||||
desc = "WorldEdit commands"
|
desc = "WorldEdit commands"
|
||||||
)
|
)
|
||||||
@NestedCommand(WorldEditCommands.class)
|
@NestedCommand(WorldEditCommands.class)
|
||||||
|
@Console
|
||||||
public static void we(CommandContext args, WorldEdit we,
|
public static void we(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
@ -28,6 +28,7 @@ import com.sk89q.minecraft.util.commands.Command;
|
|||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
import com.sk89q.minecraft.util.commands.CommandsManager;
|
import com.sk89q.minecraft.util.commands.CommandsManager;
|
||||||
|
import com.sk89q.minecraft.util.commands.Console;
|
||||||
import com.sk89q.minecraft.util.commands.Logging;
|
import com.sk89q.minecraft.util.commands.Logging;
|
||||||
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
|
import static com.sk89q.minecraft.util.commands.Logging.LogMode.*;
|
||||||
import com.sk89q.worldedit.*;
|
import com.sk89q.worldedit.*;
|
||||||
@ -365,20 +366,28 @@ public class UtilityCommands {
|
|||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.butcher")
|
@CommandPermissions("worldedit.butcher")
|
||||||
@Logging(PLACEMENT)
|
@Logging(PLACEMENT)
|
||||||
|
@Console
|
||||||
public static void butcher(CommandContext args, WorldEdit we,
|
public static void butcher(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
|
||||||
int radius = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : -1;
|
int radius = args.argsLength() > 0 ? Math.max(1, args.getInteger(0)) : -1;
|
||||||
|
|
||||||
Vector origin = session.getPlacementPosition(player);
|
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (args.hasFlag('p')) flags |= KillFlags.PETS;
|
if (args.hasFlag('p')) flags |= KillFlags.PETS;
|
||||||
if (args.hasFlag('n')) flags |= KillFlags.NPCS;
|
if (args.hasFlag('n')) flags |= KillFlags.NPCS;
|
||||||
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
|
if (args.hasFlag('a')) flags |= KillFlags.ANIMALS;
|
||||||
|
|
||||||
int killed = player.getWorld().killMobs(origin, radius, flags);
|
int killed;
|
||||||
|
if (player.isPlayer()) {
|
||||||
|
killed = player.getWorld().killMobs(session.getPlacementPosition(player), radius, flags);
|
||||||
|
} else {
|
||||||
|
killed = 0;
|
||||||
|
for (LocalWorld world : we.getServer().getWorlds()) {
|
||||||
|
killed += world.killMobs(new Vector(), radius, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
player.print("Killed " + killed + " mobs.");
|
player.print("Killed " + killed + " mobs.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,6 +448,7 @@ public class UtilityCommands {
|
|||||||
min = 0,
|
min = 0,
|
||||||
max = -1
|
max = -1
|
||||||
)
|
)
|
||||||
|
@Console
|
||||||
public static void help(CommandContext args, WorldEdit we,
|
public static void help(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
|
@ -26,6 +26,7 @@ import java.util.TimeZone;
|
|||||||
import com.sk89q.minecraft.util.commands.Command;
|
import com.sk89q.minecraft.util.commands.Command;
|
||||||
import com.sk89q.minecraft.util.commands.CommandContext;
|
import com.sk89q.minecraft.util.commands.CommandContext;
|
||||||
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
import com.sk89q.minecraft.util.commands.CommandPermissions;
|
||||||
|
import com.sk89q.minecraft.util.commands.Console;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalPlayer;
|
import com.sk89q.worldedit.LocalPlayer;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
@ -42,6 +43,7 @@ public class WorldEditCommands {
|
|||||||
min = 0,
|
min = 0,
|
||||||
max = 0
|
max = 0
|
||||||
)
|
)
|
||||||
|
@Console
|
||||||
public static void version(CommandContext args, WorldEdit we,
|
public static void version(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
@ -58,6 +60,7 @@ public class WorldEditCommands {
|
|||||||
max = 0
|
max = 0
|
||||||
)
|
)
|
||||||
@CommandPermissions("worldedit.reload")
|
@CommandPermissions("worldedit.reload")
|
||||||
|
@Console
|
||||||
public static void reload(CommandContext args, WorldEdit we,
|
public static void reload(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
@ -87,6 +90,7 @@ public class WorldEditCommands {
|
|||||||
min = 1,
|
min = 1,
|
||||||
max = 1
|
max = 1
|
||||||
)
|
)
|
||||||
|
@Console
|
||||||
public static void tz(CommandContext args, WorldEdit we,
|
public static void tz(CommandContext args, WorldEdit we,
|
||||||
LocalSession session, LocalPlayer player, EditSession editSession)
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
@ -96,4 +100,19 @@ public class WorldEditCommands {
|
|||||||
player.print("The current time in that timezone is: "
|
player.print("The current time in that timezone is: "
|
||||||
+ dateFormat.format(Calendar.getInstance(tz).getTime()));
|
+ 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
|
||||||
|
)
|
||||||
|
@Console
|
||||||
|
public static void help(CommandContext args, WorldEdit we,
|
||||||
|
LocalSession session, LocalPlayer player, EditSession editSession)
|
||||||
|
throws WorldEditException {
|
||||||
|
|
||||||
|
UtilityCommands.help(args, we, session, player, editSession);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user