partially implemented commands
This commit is contained in:
@@ -35,6 +35,7 @@ import com.sk89q.worldedit.BlockVector;
|
|||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||||
|
import com.sk89q.worldguard.domains.Domain;
|
||||||
import com.sk89q.worldguard.protection.databases.ProtectionDatabaseException;
|
import com.sk89q.worldguard.protection.databases.ProtectionDatabaseException;
|
||||||
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
||||||
import com.sk89q.worldguard.protection.flags.StateFlag;
|
import com.sk89q.worldguard.protection.flags.StateFlag;
|
||||||
@@ -807,4 +808,40 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
public int getWallheight(){
|
public int getWallheight(){
|
||||||
return wallHeight;
|
return wallHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaxPlots(String name) {
|
||||||
|
Player player = null;
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNumPlots(String name) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void assignPlot(Player player) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public String setCurrentHome(Player player, int homeNumber) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Plot getPlot(String string) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer(String string) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String teleportPlayerToPlot(Player player, Plot plot) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.majinnaibu.bukkitplugins.metropolis.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
|
||||||
|
public class MetropolisHomeAcquire implements CommandExecutor {
|
||||||
|
MetropolisPlugin _plugin;
|
||||||
|
|
||||||
|
public MetropolisHomeAcquire(MetropolisPlugin plugin){
|
||||||
|
_plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
if(!(sender instanceof Player)){
|
||||||
|
sender.sendMessage("This command can only be used by players");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player player = (Player) sender;
|
||||||
|
|
||||||
|
if(_plugin.getNumPlots(player.getName()) >= _plugin.getMaxPlots(player.getName())){
|
||||||
|
sender.sendMessage("You cannot have any more plots");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_plugin.assignPlot(player);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,20 +3,53 @@ package com.majinnaibu.bukkitplugins.metropolis.commands;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
|
||||||
public class MetropolisHomeMoveCommand implements CommandExecutor {
|
public class MetropolisHomeMoveCommand implements CommandExecutor {
|
||||||
|
MetropolisPlugin _plugin;
|
||||||
|
|
||||||
public MetropolisHomeMoveCommand(MetropolisPlugin metropolisPlugin) {
|
public MetropolisHomeMoveCommand(MetropolisPlugin plugin) {
|
||||||
// TODO Auto-generated constructor stub
|
_plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender arg0, Command arg1, String arg2,
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
String[] arg3) {
|
Player player = null;
|
||||||
// TODO Auto-generated method stub
|
int homeNumber = 0;
|
||||||
|
|
||||||
|
if(sender instanceof Player){
|
||||||
|
player = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(args.length == 1 && player != null){
|
||||||
|
try{
|
||||||
|
homeNumber = Integer.parseInt(args[0]);
|
||||||
|
}catch(NumberFormatException ex){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else if(args.length >= 2){
|
||||||
|
try{
|
||||||
|
homeNumber = Integer.parseInt(args[0]);
|
||||||
|
}catch(NumberFormatException ex){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(homeNumber <= 0){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String errorMessage = _plugin.setCurrentHome(player, homeNumber);
|
||||||
|
if(errorMessage != null){
|
||||||
|
sender.sendMessage(errorMessage);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,20 +3,47 @@ package com.majinnaibu.bukkitplugins.metropolis.commands;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.Plot;
|
||||||
|
|
||||||
public class MetropolisPlotGoCommand implements CommandExecutor {
|
public class MetropolisPlotGoCommand implements CommandExecutor {
|
||||||
|
MetropolisPlugin _plugin;
|
||||||
|
|
||||||
public MetropolisPlotGoCommand(MetropolisPlugin metropolisPlugin) {
|
public MetropolisPlotGoCommand(MetropolisPlugin plugin) {
|
||||||
// TODO Auto-generated constructor stub
|
_plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender arg0, Command arg1, String arg2,
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
String[] arg3) {
|
Player player = null;
|
||||||
// TODO Auto-generated method stub
|
Plot plot = null;
|
||||||
|
|
||||||
|
if(sender instanceof Player){
|
||||||
|
player = (Player) sender;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 1 && player != null){
|
||||||
|
plot = _plugin.getPlot(args[0]);
|
||||||
|
}else if(args.length >= 2){
|
||||||
|
player = _plugin.getPlayer(args[1]);
|
||||||
|
plot = _plugin.getPlot(args[0]);
|
||||||
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(plot == null || player == null){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String errorMessage = _plugin.teleportPlayerToPlot(player, plot);
|
||||||
|
if(errorMessage != null){
|
||||||
|
sender.sendMessage(errorMessage);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ public class MetropolisPlotReserveCommand implements CommandExecutor {
|
|||||||
|
|
||||||
public MetropolisPlotReserveCommand(MetropolisPlugin metropolisPlugin) {
|
public MetropolisPlotReserveCommand(MetropolisPlugin metropolisPlugin) {
|
||||||
_plugin = metropolisPlugin;
|
_plugin = metropolisPlugin;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -4,4 +4,4 @@ depend: [WorldGuard]
|
|||||||
softdepend: [WorldEdit,CommandBook]
|
softdepend: [WorldEdit,CommandBook]
|
||||||
version: 0.5
|
version: 0.5
|
||||||
database: false
|
database: false
|
||||||
commands:
|
commands:
|
||||||
Reference in New Issue
Block a user