Added basics for the Command Handler.

This commit is contained in:
Simon Rigby 2011-02-27 06:43:39 +00:00
parent 23c695b3a2
commit cd1de2b594
12 changed files with 229 additions and 5 deletions

View File

@ -0,0 +1,14 @@
package com.onarandombox.MultiVerseCore;
import org.bukkit.command.CommandSender;
public abstract class MVCommandHandler {
protected final MultiVerseCore plugin;
public MVCommandHandler(MultiVerseCore plugin){
this.plugin = plugin;
}
public abstract boolean perform(CommandSender sender, String[] args);
}

View File

@ -2,6 +2,7 @@ package com.onarandombox.MultiVerseCore;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
import org.bukkit.Server;
@ -19,11 +20,15 @@ import org.bukkit.event.Event.Priority;
import com.nijikokun.bukkit.Permissions.Permissions;
import com.nijiko.permissions.PermissionHandler;
import com.nijikokun.bukkit.iConomy.iConomy;
import com.onarandombox.MultiVerseCore.commands.*;
import com.onarandombox.MultiVerseCore.configuration.defaultConfiguration;
@SuppressWarnings("unused")
public class MultiVerseCore extends JavaPlugin {
// Setup our Map for our Commands using the CommandHandler.
private Map<String, MVCommandHandler> commands = new HashMap<String, MVCommandHandler>();
// Variable to state whether we are displaying Debug Messages or not.
public boolean debug = true;
@ -124,6 +129,19 @@ public class MultiVerseCore extends JavaPlugin {
* Load up the Worlds & their Settings.
*/
loadWorlds();
setupCommands();
}
private void setupCommands() {
commands.put("mvcreate", new MVCreate(this));
commands.put("mvimport", new MVImport(this));
commands.put("mvremove", new MVRemove(this));
commands.put("mvmodify", new MVModify(this));
commands.put("mvtp", new MVTP(this));
commands.put("mvlist", new MVList(this));
commands.put("mvsetspawn", new MVSetSpawn(this));
commands.put("mvspawn", new MVSpawn(this));
commands.put("mvcoord", new MVCoord(this));
}
/**
@ -149,7 +167,14 @@ public class MultiVerseCore extends JavaPlugin {
if(Permissions==null || this.isEnabled()==false){
return false;
}
return false;
MVCommandHandler handler = commands.get(command.getName().toLowerCase());
if (handler != null) {
return handler.perform(sender, args);
} else {
return false;
}
}
/**

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVCoord extends MVCommandHandler {
public MVCoord(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,20 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVCreate extends MVCommandHandler {
public MVCreate(MultiVerseCore plugin) {
super(plugin);
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVImport extends MVCommandHandler {
public MVImport(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVList extends MVCommandHandler {
public MVList(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVModify extends MVCommandHandler {
public MVModify(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVRemove extends MVCommandHandler {
public MVRemove(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVSetSpawn extends MVCommandHandler {
public MVSetSpawn(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVSpawn extends MVCommandHandler {
public MVSpawn(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -0,0 +1,21 @@
package com.onarandombox.MultiVerseCore.commands;
import org.bukkit.command.CommandSender;
import com.onarandombox.MultiVerseCore.MVCommandHandler;
import com.onarandombox.MultiVerseCore.MultiVerseCore;
public class MVTP extends MVCommandHandler {
public MVTP(MultiVerseCore plugin) {
super(plugin);
// TODO Auto-generated constructor stub
}
@Override
public boolean perform(CommandSender sender, String[] args) {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -18,9 +18,6 @@ commands:
mvtp:
description: Command to teleport between Worlds
usage: /<command>
mvtpt:
description: Command to teleport a target to a World/Portal
usage: /<command>
mvlist:
description: Print list of loaded Worlds
usage: /<command>