Skip to content

Commit

Permalink
Merge pull request #4 from 778b/1.0-Release
Browse files Browse the repository at this point in the history
1.0 release
  • Loading branch information
778b authored Jan 8, 2023
2 parents 6c9bf77 + 22b2871 commit 5bc21a9
Show file tree
Hide file tree
Showing 52 changed files with 1,395 additions and 513 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 = '0.9'
version = '1.0'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,21 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab
if (!tempPlayer.hasPermission("UselessClan.Admin")) return false;

if (args.length == 0) {
ChatSender.MessageTo(tempPlayer, "&4UselessClan","Use command /ClanAdmin help, for access to clan system");
ChatSender.MessageTo(tempPlayer, "&4UselessClan", "Main.ClanAdminCommandWithoutArgs");
return false;
}

CommandBase tempCommand = AdminClanCommands.getCommand(args[0]);
if (tempCommand == null) {
ChatSender.MessageTo(tempPlayer, "&4UselessClan",
"&cInvalid command. Use command &a/ClanAdmin help&c, for access to clan system");
ChatSender.MessageTo(tempPlayer, "&4UselessClan", "Main.InvalidClanAdminCommand");
return false;
}

if (!tempCommand.havePermission(sender)) {
ChatSender.MessageTo(tempPlayer, "&4UselessClan", "Main.InvalidPermissionToAdminCommand");
return false;
}

return tempCommand.executeCommand(sender, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab

OnlinePlayerClan SenderClan = UselessClan.getMainManager().getOnlineClanPlayers().get(tempPlayer);
if (SenderClan.getPlayerClan().getOnlineMembers().size() < 2) {
ChatSender.MessageTo(tempPlayer,"UselessClan",
"&cOnly you are online from you clan");
ChatSender.MessageTo(tempPlayer,"UselessClan", "Main.ZeroPlayerInClanChat");
return false;
}
// Only $maxLength length of message alloyed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import io.github.lofrol.UselessClan.ClanCommands.Commands.CommandBase;
import io.github.lofrol.UselessClan.ClanCommands.Commands.CommandsManager.BaseClanCommands;
import io.github.lofrol.UselessClan.ClanCommands.Commands.PlayerCommandBase;
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
Expand Down Expand Up @@ -33,15 +35,19 @@ public boolean execute(@NotNull CommandSender sender, @NotNull String commandLab
if (!(sender instanceof Player tempPlayer)) return false;

if (args.length == 0) {
ChatSender.MessageTo(tempPlayer,"UselessClan", "Use command &a/Clan help&b, for access to clan system");
ChatSender.MessageTo(tempPlayer,"UselessClan", "Main.ClanCommandWithoutArgs");
return false;
}

CommandBase tempCommand = BaseClanCommands.getCommand(args[0]);

if (tempCommand == null) {
ChatSender.MessageTo(tempPlayer, "UselessClan",
"&cInvalid command. Use command &a/Clan help&c, for access to clan system");
ChatSender.MessageTo(tempPlayer, "UselessClan", "Main.InvalidClanCommand");
return false;
}

if (!tempCommand.havePermission(sender)) {
ChatSender.MessageTo(tempPlayer, "UselessClan", "Main.InvalidPermissionToCommand");
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import org.bukkit.command.CommandSender;

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

@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,39 @@
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;

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

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
ChatSender.MessageTo(sender, "&4UselessClan","You forgot about clan %name, use /ClAd info %name, %name = name of clan");
}
else {
Clan foundClan = UselessClan.getMainManager().getServerClans().get(args[1]);
if (foundClan == null) {
ChatSender.MessageTo(sender, "&4UselessClan","&cThis clan didnt exist!");
return false;
}
ChatSender.MessageTo(sender,"UselessClan", String.format("&b### &cDEBUG &bCLAN %s INFO ###", foundClan.getPrefixClan()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Name: %s", foundClan.getNameClan()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Region: %s", foundClan.getClanRegionId()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Home: %s", foundClan.getHomeClan()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Prefix: %s", foundClan.getPrefixClan()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Level: %s", foundClan.getClanLevel()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# LeaderName: %s", foundClan.getLeaderName()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Count of Members: %s", foundClan.getMembers().size()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Count of Request: %s", foundClan.getRequestCount()));
ChatSender.MessageTo(sender,"UselessClan", String.format("# Money: %s", foundClan.getMoneyClan()));
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
import org.bukkit.command.CommandSender;

public class deleteAdminCommand extends CommandBase {
@Override
public boolean havePermission(CommandSender sender) {
return true;
}
@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,35 @@
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.ClanObjects.EClanRole;
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

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

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
ChatSender.MessageTo(sender, "&4UselessClan","You forgot about clan %name, use /ClAd info %name, %name = name of clan");
}
else {
Clan foundClan = UselessClan.getMainManager().getServerClans().get(args[1]);
if (foundClan == null) {
ChatSender.MessageTo(sender, "&4UselessClan","&cThis clan didnt exist!");
return false;
}

foundClan.PlayerJoinToClan(EClanRole.OFFICER, sender.getName());

ChatSender.MessageTo(sender,"&4UselessClan", String.format("&a You successfully join to clan %s!", foundClan.getPrefixClan()));
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@
import org.bukkit.command.CommandSender;

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

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
ChatSender.MessageTo(sender, "&4UselessClan","########## CLAN ADMIN HELP ##########");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd - to call this menu");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd list - list of all clans");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd info %name - to info any clan");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd debuginfo %name - to debug info any clan");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd mates %name - to mates any clan");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd delete %name - to info any clan");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd level %name %level - to force level any clan");
ChatSender.MessageTo(sender, "&4UselessClan","/ClAd join %name - to force join any clan");
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import org.bukkit.entity.Player;

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

@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,6 +7,11 @@
import org.bukkit.command.CommandSender;

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

@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 @@ -8,6 +8,11 @@
import org.bukkit.command.CommandSender;

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

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
Expand All @@ -25,7 +30,7 @@ else if (args.length == 2) {
}
int tempLevel = Integer.parseInt(args[2]);

if (tempLevel < 0 || tempLevel > ClanManager.ClanLevelColors.length) {
if (tempLevel < 0 || tempLevel > ClanManager.ClanLevelColors.size()) {
ChatSender.MessageTo(sender, "&4UselessClan","&cWrong level number!");
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
import org.bukkit.command.CommandSender;

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

@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 @@ -8,6 +8,11 @@
import org.bukkit.command.CommandSender;

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

@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,35 @@
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.ClanObjects.ClanMember;
import io.github.lofrol.UselessClan.UselessClan;
import io.github.lofrol.UselessClan.Utils.ChatSender;
import org.bukkit.command.CommandSender;

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

@Override
public boolean executeCommand(CommandSender sender, String[] args) {
if (args.length == 1) {
ChatSender.MessageTo(sender, "&4UselessClan","You forgot about clan %name, use /ClAd mates %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;
}
ChatSender.MessageTo(sender,"UselessClan", "########## CLANREQUESTS ##########");
for (var tempMember : findedClan.getRequests()) {
ChatSender.MessageTo(sender,"UselessClan", String.format(
"# &a%s", tempMember));
}
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
public abstract class CommandBase {
public abstract boolean executeCommand(CommandSender sender, String[] args);

public abstract boolean havePermission(CommandSender sender);

}


Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@

public class AdminClanCommands {
private static final Map<String, CommandBase> ClanCommands = Map.ofEntries(
entry("help", new helpAdminCommand()),
entry("list", new listAdminCommand()),
entry("info", new infoAdminCommand()),
entry("mates", new matesAdminCommand()),
entry("delete", new deleteAdminCommand()),
entry("home", new homeAdminCommand()),
entry("calclvl", new calclvlAdminCommand()),
entry("level", new levelAdminCommand())
entry("help", new helpAdminCommand()),
entry("list", new listAdminCommand()),
entry("info", new infoAdminCommand()),
entry("mates", new matesAdminCommand()),
entry("requests", new requestsAdminCommand()),
entry("delete", new deleteAdminCommand()),
entry("home", new homeAdminCommand()),
entry("calclvl", new calclvlAdminCommand()),
entry("level", new levelAdminCommand()),
entry("debuginfo", new debugInfoAdminCommand()),
entry("forcejoin", new forceJoinAdminCommand())
);

public static CommandBase getCommand(String key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class BaseClanCommands {
entry("info", new infoUserCommand()),
entry("mates", new matesUserCommand()),
entry("accept", new acceptUserCommand()),
entry("decline", new declineUserCommand()),
entry("join", new joinUserCommand()),
entry("kick", new kickUserCommand()),
entry("promote", new promoteUserCommand()),
Expand Down
Loading

0 comments on commit 5bc21a9

Please sign in to comment.