Skip to content

Commit

Permalink
Merge pull request #7 from 778b/5-11-version
Browse files Browse the repository at this point in the history
1.1 version
  • Loading branch information
778b authored Aug 20, 2023
2 parents 7127e72 + 87822f0 commit 2f074ee
Show file tree
Hide file tree
Showing 42 changed files with 848 additions and 90 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'io.github.lofrol'
version = '1.0'
version = '1.1'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
public final class ClanAdminCommand extends Command {


public static boolean CreateDefaultInts() {
ClanAdminCommand tempClanAdminCommand = new ClanAdminCommand("ClanAdmin", "Default command for access to the clan system",
public static ClanAdminCommand CreateDefaultInts() {
return new ClanAdminCommand("ClanAdmin", "Default command for access to the clan system",
"Use &5/Clan help&r for learning more", Stream.of("clanadmin", "ClanAdmin", "clad", "ClAd").collect(Collectors.toList()));
return getServer().getCommandMap().register("[UselessClan]", tempClanAdminCommand);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
import static org.bukkit.Bukkit.getServer;

public final class ClanChatCommand extends Command {
public static boolean CreateDefaultInst() {
ClanChatCommand tempClanChatCommand = new ClanChatCommand("ClanChat", "Default command for clan chat",
public static ClanChatCommand CreateDefaultInst() {
return new ClanChatCommand("ClanChat", "Default command for clan chat",
"Use &5/Clan help&r for learning more", Stream.of("ucc").collect(Collectors.toList()));
return getServer().getCommandMap().register("[UselessClan]", tempClanChatCommand);
}

private ClanChatCommand(@NotNull String name, @NotNull String description, @NotNull String usageMessage, @NotNull List<String> aliases) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

public final class ClanCommand extends Command {

public static boolean CreateDefaultInst() {
ClanCommand tempClanCommand = new ClanCommand("Clan", "Default command for access to the clan system",
@NotNull
public static ClanCommand CreateDefaultInst() {
return new ClanCommand("Clan", "Default command for access to the clan system",
"Use &5/Clan help&r for learning more", Stream.of("clan", "Clan").collect(Collectors.toList()));
return getServer().getCommandMap().register("[UselessClan]", tempClanCommand);
}

private ClanCommand(@NotNull String name, @NotNull String description,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class calclvlAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.calclvl";
}

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class debugInfoAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.debugInfo";
}

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class deleteAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.delete";
}

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class forceJoinAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return sender instanceof Player;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.forceJoin";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
import io.github.lofrol.UselessClan.ClanCommands.Commands.CommandBase;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class helpAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.help";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
ChatSender.MessageTo(sender, "&4UselessClan","########## CLAN ADMIN HELP ##########");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class homeAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.home";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class infoAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.info";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class levelAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.level";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,20 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class listAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.list";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
ChatSender.MessageTo(sender, "&4UselessClan","########## CLAN LIST ##########");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class matesAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.mates";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,20 @@
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class requestsAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.requests";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package io.github.lofrol.UselessClan.ClanCommands.Commands.AdminCommands;

import io.github.lofrol.UselessClan.ClanCommands.Commands.CommandBase;
import io.github.lofrol.UselessClan.ClanObjects.Clan;
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

public class treasureAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}

@Override
public @NotNull String commandDescription() {
return "Description.Admin.treasure";
}


@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
ChatSender.MessageTo(sender, "&4UselessClan","You forgot about clan %name, use /ClAd home %name, %name = name of clan");
}
else {
Clan findedClan = UselessClan.getMainManager().getServerClans().get(args[1]);
if (findedClan == null) {
ChatSender.MessageTo(sender, "&4UselessClan","&cThis clan didnt exist!");
return false;
}
if (sender instanceof Player tempPlayer) tempPlayer.teleport(findedClan.getTreasureClan());
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@


import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public abstract class CommandBase {
public abstract @NotNull String commandDescription();

public abstract boolean executeCommand(CommandSender sender, String[] args);

public abstract boolean havePermission(CommandSender sender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class AdminClanCommands {
entry("requests", new requestsAdminCommand()),
entry("delete", new deleteAdminCommand()),
entry("home", new homeAdminCommand()),
entry("treasure", new treasureAdminCommand()),
entry("calclvl", new calclvlAdminCommand()),
entry("level", new levelAdminCommand()),
entry("debuginfo", new debugInfoAdminCommand()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ public class BaseClanCommands {
entry("requests", new requestsUserCommand()),
entry("top", new topUserCommand()),
entry("claim", new claimUserCommand()),
entry("calclvl", new calclvlUserCommand()),
entry("create", new createUserCommand()),
entry("delete", new deleteUserCommand()),
entry("leave", new leaveUserCommand()),
entry("deposit", new depositUserCommand()),
entry("withdraw", new withdrawUserCommand()),
entry("home", new homeUserCommand()),
entry("sethome", new sethomeUserCommand()),
entry("rename", new renameUserCommand()),
entry("redesc", new redescUserCommand()),
entry("settreasure",new settreasureUserCommand()),
entry("info", new infoUserCommand()),
entry("mates", new matesUserCommand()),
entry("accept", new acceptUserCommand()),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.github.lofrol.UselessClan.ClanCommands.Commands.CommandsManager;

import io.github.lofrol.UselessClan.ClanCommands.Commands.CommandBase;
import io.github.lofrol.UselessClan.ClanCommands.Commands.DefaultCommands.*;
import io.github.lofrol.UselessClan.ClanCommands.Commands.PlayerCommandBase;
import io.github.lofrol.UselessClan.ClanCommands.Commands.PluginCommands.reloadGeneralCommand;
import io.github.lofrol.UselessClan.ClanCommands.Commands.PluginCommands.versionUserCommand;
import io.github.lofrol.UselessClan.ClanObjects.Clan;
import io.github.lofrol.UselessClan.ClanObjects.EClanRole;
import org.bukkit.entity.Player;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;

import static java.util.Map.entry;

public class PluginClanCommands {
private static final Map<String, CommandBase> ClanCommands = Map.ofEntries(
entry("version", new versionUserCommand()),
entry("reload", new reloadGeneralCommand())
);

public static CommandBase getCommand(String key) {
return ClanCommands.get(key);
}

public static @NotNull Collection<PlayerCommandBase> getExecutableCommands(Player tempPlayer, Clan senderClan, EClanRole senderRole) {
Collection<PlayerCommandBase> tempCommandArray = new ArrayList<>();
for (CommandBase tempBase : ClanCommands.values()) {
if (tempBase instanceof PlayerCommandBase tempPlayerCommand) {
if (tempPlayerCommand.havePermission(tempPlayer, senderClan, senderRole)) {
tempCommandArray.add(tempPlayerCommand);
}
}
}
return tempCommandArray;
}
}
Loading

0 comments on commit 2f074ee

Please sign in to comment.