Added the /island go command so you can teleport home

Added some more goodies in the default chest. It's now a minimal
SkyBlock!
This commit is contained in:
tastybento 2017-06-10 16:40:43 -07:00
parent dcda604e6c
commit f8032bfde5
2 changed files with 22 additions and 6 deletions

View File

@ -128,7 +128,15 @@ public class BSkyBlock extends JavaPlugin{
islandsManager.load();
// Load schematics
Settings.chestItems = new ItemStack[] {new ItemStack(Material.LAVA_BUCKET,1)};
// TODO: load these from config.yml
Settings.chestItems = new ItemStack[] {
new ItemStack(Material.LAVA_BUCKET,1),
new ItemStack(Material.ICE,2),
new ItemStack(Material.MELON_SEEDS,1),
new ItemStack(Material.BONE,2),
new ItemStack(Material.COBBLESTONE,5),
new ItemStack(Material.SAPLING,2)
};
schematicsManager = new SchematicsMgr(plugin);
getCommand("island").setExecutor(new IslandCommand(plugin));

View File

@ -96,13 +96,17 @@ public class IslandCommand extends BSBCommand{
@Override
public boolean canExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
return false;
return true;
}
@Override
public void onExecute(CommandSender sender, String label, String[] args) {
// TODO Auto-generated method stub
if (sender instanceof Player) {
Player player = (Player)sender;
if (plugin.getIslands().hasIsland(player.getUniqueId())) {
plugin.getIslands().homeTeleport(player);
}
}
}
@Override
@ -158,8 +162,12 @@ public class IslandCommand extends BSBCommand{
public void onExecute(CommandSender sender, String label, String[] args) {
if (sender instanceof Player) {
Player player = (Player)sender;
Schematic schematic = plugin.getSchematics().getSchematic("default");
plugin.getIslands().newIsland(player, schematic);
if (!plugin.getIslands().hasIsland(player.getUniqueId())) {
Schematic schematic = plugin.getSchematics().getSchematic("default");
plugin.getIslands().newIsland(player, schematic);
} else {
player.sendMessage(ChatColor.RED + "You already have an island!");
}
}
}