Compare commits

..
5 changed files with 17 additions and 30 deletions

No files matched your search

-15
View File
@@ -1,20 +1,5 @@
# Changelog
## [2.19.2](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.1...v2.19.2) (2023-08-03)
### Bug Fixes
* cause check should return true on granting ([#397](https://github.com/RoinujNosde/SimpleClans/issues/397)) ([f29bc74](https://github.com/RoinujNosde/SimpleClans/commit/f29bc746af4940b493ebc43b1e25ff0fc00ab8d0))
## [2.19.1](https://github.com/RoinujNosde/SimpleClans/compare/v2.19.0...v2.19.1) (2023-08-03)
### Bug Fixes
* charge money on deposit ([#394](https://github.com/RoinujNosde/SimpleClans/issues/394)) ([fe60b25](https://github.com/RoinujNosde/SimpleClans/commit/fe60b25f6107281a9771f6498400c3f8ce81c916))
* consider uppercase when checking for disallowed colors ([#391](https://github.com/RoinujNosde/SimpleClans/issues/391)) ([503d679](https://github.com/RoinujNosde/SimpleClans/commit/503d67903e386b1c4b6eb7903a1addbfd42a684a))
## [2.19.0](https://github.com/RoinujNosde/SimpleClans/compare/v2.18.1...v2.19.0) (2023-07-27)
+3 -2
View File
@@ -1,8 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.19.2</version>
<version>2.19.1-SNAPSHOT</version>
<name>SimpleClans</name>
<url>https://www.spigotmc.org/resources/simpleclans.71242/</url>
@@ -113,7 +113,7 @@ public class Clan implements Serializable, Comparable<Clan> {
@Deprecated
public void deposit(double amount, Player player) {
if (SimpleClans.getInstance().getPermissionsManager().playerHasMoney(player, amount)) {
if (SimpleClans.getInstance().getPermissionsManager().chargePlayer(player, amount)) {
if (SimpleClans.getInstance().getPermissionsManager().grantPlayer(player, amount)) {
player.sendMessage(AQUA + lang("player.clan.deposit", player, amount));
addBb(player.getName(), lang("bb.clan.deposit", amount));
setBalance(getBalance() + amount);
@@ -267,10 +267,8 @@ public final class PermissionsManager {
*/
public boolean grantPlayer(@NotNull OfflinePlayer player, double money, @Nullable Cause cause) {
EconomyResponse response = Objects.requireNonNull(economy, "Can't find economy provider").depositPlayer(player, money);
if (!response.transactionSuccess()) {
if (!response.transactionSuccess() || cause == null) {
return false;
} else if (cause == null) {
return true;
}
EconomyTransactionEvent event = new EconomyTransactionEvent(player, response.amount, cause, EconomyTransactionEvent.TransactionType.DEPOSIT);
@@ -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.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
@@ -13,7 +12,6 @@ import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import static net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager.ConfigField.*;
import static net.sacredlabyrinth.phaed.simpleclans.utils.RankingNumberResolver.RankingType;
@@ -91,8 +89,8 @@ public final class SettingsManager {
if (configFile.exists()) {
try {
config.load(configFile);
} catch (IOException | InvalidConfigurationException ex) {
SimpleClans.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex);
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -102,8 +100,8 @@ public final class SettingsManager {
public void save() {
try {
config.save(configFile);
} catch (IOException ex) {
SimpleClans.getInstance().getLogger().log(Level.SEVERE, ex.getMessage(), ex);
} catch (IOException e) {
e.printStackTrace();
}
}
@@ -117,7 +115,7 @@ public final class SettingsManager {
" that matches their clan tag.");
}
if (discordSrv == null && is(DISCORDCHAT_ENABLE)) {
if (discordSrv == null && is (DISCORDCHAT_ENABLE)) {
plugin.getLogger().warning("DiscordChat can't be initialized, please, install DiscordSRV.");
}
}
@@ -170,8 +168,13 @@ public final class SettingsManager {
* @return whether the string contains the color code
*/
public boolean hasDisallowedColor(String str) {
var loweredString = str.toLowerCase();
return getStringList(DISALLOWED_TAG_COLORS).stream().map(String::toLowerCase).anyMatch(color -> loweredString.contains("&" + color));
for (String disallowedTag : getStringList(DISALLOWED_TAG_COLORS)) {
if (str.contains("&" + disallowedTag)) {
return true;
}
}
return false;
}
/**