mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-25 03:55:27 +01:00
Added basics for the Command Handler.
This commit is contained in:
parent
23c695b3a2
commit
cd1de2b594
14
src/com/onarandombox/MultiVerseCore/MVCommandHandler.java
Normal file
14
src/com/onarandombox/MultiVerseCore/MVCommandHandler.java
Normal 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);
|
||||||
|
}
|
@ -2,6 +2,7 @@ package com.onarandombox.MultiVerseCore;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -19,11 +20,15 @@ import org.bukkit.event.Event.Priority;
|
|||||||
|
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.nijiko.permissions.PermissionHandler;
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijikokun.bukkit.iConomy.iConomy;
|
|
||||||
|
import com.onarandombox.MultiVerseCore.commands.*;
|
||||||
import com.onarandombox.MultiVerseCore.configuration.defaultConfiguration;
|
import com.onarandombox.MultiVerseCore.configuration.defaultConfiguration;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class MultiVerseCore extends JavaPlugin {
|
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.
|
// Variable to state whether we are displaying Debug Messages or not.
|
||||||
public boolean debug = true;
|
public boolean debug = true;
|
||||||
|
|
||||||
@ -124,6 +129,19 @@ public class MultiVerseCore extends JavaPlugin {
|
|||||||
* Load up the Worlds & their Settings.
|
* Load up the Worlds & their Settings.
|
||||||
*/
|
*/
|
||||||
loadWorlds();
|
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,8 +167,15 @@ public class MultiVerseCore extends JavaPlugin {
|
|||||||
if(Permissions==null || this.isEnabled()==false){
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic Debug Output function, if we've enabled debugging we'll output more information.
|
* Basic Debug Output function, if we've enabled debugging we'll output more information.
|
||||||
|
21
src/com/onarandombox/MultiVerseCore/commands/MVCoord.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVCoord.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
20
src/com/onarandombox/MultiVerseCore/commands/MVCreate.java
Normal file
20
src/com/onarandombox/MultiVerseCore/commands/MVCreate.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVImport.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVImport.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVList.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVList.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVModify.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVModify.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVRemove.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVRemove.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVSetSpawn.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVSpawn.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
21
src/com/onarandombox/MultiVerseCore/commands/MVTP.java
Normal file
21
src/com/onarandombox/MultiVerseCore/commands/MVTP.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -18,9 +18,6 @@ commands:
|
|||||||
mvtp:
|
mvtp:
|
||||||
description: Command to teleport between Worlds
|
description: Command to teleport between Worlds
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
mvtpt:
|
|
||||||
description: Command to teleport a target to a World/Portal
|
|
||||||
usage: /<command>
|
|
||||||
mvlist:
|
mvlist:
|
||||||
description: Print list of loaded Worlds
|
description: Print list of loaded Worlds
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user