mirror of
https://github.com/BentoBoxWorld/AcidIsland.git
synced 2024-12-23 17:48:15 +01:00
Reworked to use new API for BSB.
Added commands for admin and ai.
This commit is contained in:
parent
6ac6fe44c0
commit
e9001d291d
2
pom.xml
2
pom.xml
@ -1,6 +1,6 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>addon-acidisland</groupId>
|
||||
<groupId>us.tastybento</groupId>
|
||||
<artifactId>addon-acidisland</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
@ -172,5 +172,17 @@ public class AISettings implements WorldSettings {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxTeamSize() {
|
||||
// TODO Auto-generated method stub
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxHomes() {
|
||||
// TODO Auto-generated method stub
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,8 +3,11 @@ package bskyblock.addon.acidisland;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
|
||||
import bskyblock.addon.acidisland.commands.AcidCommand;
|
||||
import bskyblock.addon.acidisland.commands.AiCommand;
|
||||
import bskyblock.addon.acidisland.listeners.AcidEffect;
|
||||
import bskyblock.addon.acidisland.listeners.IslandBuilder;
|
||||
import bskyblock.addon.acidisland.world.AcidIslandWorld;
|
||||
import us.tastybento.bskyblock.api.addons.Addon;
|
||||
|
||||
/**
|
||||
@ -25,7 +28,6 @@ public class AcidIsland extends Addon {
|
||||
aiw = new AcidIslandWorld(this);
|
||||
// TODO Register settings
|
||||
//getBSkyBlock().getSettings().register(settings);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,6 +38,9 @@ public class AcidIsland extends Addon {
|
||||
manager.registerEvents(new AcidEffect(this), this.getBSkyBlock());
|
||||
// New Islands
|
||||
manager.registerEvents(new IslandBuilder(this), this.getBSkyBlock());
|
||||
// Register commands
|
||||
new AcidCommand(this);
|
||||
new AiCommand(this);
|
||||
|
||||
}
|
||||
|
||||
@ -54,6 +59,10 @@ public class AcidIsland extends Addon {
|
||||
return aiw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to obtain the AcidIsland overworld
|
||||
* @return
|
||||
*/
|
||||
public World getIslandWorld() {
|
||||
return aiw.getOverWorld();
|
||||
}
|
||||
|
61
src/main/java/bskyblock/addon/acidisland/commands/AcidCommand.java
Executable file
61
src/main/java/bskyblock/addon/acidisland/commands/AcidCommand.java
Executable file
@ -0,0 +1,61 @@
|
||||
package bskyblock.addon.acidisland.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import bskyblock.addon.acidisland.AcidIsland;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminGetRankCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminInfoCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminReloadCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminSchemCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminSetRankCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminTeleportCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.AdminVersionCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.teams.AdminTeamAddCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.teams.AdminTeamDisbandCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.teams.AdminTeamKickCommand;
|
||||
import us.tastybento.bskyblock.commands.admin.teams.AdminTeamMakeLeaderCommand;
|
||||
|
||||
public class AcidCommand extends CompositeCommand {
|
||||
|
||||
public AcidCommand(AcidIsland addon) {
|
||||
super("acid");
|
||||
setWorld(addon.getIslandWorld());
|
||||
new AdminVersionCommand(this);
|
||||
new AdminReloadCommand(this);
|
||||
new AdminTeleportCommand(this, "tp");
|
||||
new AdminTeleportCommand(this, "tpnether");
|
||||
new AdminTeleportCommand(this, "tpend");
|
||||
new AdminGetRankCommand(this);
|
||||
new AdminSetRankCommand(this);
|
||||
new AdminInfoCommand(this);
|
||||
// Team commands
|
||||
new AdminTeamAddCommand(this);
|
||||
new AdminTeamKickCommand(this);
|
||||
new AdminTeamDisbandCommand(this);
|
||||
new AdminTeamMakeLeaderCommand(this);
|
||||
// Schems
|
||||
new AdminSchemCommand(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
setPermissionPrefix("acidisland");
|
||||
setPermission("acidisland.admin.*");
|
||||
setOnlyPlayer(false);
|
||||
setParameters("commands.admin.help.parameters");
|
||||
setDescription("commands.admin.help.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(User user, List<String> args) {
|
||||
if (!args.isEmpty()) {
|
||||
user.sendMessage("general.errors.unknown-command", "[label]", "acid");
|
||||
return false;
|
||||
}
|
||||
// By default run the attached help command, if it exists (it should)
|
||||
return showHelp(this, user);
|
||||
}
|
||||
|
||||
}
|
92
src/main/java/bskyblock/addon/acidisland/commands/AiCommand.java
Executable file
92
src/main/java/bskyblock/addon/acidisland/commands/AiCommand.java
Executable file
@ -0,0 +1,92 @@
|
||||
package bskyblock.addon.acidisland.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import bskyblock.addon.acidisland.AcidIsland;
|
||||
import us.tastybento.bskyblock.Constants;
|
||||
import us.tastybento.bskyblock.api.commands.CompositeCommand;
|
||||
import us.tastybento.bskyblock.api.user.User;
|
||||
import us.tastybento.bskyblock.commands.island.IslandAboutCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandBanCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandBanlistCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandCreateCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandGoCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandLanguageCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandResetCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandResetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSethomeCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSetnameCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandSettingsCommand;
|
||||
import us.tastybento.bskyblock.commands.island.IslandUnbanCommand;
|
||||
import us.tastybento.bskyblock.commands.island.teams.IslandTeamCommand;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
public class AiCommand extends CompositeCommand {
|
||||
|
||||
AcidIsland addon;
|
||||
|
||||
public AiCommand(AcidIsland addon) {
|
||||
super("ai");
|
||||
// Set up world
|
||||
setWorld(addon.getIslandWorld());
|
||||
// Set up subcommands
|
||||
new IslandAboutCommand(this);
|
||||
new IslandCreateCommand(this);
|
||||
new IslandGoCommand(this);
|
||||
new IslandResetCommand(this);
|
||||
new IslandSetnameCommand(this);
|
||||
new IslandResetnameCommand(this);
|
||||
new IslandSethomeCommand(this);
|
||||
new IslandSettingsCommand(this);
|
||||
new IslandLanguageCommand(this);
|
||||
new IslandBanCommand(this);
|
||||
new IslandUnbanCommand(this);
|
||||
new IslandBanlistCommand(this);
|
||||
// Team commands
|
||||
new IslandTeamCommand(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.api.commands.CompositeCommand#setup()
|
||||
*/
|
||||
@Override
|
||||
public void setup() {
|
||||
setDescription("commands.island.help.description");
|
||||
setOnlyPlayer(true);
|
||||
// Permission
|
||||
setPermissionPrefix("acidisland");
|
||||
setPermission("island");
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see us.tastybento.bskyblock.api.commands.CommandArgument#execute(org.bukkit.command.CommandSender, java.lang.String[])
|
||||
*/
|
||||
@Override
|
||||
public boolean execute(User user, List<String> args) {
|
||||
if (user == null) {
|
||||
return false;
|
||||
}
|
||||
if (args.isEmpty()) {
|
||||
// If in world, go
|
||||
if (getPlugin().getIslands().hasIsland(getWorld(), user.getUniqueId())) {
|
||||
return getSubCommand("go").map(goCmd -> goCmd.execute(user, new ArrayList<>())).orElse(false);
|
||||
}
|
||||
// No islands currently
|
||||
return getSubCommand("create").map(createCmd -> createCmd.execute(user, new ArrayList<>())).orElse(false);
|
||||
}
|
||||
user.sendMessage("general.errors.unknown-command", "[label]", Constants.ISLANDCOMMAND);
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<List<String>> tabComplete(User user, String alias, List<String> args) {
|
||||
List<String> options = getPlugin().getIWM().getOverWorldNames().stream().collect(Collectors.toList());
|
||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||
return Optional.of(Util.tabLimit(options, lastArg));
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package bskyblock.addon.acidisland;
|
||||
package bskyblock.addon.acidisland.world;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
|
||||
import bskyblock.addon.acidisland.AcidIsland;
|
||||
import us.tastybento.bskyblock.util.Util;
|
||||
|
||||
/**
|
@ -1,4 +1,4 @@
|
||||
package bskyblock.addon.acidisland;
|
||||
package bskyblock.addon.acidisland.world;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -11,6 +11,8 @@ import org.bukkit.generator.BlockPopulator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.util.noise.PerlinOctaveGenerator;
|
||||
|
||||
import bskyblock.addon.acidisland.AcidIsland;
|
||||
|
||||
/**
|
||||
* Generates the AcidIsland world
|
||||
* @author tastybento
|
Loading…
Reference in New Issue
Block a user