Add a base for commands
This commit is contained in:
parent
0e97c3dd5b
commit
20a5b09a39
|
|
@ -24,4 +24,22 @@ bukkit {
|
||||||
apiVersion = "1.20"
|
apiVersion = "1.20"
|
||||||
authors = listOf("destro174")
|
authors = listOf("destro174")
|
||||||
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD
|
load = net.minecrell.pluginyml.bukkit.BukkitPluginDescription.PluginLoadOrder.POSTWORLD
|
||||||
|
|
||||||
|
commands {
|
||||||
|
register("island") {
|
||||||
|
description = "Teleports you to your island. Creates a new island if it is not existing."
|
||||||
|
aliases = listOf("is")
|
||||||
|
permission = "${rootProject.name}.command.island"
|
||||||
|
}
|
||||||
|
|
||||||
|
register("Challenges") {
|
||||||
|
description = "Opens the challenges menu."
|
||||||
|
permission = "${rootProject.name}.command.island"
|
||||||
|
}
|
||||||
|
|
||||||
|
register("cometskyblock") {
|
||||||
|
description = "${rootProject.name} admin command."
|
||||||
|
permission = "${rootProject.name}.command.admin"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,11 @@
|
||||||
package com.alttd.cometskyblock;
|
package com.alttd.cometskyblock;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.commands.challenges.ChallengeCommand;
|
||||||
|
import com.alttd.cometskyblock.commands.island.IslandCommand;
|
||||||
import com.alttd.cometskyblock.configuration.*;
|
import com.alttd.cometskyblock.configuration.*;
|
||||||
import com.alttd.cometskyblock.listeners.PlayerJoinListener;
|
import com.alttd.cometskyblock.listeners.PlayerJoinListener;
|
||||||
import com.alttd.cometskyblock.managers.IslandManager;
|
import com.alttd.cometskyblock.managers.IslandManager;
|
||||||
import com.alttd.cometskyblock.worldgenerator.MasterWorldGenerator;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
@ -68,7 +67,9 @@ public class CometSkyBlockPlugin extends JavaPlugin implements CometSkyBlockAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadCommands() {
|
public void loadCommands() {
|
||||||
|
getCommand("island").setExecutor(new IslandCommand(this));
|
||||||
|
getCommand("challenges").setExecutor(new ChallengeCommand(this));
|
||||||
|
// getCommand("cometskyblock").setExecutor( new AdminCommands(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadEventListeners() {
|
public void loadEventListeners() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.alttd.cometskyblock.commands;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public abstract class PlayerSubCommand extends SubCommand {
|
||||||
|
|
||||||
|
protected PlayerSubCommand(CometSkyBlockPlugin plugin, String name, String... aliases) {
|
||||||
|
super(plugin, name, aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(CommandSender sender, String... args) {
|
||||||
|
if (!(sender instanceof Player player)) {
|
||||||
|
sender.sendRichMessage(plugin.messagesConfiguration().get().commands().notAPlayer());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Todo - load islandplayerdata
|
||||||
|
return execute(player, new IslandPlayer(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean execute(Player player, IslandPlayer islandPlayer, String... args);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
package com.alttd.cometskyblock.commands;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.TabExecutor;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public abstract class SubCommand implements TabExecutor {
|
||||||
|
|
||||||
|
protected CometSkyBlockPlugin plugin;
|
||||||
|
private final String name;
|
||||||
|
private final String[] aliases;
|
||||||
|
private final Map<String, SubCommand> subCommands = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
protected SubCommand(CometSkyBlockPlugin plugin, String name, String... aliases) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.name = name;
|
||||||
|
this.aliases = aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract boolean execute(CommandSender sender, String... args);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command cmd, @NotNull String label, String[] args) {
|
||||||
|
if (args.length > 0) {
|
||||||
|
SubCommand subCommand = getSubCommand(args[0]);
|
||||||
|
if (subCommand != null) {
|
||||||
|
return subCommand.onCommand(sender, cmd, args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return execute(sender, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
return subCommands.keySet().stream()
|
||||||
|
.sorted(String::compareToIgnoreCase)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
SubCommand subCommand = getSubCommand(args[0]);
|
||||||
|
if (subCommand != null) {
|
||||||
|
return subCommand.onTabComplete(sender, command, args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
} else if (args.length == 1) {
|
||||||
|
return subCommands.keySet().stream()
|
||||||
|
.filter(s -> s.toLowerCase().startsWith(args[0]))
|
||||||
|
.sorted(String::compareToIgnoreCase)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerSubCommand(SubCommand subCommand) {
|
||||||
|
subCommands.put(subCommand.name.toLowerCase(), subCommand);
|
||||||
|
for (String alias : subCommand.aliases) {
|
||||||
|
subCommands.putIfAbsent(alias.toLowerCase(), subCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SubCommand getSubCommand(String name) {
|
||||||
|
return subCommands.get(name.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.alttd.cometskyblock.commands.challenges;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class ChallengeCommand extends PlayerSubCommand {
|
||||||
|
|
||||||
|
private final CometSkyBlockPlugin plugin;
|
||||||
|
|
||||||
|
public ChallengeCommand(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "challenge");
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
// open challenge inventory - not implemented yet -- TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandAccept extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandAccept(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandCommand extends PlayerSubCommand {
|
||||||
|
|
||||||
|
private final CometSkyBlockPlugin plugin;
|
||||||
|
|
||||||
|
public IslandCommand(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "island");
|
||||||
|
this.plugin = plugin;
|
||||||
|
|
||||||
|
registerSubCommand(new IslandHelp(plugin));
|
||||||
|
registerSubCommand(new IslandSethome(plugin));
|
||||||
|
registerSubCommand(new IslandRestart(plugin));
|
||||||
|
registerSubCommand(new IslandAccept(plugin));
|
||||||
|
registerSubCommand(new IslandLeave(plugin));
|
||||||
|
registerSubCommand(new IslandMembers(plugin));
|
||||||
|
registerSubCommand(new IslandLevel(plugin));
|
||||||
|
registerSubCommand(new IslandTop(plugin));
|
||||||
|
registerSubCommand(new IslandOptions(plugin));
|
||||||
|
registerSubCommand(new IslandConfirm(plugin));
|
||||||
|
registerSubCommand(new IslandInvite(plugin));
|
||||||
|
registerSubCommand(new IslandKick(plugin));
|
||||||
|
registerSubCommand(new IslandSetOwner(plugin));
|
||||||
|
registerSubCommand(new IslandVisit(plugin));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandConfirm extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandConfirm(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.configuration.MessageConfiguration;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandHelp extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandHelp(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
MessageConfiguration.Commands.Island.Help help = plugin.messagesConfiguration().get().commands().island().help();
|
||||||
|
// Todo - builder to check for perm and only add messages with permission
|
||||||
|
player.sendRichMessage(
|
||||||
|
help.intro() + "<newline>" +
|
||||||
|
help.island() + "<newline>" +
|
||||||
|
help.setHome() + "<newline>" +
|
||||||
|
help.restart() + "<newline>" +
|
||||||
|
help.invite() + "<newline>" +
|
||||||
|
help.accept() + "<newline>" +
|
||||||
|
help.confirm() + "<newline>" +
|
||||||
|
help.kick() + "<newline>" +
|
||||||
|
help.setOwner() + "<newline>" +
|
||||||
|
help.leave() + "<newline>" +
|
||||||
|
help.level() + "<newline>" +
|
||||||
|
help.members() + "<newline>" +
|
||||||
|
help.options() + "<newline>" +
|
||||||
|
help.top() + "<newline>" +
|
||||||
|
help.visit() + "<newline>" +
|
||||||
|
help.challenges() + "<newline>"
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandInvite extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandInvite(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandKick extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandKick(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandLeave extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandLeave(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandLevel extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandLevel(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandMembers extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandMembers(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandOptions extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandOptions(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.configuration.MessageConfiguration;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandRestart extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandRestart(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandSetOwner extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandSetOwner(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.configuration.MessageConfiguration;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandSethome extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandSethome(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
MessageConfiguration.Commands.Island.SetHome setHome = plugin.messagesConfiguration().get().commands().island().setHome();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandTop extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandTop(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.alttd.cometskyblock.commands.island;
|
||||||
|
|
||||||
|
import com.alttd.cometskyblock.CometSkyBlockPlugin;
|
||||||
|
import com.alttd.cometskyblock.commands.PlayerSubCommand;
|
||||||
|
import com.alttd.cometskyblock.island.IslandPlayer;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class IslandVisit extends PlayerSubCommand {
|
||||||
|
|
||||||
|
public IslandVisit(CometSkyBlockPlugin plugin) {
|
||||||
|
super(plugin, "help");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player player, IslandPlayer islandPlayer, String[] args) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,4 +7,133 @@ import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||||
@Getter
|
@Getter
|
||||||
@SuppressWarnings({"CanBeFinal", "FieldMayBeFinal"})
|
@SuppressWarnings({"CanBeFinal", "FieldMayBeFinal"})
|
||||||
public class MessageConfiguration implements Configuration {
|
public class MessageConfiguration implements Configuration {
|
||||||
|
|
||||||
|
private Commands commands = new Commands();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Commands {
|
||||||
|
|
||||||
|
private String notAPlayer = "<red>You must be a player to use this command.";
|
||||||
|
|
||||||
|
private Island island = new Island();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Island {
|
||||||
|
String commandUsage = "Wrong usage: try /island help";
|
||||||
|
|
||||||
|
private Help help = new Help();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Help {
|
||||||
|
String intro = "test";
|
||||||
|
String island = "";
|
||||||
|
String setHome = "";
|
||||||
|
String restart = "";
|
||||||
|
String invite = "";
|
||||||
|
String accept = "";
|
||||||
|
String confirm = "";
|
||||||
|
String kick = "";
|
||||||
|
String setOwner = "";
|
||||||
|
String leave = "";
|
||||||
|
String level = "";
|
||||||
|
String members = "";
|
||||||
|
String options = "";
|
||||||
|
String top = "";
|
||||||
|
String visit = "";
|
||||||
|
String challenges = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
SetHome setHome = new SetHome();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class SetHome {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Restart restart = new Restart();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Restart {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Accept accept = new Accept();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Accept {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Leave leave = new Leave();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Leave {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Members members = new Members();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Members {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Level level = new Level();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Level {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Top top = new Top();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Top {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Options options = new Options();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Options {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Confirm confirm = new Confirm();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Confirm {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Invite invite = new Invite();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Invite {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Kick kick = new Kick();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Kick {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SetOwner setOwner = new SetOwner();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class SetOwner {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Visit visit = new Visit();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Visit {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Challenges challenges = new Challenges();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Challenges {
|
||||||
|
String commandUsage = "Wrong usage: try /challenges help";
|
||||||
|
String notAtIsland = "You must be on your island to perform this command.";
|
||||||
|
String noIsland = "You need to create an island before performing this command.";
|
||||||
|
}
|
||||||
|
|
||||||
|
private Admin admin = new Admin();
|
||||||
|
@ConfigSerializable @Getter
|
||||||
|
public static class Admin {
|
||||||
|
String commandUsage = "Wrong usage: try /cometskyblock help";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ public class PluginConfiguration implements Configuration {
|
||||||
@Comment("Generate debug messages")
|
@Comment("Generate debug messages")
|
||||||
private boolean debug = true;
|
private boolean debug = true;
|
||||||
|
|
||||||
private MasterWorldGenerator masterWorldGenerator = new MasterWorldGenerator();
|
private WorldGenerator worldGenerator = new WorldGenerator();
|
||||||
@ConfigSerializable @Getter
|
@ConfigSerializable @Getter
|
||||||
public static class MasterWorldGenerator {
|
public static class WorldGenerator {
|
||||||
|
|
||||||
private int centerX = 0;
|
private int centerX = 0;
|
||||||
private int centerZ = 0;
|
private int centerZ = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,32 @@
|
||||||
package com.alttd.cometskyblock.island;
|
package com.alttd.cometskyblock.island;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ConfigSerializable
|
||||||
public class Island {
|
public class Island {
|
||||||
|
|
||||||
private String worldName;
|
private String worldName;
|
||||||
private String islandName;
|
private String islandName;
|
||||||
private int level;
|
private int level;
|
||||||
private UUID owner;
|
private UUID owner;
|
||||||
private List<UUID> members = new ArrayList<>();
|
private final List<UUID> members = new ArrayList<>();
|
||||||
|
|
||||||
public boolean canBuild(UUID uuid) {
|
public boolean canBuild(UUID uuid) {
|
||||||
return owner.equals(uuid) || members.contains(uuid);
|
return owner.equals(uuid) || members.contains(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean addMember(UUID uuid) {
|
||||||
|
return this.members.add(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeMember(UUID uuid) {
|
||||||
|
return this.members.remove(uuid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user