mirror of
https://github.com/RoinujNosde/SimpleClans.git
synced 2026-11-05 01:10:04 -05:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c457ce552 | ||
|
|
8fa465da38 | ||
|
|
56c7908c33 | ||
|
|
fc81e76521 | ||
|
|
f7fe5c4ad4 | ||
|
|
8f4f763c37 | ||
|
|
7a37382264 | ||
|
|
7f9d133051 | ||
|
|
26ba9f7329 | ||
|
|
d8cb61b0fc | ||
|
|
3f1b06dcf9 | ||
|
|
b043eb0742 |
No files matched your search
@@ -4,7 +4,7 @@
|
||||
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<name>SimpleClans</name>
|
||||
<version>2.17.1-SNAPSHOT</version>
|
||||
<version>2.18.1-SNAPSHOT</version>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
<build>
|
||||
<resources>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
|
||||
<artifactId>SimpleClans</artifactId>
|
||||
<version>2.18.0</version>
|
||||
<version>2.18.1-SNAPSHOT</version>
|
||||
<name>SimpleClans</name>
|
||||
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
|
||||
|
||||
|
||||
@@ -6,11 +6,16 @@ import net.sacredlabyrinth.phaed.simpleclans.ChatBlock;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.Clan;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.commands.data.*;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryDrawer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.CoordsFrame;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.RosterFrame;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.VanishUtils;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
|
||||
import static org.bukkit.ChatColor.RED;
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@@ -18,6 +23,8 @@ import static org.bukkit.ChatColor.RED;
|
||||
public class DataCommands extends BaseCommand {
|
||||
@Dependency
|
||||
private SimpleClans plugin;
|
||||
@Dependency
|
||||
private SettingsManager settings;
|
||||
|
||||
@Subcommand("%vitals")
|
||||
@CommandPermission("simpleclans.member.vitals")
|
||||
@@ -49,6 +56,10 @@ public class DataCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.member.roster")
|
||||
@Description("{@@command.description.roster}")
|
||||
public void roster(Player player, Clan clan) {
|
||||
if (settings.is(ENABLE_GUI)) {
|
||||
InventoryDrawer.open(new RosterFrame(player, null, clan));
|
||||
return;
|
||||
}
|
||||
ClanRoster r = new ClanRoster(plugin, player, clan);
|
||||
r.send();
|
||||
}
|
||||
@@ -59,6 +70,10 @@ public class DataCommands extends BaseCommand {
|
||||
@HelpSearchTags("local location")
|
||||
@Description("{@@command.description.coords}")
|
||||
public void coords(Player player, Clan clan) {
|
||||
if (settings.is(ENABLE_GUI)) {
|
||||
InventoryDrawer.open(new CoordsFrame(player, null, clan));
|
||||
return;
|
||||
}
|
||||
if (VanishUtils.getNonVanished(player, clan).size() == 1) {
|
||||
ChatBlock.sendMessage(player, RED + lang("you.are.the.only.member.online", player));
|
||||
return;
|
||||
|
||||
@@ -18,7 +18,7 @@ import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.Con
|
||||
|
||||
@CommandAlias("%clan")
|
||||
@Subcommand("%land")
|
||||
@Conditions("%basic_conditions|land_sharing|own_land")
|
||||
@Conditions("%basic_conditions|clan_member|land_sharing|own_land")
|
||||
@CommandPermission("simpleclans.member.land")
|
||||
public class LandCommand extends BaseCommand {
|
||||
|
||||
|
||||
+5
-1
@@ -198,8 +198,8 @@ public class LeaderCommands extends BaseCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
double amount = settings.getDouble(ECONOMY_DISCORD_CREATION_PRICE);
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
double amount = settings.getDouble(ECONOMY_DISCORD_CREATION_PRICE);
|
||||
if (!permissions.playerHasMoney(player, amount)) {
|
||||
player.sendMessage(AQUA + lang("not.sufficient.money", player, amount));
|
||||
return;
|
||||
@@ -214,6 +214,10 @@ public class LeaderCommands extends BaseCommand {
|
||||
discordHook.createChannel(clan.getTag());
|
||||
ChatBlock.sendMessageKey(player, "discord.created.successfully");
|
||||
} catch (DiscordHookException ex) {
|
||||
// Return player's money if clan creation went wrong
|
||||
if (settings.is(ECONOMY_PURCHASE_DISCORD_CREATE)) {
|
||||
permissions.playerGrantMoney(player, amount);
|
||||
}
|
||||
String messageKey = ex.getMessageKey();
|
||||
if (messageKey != null) {
|
||||
ChatBlock.sendMessage(player, RED + lang(messageKey));
|
||||
|
||||
+25
-2
@@ -20,7 +20,8 @@ import net.sacredlabyrinth.phaed.simpleclans.managers.RequestManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.managers.StorageManager;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.InventoryDrawer;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.MainFrame;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.ui.frames.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -28,6 +29,7 @@ import java.text.MessageFormat;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.conversation.CreateClanNamePrompt.NAME_KEY;
|
||||
@@ -85,6 +87,10 @@ public class GeneralCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.anyone.leaderboard")
|
||||
@Description("{@@command.description.leaderboard}")
|
||||
public void leaderboard(CommandSender sender) {
|
||||
if (settings.is(ENABLE_GUI) && sender instanceof Player) {
|
||||
InventoryDrawer.open(new LeaderboardFrame((Player) sender, null));
|
||||
return;
|
||||
}
|
||||
Leaderboard l = new Leaderboard(plugin, sender);
|
||||
l.send();
|
||||
}
|
||||
@@ -94,7 +100,12 @@ public class GeneralCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.anyone.lookup")
|
||||
@Description("{@@command.description.lookup.other}")
|
||||
public void lookup(CommandSender sender, @Name("player") ClanPlayerInput player) {
|
||||
Lookup l = new Lookup(plugin, sender, player.getClanPlayer().getUniqueId());
|
||||
UUID uuid = player.getClanPlayer().getUniqueId();
|
||||
if (settings.is(ENABLE_GUI) && sender instanceof Player) {
|
||||
InventoryDrawer.open(new PlayerDetailsFrame((Player) sender, null, Bukkit.getOfflinePlayer(uuid)));
|
||||
return;
|
||||
}
|
||||
Lookup l = new Lookup(plugin, sender, uuid);
|
||||
l.send();
|
||||
}
|
||||
|
||||
@@ -102,6 +113,10 @@ public class GeneralCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.member.lookup")
|
||||
@Description("{@@command.description.lookup}")
|
||||
public void lookup(Player sender) {
|
||||
if (settings.is(ENABLE_GUI)) {
|
||||
InventoryDrawer.open(new PlayerDetailsFrame(sender, null, sender));
|
||||
return;
|
||||
}
|
||||
Lookup l = new Lookup(plugin, sender, sender.getUniqueId());
|
||||
l.send();
|
||||
}
|
||||
@@ -134,6 +149,10 @@ public class GeneralCommands extends BaseCommand {
|
||||
@CommandPermission("simpleclans.anyone.roster")
|
||||
@Description("{@@command.description.roster.other}")
|
||||
public void roster(CommandSender sender, @Conditions("verified") @Name("clan") ClanInput clan) {
|
||||
if (settings.is(ENABLE_GUI) && sender instanceof Player) {
|
||||
InventoryDrawer.open(new RosterFrame(((Player) sender), null, clan.getClan()));
|
||||
return;
|
||||
}
|
||||
ClanRoster r = new ClanRoster(plugin, sender, clan.getClan());
|
||||
r.send();
|
||||
}
|
||||
@@ -267,6 +286,10 @@ public class GeneralCommands extends BaseCommand {
|
||||
@CommandCompletion("@clan_list_type @order")
|
||||
public void list(CommandSender sender, @Optional @Values("@clan_list_type") String type,
|
||||
@Optional @Single @Values("@order") String order) {
|
||||
if (settings.is(ENABLE_GUI) && sender instanceof Player) {
|
||||
InventoryDrawer.open(new ClanListFrame(null, (Player) sender));
|
||||
return;
|
||||
}
|
||||
ClanList list = new ClanList(plugin, sender, type, order);
|
||||
list.send();
|
||||
}
|
||||
|
||||
@@ -50,12 +50,16 @@ public class HomeRegroupEvent extends Event implements Cancellable {
|
||||
public HandlerList getHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
|
||||
public static HandlerList getHandlerList() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return cancelled;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancel) {
|
||||
cancelled = cancel;
|
||||
|
||||
@@ -639,7 +639,7 @@ public class DiscordHook implements Listener {
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
private boolean createChannelSilently(ClanPlayer clanPlayer) {
|
||||
Clan clan = clanPlayer.getClan();
|
||||
if (clan == null) {
|
||||
if (clan == null || !settingsManager.is(DISCORDCHAT_AUTO_CREATION)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
|
||||
@@ -36,8 +37,8 @@ import static org.bukkit.ChatColor.RED;
|
||||
public final class ClanManager {
|
||||
|
||||
private final SimpleClans plugin;
|
||||
private final HashMap<String, Clan> clans = new HashMap<>();
|
||||
private final HashMap<UUID, ClanPlayer> clanPlayers = new HashMap<>();
|
||||
private final ConcurrentHashMap<String, Clan> clans = new ConcurrentHashMap<>();
|
||||
private final ConcurrentHashMap<UUID, ClanPlayer> clanPlayers = new ConcurrentHashMap<>();
|
||||
private final HashMap<ClanPlayer, List<Kill>> kills = new HashMap<>();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.sacredlabyrinth.phaed.simpleclans.Rank;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
|
||||
import net.sacredlabyrinth.phaed.simpleclans.utils.ChatUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -252,13 +251,16 @@ public final class SettingsManager {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public @NotNull Collection<Rank> getStarterRanks() {
|
||||
List<Rank> ranks = new ArrayList<>();
|
||||
ConfigurationSection section = config.getConfigurationSection("clan.starter-ranks");
|
||||
if (section != null) {
|
||||
for (String name : section.getKeys(false)) {
|
||||
String displayName = section.getString(name + ".display-name");
|
||||
List<String> permissions = section.getStringList(name + ".permissions");
|
||||
List<Map<?, ?>> mapList = config.getMapList("clan.starter-ranks");
|
||||
for (Map<?, ?> rankMap : mapList) {
|
||||
Set<String> names = (Set<String>) rankMap.keySet();
|
||||
for (String name : names) {
|
||||
Map<String, Object> rank = (Map<String, Object>) rankMap.get(name);
|
||||
String displayName = (String) rank.get("display-name");
|
||||
List<String> permissions = (List<String>) rank.get("permissions");
|
||||
ranks.add(new Rank(name, displayName, new HashSet<>(permissions)));
|
||||
}
|
||||
}
|
||||
@@ -398,8 +400,8 @@ public final class SettingsManager {
|
||||
ECONOMY_PURCHASE_HOME_TELEPORT_SET("economy.purchase-home-teleport-set", false),
|
||||
ECONOMY_REGROUP_PRICE("economy.home-regroup-price", 5.0),
|
||||
ECONOMY_PURCHASE_HOME_REGROUP("economy.purchase-home-regroup", false),
|
||||
ECONOMY_PURCHASE_DISCORD_CREATE("purchase-discord-create", false),
|
||||
ECONOMY_DISCORD_CREATION_PRICE("discord-creation-price", 1000.0),
|
||||
ECONOMY_PURCHASE_DISCORD_CREATE("economy.purchase-discord-create", false),
|
||||
ECONOMY_DISCORD_CREATION_PRICE("economy.discord-creation-price", 1000.0),
|
||||
ECONOMY_UNIQUE_TAX_ON_REGROUP("economy.unique-tax-on-regroup", true),
|
||||
ECONOMY_ISSUER_PAYS_REGROUP("economy.issuer-pays-regroup", true),
|
||||
ECONOMY_MONEY_PER_KILL("economy.money-per-kill", false),
|
||||
|
||||
@@ -23,9 +23,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public final class BungeeManager implements ProxyManager, PluginMessageListener {
|
||||
@@ -40,6 +38,7 @@ public final class BungeeManager implements ProxyManager, PluginMessageListener
|
||||
private final Gson gson;
|
||||
private final List<String> onlinePlayers = new ArrayList<>();
|
||||
private String serverName = "";
|
||||
private final Set<String> unknownChannels = new HashSet<>();
|
||||
|
||||
public BungeeManager(SimpleClans plugin) {
|
||||
this.plugin = plugin;
|
||||
@@ -61,13 +60,18 @@ public final class BungeeManager implements ProxyManager, PluginMessageListener
|
||||
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player, byte[] data) {
|
||||
ByteArrayDataInput input = ByteStreams.newDataInput(data);
|
||||
String subChannel = input.readUTF();
|
||||
|
||||
if (unknownChannels.contains(subChannel)) {
|
||||
return;
|
||||
}
|
||||
SimpleClans.debug("Message received, sub-channel: " + subChannel);
|
||||
try {
|
||||
Class<?> clazz = Class.forName("net.sacredlabyrinth.phaed.simpleclans.proxy.listeners." + subChannel);
|
||||
MessageListener listener = (MessageListener) clazz.getConstructor(BungeeManager.class).newInstance(this);
|
||||
listener.accept(input);
|
||||
SimpleClans.debug("Message processed");
|
||||
} catch (ClassNotFoundException e) {
|
||||
SimpleClans.debug(String.format("Unknown channel: %s", subChannel));
|
||||
unknownChannels.add(subChannel);
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
plugin.getLogger().log(Level.SEVERE, String.format("Error processing channel %s", subChannel), ex);
|
||||
}
|
||||
@@ -182,7 +186,9 @@ public final class BungeeManager implements ProxyManager, PluginMessageListener
|
||||
|
||||
@SuppressWarnings("UnstableApiUsage")
|
||||
private void forwardPluginMessage(final String subChannel, final String message, final boolean all) {
|
||||
SimpleClans.debug(String.format("Forwarding message, channel %s, message %s, all %s", subChannel, message, all));
|
||||
if (!isChannelRegistered()) {
|
||||
SimpleClans.debug("Not registered");
|
||||
return;
|
||||
}
|
||||
String target = all ? "ALL" : "ONLINE";
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ public class ConfigurationSerializableAdapter implements TypeAdapterFactory {
|
||||
return null;
|
||||
}
|
||||
Map map = adapter.read(in);
|
||||
return ConfigurationSerialization.deserializeObject(map);
|
||||
return ConfigurationSerialization.deserializeObject(map,
|
||||
(Class<? extends ConfigurationSerializable>) type.getRawType());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public abstract class Update<T> extends MessageListener {
|
||||
T current = getCurrent(t);
|
||||
if (current == null) {
|
||||
insert(t);
|
||||
debug(String.format("Inserted %s", t));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
|
||||
@@ -156,13 +156,13 @@ clan:
|
||||
min-size-to-set-ally: 3
|
||||
min-to-verify: 1
|
||||
starter-ranks:
|
||||
recruit:
|
||||
- recruit:
|
||||
display-name: "&7Recruit"
|
||||
permissions: [ stats, kills, mostkilled, rank.list ]
|
||||
ambassador:
|
||||
- ambassador:
|
||||
display-name: "&bAmbassador"
|
||||
permissions: [ ally.chat, ally.add, ally.remove, rival.add, rival.remove, war.end, war.start ]
|
||||
treasurer:
|
||||
- treasurer:
|
||||
display-name: "&6Treasurer"
|
||||
permissions: [ bank.balance, bank.deposit, bank.withdraw ]
|
||||
|
||||
|
||||
Reference in new issue
Block a user