1
0
mirror of https://github.com/essentials/Essentials.git synced 2025-08-17 12:01:20 +02:00

I always forget these

This commit is contained in:
snowleo
2012-01-03 02:53:57 +01:00
parent 801562ac2c
commit a552b88172
5 changed files with 15 additions and 44 deletions

View File

@@ -3,18 +3,12 @@ package com.earth2me.essentials.spawn;
import static com.earth2me.essentials.I18n._; import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
import org.bukkit.Server;
public class Commandsetspawn extends EssentialsCommand public class Commandsetspawn extends EssentialsCommand
{ {
public Commandsetspawn()
{
super("setspawn");
}
@Override @Override
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception public void run(final IUser user, final String[] args) throws Exception
{ {
final String group = args.length > 0 ? getFinalArg(args, 0) : "default"; final String group = args.length > 0 ? getFinalArg(args, 0) : "default";
((SpawnStorage)module).setSpawn(user.getLocation(), group); ((SpawnStorage)module).setSpawn(user.getLocation(), group);

View File

@@ -6,26 +6,20 @@ import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class Commandspawn extends EssentialsCommand public class Commandspawn extends EssentialsCommand
{ {
public Commandspawn()
{
super("spawn");
}
@Override @Override
public void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws Exception public void run(final IUser user, final String[] args) throws Exception
{ {
final Trade charge = new Trade(this.getName(), ess); final Trade charge = new Trade(commandName, ess);
charge.isAffordableFor(user); charge.isAffordableFor(user);
if (args.length > 0 && user.isAuthorized("essentials.spawn.others")) if (args.length > 0 && user.isAuthorized("essentials.spawn.others"))
{ {
final IUser otherUser = getPlayer(server, args, 0); final IUser otherUser = getPlayer(args, 0);
respawn(otherUser, null); respawn(otherUser, null);
if (!otherUser.equals(user)) if (!otherUser.equals(user))
{ {
@@ -34,27 +28,28 @@ public class Commandspawn extends EssentialsCommand
} }
} }
else else
{ {
respawn(user, null); respawn(user, null);
} }
} }
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception protected void run(final CommandSender sender, final String[] args) throws Exception
{ {
if (args.length < 1) if (args.length < 1)
{ {
throw new NotEnoughArgumentsException(); throw new NotEnoughArgumentsException();
} }
final IUser user = getPlayer(server, args, 0); final IUser user = getPlayer(args, 0);
respawn(user, null); respawn(user, null);
user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn")); user.sendMessage(_("teleportAtoB", user.getDisplayName(), "spawn"));
sender.sendMessage(_("teleporting")); sender.sendMessage(_("teleporting"));
} }
private void respawn (final IUser user, final Trade charge) throws Exception { private void respawn(final IUser user, final Trade charge) throws Exception
{
final SpawnStorage spawns = (SpawnStorage)this.module; final SpawnStorage spawns = (SpawnStorage)this.module;
final Location spawn = spawns.getSpawn(user.getGroup()); final Location spawn = spawns.getSpawn(user.getGroup());
user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND); user.getTeleport().teleport(spawn, charge, TeleportCause.COMMAND);
} }
} }

View File

@@ -3,18 +3,12 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.api.IUser; import com.earth2me.essentials.api.IUser;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
public class Commandsetxmpp extends EssentialsCommand public class Commandsetxmpp extends EssentialsCommand
{ {
public Commandsetxmpp()
{
super("setxmpp");
}
@Override @Override
protected void run(final Server server, final IUser user, final String commandLabel, final String[] args) throws NotEnoughArgumentsException protected void run(final IUser user, final String[] args) throws NotEnoughArgumentsException
{ {
if (args.length < 1) if (args.length < 1)
{ {

View File

@@ -3,20 +3,14 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.Console; import com.earth2me.essentials.Console;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Commandxmpp extends EssentialsCommand public class Commandxmpp extends EssentialsCommand
{ {
public Commandxmpp()
{
super("xmpp");
}
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException protected void run(final CommandSender sender, final String[] args) throws NotEnoughArgumentsException
{ {
if (args.length < 2) if (args.length < 2)
{ {

View File

@@ -3,20 +3,14 @@ package com.earth2me.essentials.xmpp;
import com.earth2me.essentials.commands.EssentialsCommand; import com.earth2me.essentials.commands.EssentialsCommand;
import com.earth2me.essentials.commands.NotEnoughArgumentsException; import com.earth2me.essentials.commands.NotEnoughArgumentsException;
import java.util.List; import java.util.List;
import org.bukkit.Server;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Commandxmppspy extends EssentialsCommand public class Commandxmppspy extends EssentialsCommand
{ {
public Commandxmppspy()
{
super("xmppspy");
}
@Override @Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws NotEnoughArgumentsException protected void run(final CommandSender sender, final String[] args) throws NotEnoughArgumentsException
{ {
if (args.length < 1) if (args.length < 1)
{ {