mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-01-03 23:27:37 +00:00
Framework for new adminworld commands.
This commit is contained in:
parent
86ee0e96d2
commit
af4071c582
@ -1,16 +1,61 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
|
import me.StevenLawson.TotalFreedomMod.TFM_AdminWorld;
|
||||||
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = AdminLevel.SUPER, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = AdminLevel.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command>")
|
@CommandParameters(description = "Go to the AdminWorld.", usage = "/<command> [guest < list | add <player> | remove <player> > | time <worldtime>]")
|
||||||
public class Command_adminworld extends TFM_Command
|
public class Command_adminworld extends TFM_Command
|
||||||
{
|
{
|
||||||
|
private enum CommandMode
|
||||||
|
{
|
||||||
|
TELEPORT, GUEST, TIME
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
CommandMode commandMode = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
* /adminworld
|
||||||
|
*
|
||||||
|
* /adminworld guest list
|
||||||
|
* /adminworld guest remove <player>
|
||||||
|
* /adminworld guest add <player>
|
||||||
|
*
|
||||||
|
* /adminworld time <time>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
commandMode = CommandMode.TELEPORT;
|
||||||
|
}
|
||||||
|
else if (args.length >= 2)
|
||||||
|
{
|
||||||
|
if ("guest".equalsIgnoreCase(args[0]))
|
||||||
|
{
|
||||||
|
commandMode = CommandMode.GUEST;
|
||||||
|
}
|
||||||
|
else if ("time".equalsIgnoreCase(args[0]))
|
||||||
|
{
|
||||||
|
commandMode = CommandMode.TIME;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (commandMode == null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (commandMode)
|
||||||
|
{
|
||||||
|
case TELEPORT:
|
||||||
{
|
{
|
||||||
if (sender_p.getWorld() == TFM_AdminWorld.getInstance().getAdminWorld())
|
if (sender_p.getWorld() == TFM_AdminWorld.getInstance().getAdminWorld())
|
||||||
{
|
{
|
||||||
@ -22,6 +67,47 @@ public class Command_adminworld extends TFM_Command
|
|||||||
playerMsg("Going to the AdminWorld.");
|
playerMsg("Going to the AdminWorld.");
|
||||||
TFM_AdminWorld.getInstance().sendToAdminWorld(sender_p);
|
TFM_AdminWorld.getInstance().sendToAdminWorld(sender_p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GUEST:
|
||||||
|
{
|
||||||
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
if ("list".equalsIgnoreCase(args[1]))
|
||||||
|
{
|
||||||
|
//list
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.length == 3)
|
||||||
|
{
|
||||||
|
if ("add".equalsIgnoreCase(args[1]))
|
||||||
|
{
|
||||||
|
//add args[2]
|
||||||
|
}
|
||||||
|
else if (TFM_Util.isRemoveCommand(args[1]))
|
||||||
|
{
|
||||||
|
//remove args[2]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TIME:
|
||||||
|
{
|
||||||
|
if (args.length == 2)
|
||||||
|
{
|
||||||
|
//set time = args[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user