Skip to content

Commit

Permalink
Merge branch 'RoinujNosde:master' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock authored Jun 24, 2024
2 parents 3d9b136 + 3b51299 commit d89e7c3
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ Feel free to learn our [Javadoc](https://ci.roinujnosde.me/job/SimpleClans/Javad
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.roinujnosde.me%2Freleases%2Fnet%2Fsacredlabyrinth%2Fphaed%2Fsimpleclans%2FSimpleClans%2Fmaven-metadata.xml)](https://repo.roinujnosde.me/#/releases/net/sacredlabyrinth/phaed/simpleclans/SimpleClans)
##### API Examples
* [Examples of how to use the API](https://simpleclans.gitbook.io/simpleclans/other/simpleclans-api)


[![Mikasa Host](https://mikasa.host/images/partners/banners/SimpleClans.gif)](https://mikasa.host/ref/6)
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import java.util.*;

import static net.sacredlabyrinth.phaed.simpleclans.SimpleClans.lang;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.CLAN_MAX_MEMBERS;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.REQUEST_FREQUENCY;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static org.bukkit.ChatColor.RED;

/**
Expand Down Expand Up @@ -225,7 +224,7 @@ public void processInvite(Request req, VoteResult vote) {

if (vote.equals(VoteResult.ACCEPT)) {
ClanPlayer cp = plugin.getClanManager().getCreateClanPlayer(invited.getUniqueId());
int maxMembers = plugin.getSettingsManager().getInt(CLAN_MAX_MEMBERS);
int maxMembers = !clan.isVerified() ? plugin.getSettingsManager().getInt(CLAN_UNVERIFIED_MAX_MEMBERS) : plugin.getSettingsManager().getInt(CLAN_MAX_MEMBERS);

if (maxMembers > 0 && maxMembers > clan.getSize()) {
ChatBlock.sendMessageKey(invited, "accepted.invitation", clan.getName());
Expand All @@ -241,6 +240,7 @@ public void processInvite(Request req, VoteResult vote) {
}
}


public void processResults(Request req) {
Clan requestClan = req.getClan();
ClanPlayer requester = req.getRequester();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ public enum ConfigField {
CLAN_MAX_DESCRIPTION_LENGTH("clan.max-description-length", 120),
CLAN_MIN_DESCRIPTION_LENGTH("clan.min-description-length", 10),
CLAN_MAX_MEMBERS("clan.max-members", 25),
CLAN_UNVERIFIED_MAX_MEMBERS("clan.unverified-max-members", 10),
CLAN_MAX_ALLIANCES("clan.max-alliances", -1),
CLAN_CONFIRMATION_FOR_PROMOTE("clan.confirmation-for-promote", false),
CLAN_TRUST_MEMBERS_BY_DEFAULT("clan.trust-members-by-default", false),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,9 @@ private void purgeClans(List<Clan> clans) {

for (Clan clan : purge) {
plugin.getLogger().info(lang("purging.clan", clan.getName()));
for (ClanPlayer member : clan.getMembers()) {
clan.removePlayerFromClan(member.getUniqueId());
}
deleteClan(clan);
clans.remove(clan);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,19 @@ public static void open(@Nullable SCFrame frame) {
return;
}

OPENING.put(uuid, frame);
FrameOpenEvent event = new FrameOpenEvent(frame.getViewer(), frame);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
OPENING.put(uuid, frame);
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
Inventory inventory = prepareInventory(frame);
Inventory inventory = prepareInventory(frame);

if (!frame.equals(OPENING.get(uuid))) {
return;
}
Bukkit.getScheduler().runTask(plugin, () -> {
FrameOpenEvent event = new FrameOpenEvent(frame.getViewer(), frame);
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
frame.getViewer().openInventory(inventory);
InventoryController.register(frame);
OPENING.remove(uuid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private static void setOneTimeUseListener(SCComponent c, @Nullable Runnable list
@SuppressWarnings("deprecation")
public static void setOwningPlayer(@NotNull ItemStack item, @NotNull OfflinePlayer player) {
SkullMeta itemMeta = (SkullMeta) item.getItemMeta();
if (itemMeta == null) {
if (itemMeta == null || player.getName() == null) {
return;
}
try {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ clan:
max-description-length: 120
min-description-length: 10
max-members: 25
unverified-max-members: 10
confirmation-for-promote: false
trust-members-by-default: false
confirmation-for-demote: false
Expand Down

0 comments on commit d89e7c3

Please sign in to comment.