Compare commits

...
8 Commits
Author SHA1 Message Date
RoinujNosde ac0a387198 Removed kdr-exempt from anyone.*
Closes #561
2020-04-02 07:35:59 -03:00
Edson Passos e3cd7d37a8 Merge pull request #559 from xtomyserrax/patch-1
Added check for null home on regroup
2020-03-31 07:58:22 -03:00
Edson Passos 63595258f4 Removed wrong message 2020-03-31 07:48:21 -03:00
xtomyserrax 0c866044df /clan home command fixes
- Fixes this error when there is no home set for the clan (I just copied and pasted the loc == null statement): https://pastebin.com/jiXneTvK

Also can you please fix this placeholder? I dont want to touch anything there as maybe it breaks some stuff or it meant to be something: https://imgur.com/a/KWPDTk7
It says: "Clan home-base set to: {0}" + Location. I guess the 0 meant to be the location? Maybe adding a replace would fix it, unless the idea was to make something else.

Thanks for the awesome plugin and sorry for making another merge for the same, I just noticed it! 

Also another idea, what if instead of saying Insufficient Permission when you write a command wrongly it sends a usage message? For example, if I type /clan home tp, I get a no permission message, if I write /clan home tp test, then I go to the home of test clan. 

Thanks!
2020-03-30 22:45:34 -03:00
Edson Passos 2217efa8a7 Merge pull request #558 from xtomyserrax/patch-1
Fix bypassing /clan home regroup
2020-03-30 21:22:49 -03:00
xtomyserrax df97e43c4d Fix bypassing /clan home regroup
Clan members can use /clan home regroup without being leaders and also without having the permission simpleclans.leader.home-regroup

Just added a return statement to both conditionals.
2020-03-30 21:05:03 -03:00
RoinujNosde 169b44e793 Added permission for using colors/formats on setrank
Closes #548
2020-03-26 20:19:45 -03:00
RoinujNosde f2303c5336 Allow server owners to edit the time to collect member fee and upkeep
Closes #543
2020-03-25 20:13:35 -03:00
14 changed files with 147 additions and 27 deletions

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.sacredlabyrinth.phaed.simpleclans</groupId>
<artifactId>SimpleClans</artifactId>
<version>2.8.2</version>
<version>2.8.3</version>
<name>SimpleClans</name>
<url>http://dev.bukkit.org/server-mods/simpleclans/</url>
@@ -73,8 +73,10 @@ public class Helper {
* @return the delay in seconds
*/
public static long getDelayTo(int hour, int minute) {
if (hour < 0 || hour > 23) hour = 1;
if (minute < 0 || minute > 59) minute = 0;
LocalDateTime now = LocalDateTime.now();
LocalDateTime d = LocalDateTime.of(now.toLocalDate(), LocalTime.of(1, 0));
LocalDateTime d = LocalDateTime.of(now.toLocalDate(), LocalTime.of(hour, minute));
long delay;
if (now.isAfter(d)) {
delay = now.until(d.plusDays(1), ChronoUnit.SECONDS);
@@ -631,7 +633,7 @@ public class Helper {
}
return result;
}
public static boolean isVanished(Player player) {
if (player != null && player.hasMetadata("vanished") && !player.getMetadata("vanished").isEmpty()) {
return player.getMetadata("vanished").get(0).asBoolean();
@@ -639,7 +641,8 @@ public class Helper {
return false;
}
public static Collection<Player> getOnlinePlayers() {
@SuppressWarnings("unchecked")
public static Collection<Player> getOnlinePlayers() {
try {
Method method = Bukkit.class.getDeclaredMethod("getOnlinePlayers");
Object players = method.invoke(null);
@@ -165,9 +165,16 @@ public class HomeCommand {
if (!cp.isLeader()) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.leader.permissions"));
return;
}
if (!plugin.getPermissionsManager().has(player, "simpleclans.leader.home-regroup")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions"));
return;
}
if (loc == null) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("hombase.not.set"));
return;
}
HomeRegroupEvent homeRegroupEvent = new HomeRegroupEvent(clan, cp, clan.getOnlineMembers(), loc);
@@ -200,7 +207,6 @@ public class HomeCommand {
plugin.getTeleportManager().addPlayer(player, new Location(loc.getWorld(), x + .5, loc.getBlockY(), z + .5), clan.getName());
}
ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("hombase.set") + ChatColor.YELLOW + Helper.toLocationString(loc));
return;
}
@@ -49,13 +49,17 @@ public class SetRankCommand {
return;
}
UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]);
String rank = Helper.toMessage(Helper.removeFirst(arg));
UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]);
if (uuid == null || (!clan.isMember(uuid) && !clan.isLeader(uuid))) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched"));
return;
}
String rank = Helper.toMessage(Helper.removeFirst(arg));
if (rank.contains("&") && !plugin.getPermissionsManager().has(player, "simpleclans.leader.coloredrank")) {
ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("you.cannot.set.colored.ranks"));
return;
}
ClanPlayer cpm = plugin.getClanManager().getClanPlayer(uuid);
cpm.setRank(rank);
@@ -1,17 +1,17 @@
package net.sacredlabyrinth.phaed.simpleclans.managers;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
import org.bukkit.configuration.file.FileConfiguration;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import org.bukkit.configuration.file.FileConfiguration;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.uuid.UUIDMigration;
/**
* @author phaed
*/
@@ -146,6 +146,12 @@ public final class SettingsManager {
private String clanChatBracketColor;
private String clanChatPlayerBracketLeft;
private String clanChatPlayerBracketRight;
private int tasksCollectUpkeepHour;
private int tasksCollectUpkeepMinute;
private int tasksCollectUpkeepWarningHour;
private int tasksCollectUpkeepWarningMinute;
private int tasksCollectFeeHour;
private int tasksCollectFeeMinute;
private boolean clanFFOnByDefault;
private double kwRival;
private double kwNeutral;
@@ -344,6 +350,12 @@ public final class SettingsManager {
clanChatTagBracketRight = getConfig().getString("clanchat.tag-bracket.right");
clanChatPlayerBracketLeft = getConfig().getString("clanchat.player-bracket.left");
clanChatPlayerBracketRight = getConfig().getString("clanchat.player-bracket.right");
tasksCollectFeeHour = getConfig().getInt("tasks.collect-fee.hour");
tasksCollectFeeMinute = getConfig().getInt("tasks.collect-fee.minute");
tasksCollectUpkeepHour = getConfig().getInt("tasks.collect-upkeep.hour");
tasksCollectUpkeepMinute = getConfig().getInt("tasks.collect-upkeep.minute");
tasksCollectUpkeepWarningHour = getConfig().getInt("tasks.collect-upkeep-warning.hour");
tasksCollectUpkeepWarningMinute = getConfig().getInt("tasks.collect-upkeep-warning.minute");
kwRival = getConfig().getDouble("kill-weights.rival");
kwNeutral = getConfig().getDouble("kill-weights.neutral");
kwCivilian = getConfig().getDouble("kill-weights.civilian");
@@ -389,7 +401,55 @@ public final class SettingsManager {
}
}
/**
public int getTasksCollectUpkeepHour() {
return tasksCollectUpkeepHour;
}
public void setTasksCollectUpkeepHour(int tasksCollectUpkeepHour) {
this.tasksCollectUpkeepHour = tasksCollectUpkeepHour;
}
public int getTasksCollectUpkeepMinute() {
return tasksCollectUpkeepMinute;
}
public void setTasksCollectUpkeepMinute(int tasksCollectUpkeepMinute) {
this.tasksCollectUpkeepMinute = tasksCollectUpkeepMinute;
}
public int getTasksCollectUpkeepWarningHour() {
return tasksCollectUpkeepWarningHour;
}
public void setTasksCollectUpkeepWarningHour(int tasksCollectUpkeepWarningHour) {
this.tasksCollectUpkeepWarningHour = tasksCollectUpkeepWarningHour;
}
public int getTasksCollectUpkeepWarningMinute() {
return tasksCollectUpkeepWarningMinute;
}
public void setTasksCollectUpkeepWarningMinute(int tasksCollectUpkeepWarningMinute) {
this.tasksCollectUpkeepWarningMinute = tasksCollectUpkeepWarningMinute;
}
public int getTasksCollectFeeHour() {
return tasksCollectFeeHour;
}
public void setTasksCollectFeeHour(int tasksCollectFeeHour) {
this.tasksCollectFeeHour = tasksCollectFeeHour;
}
public int getTasksCollectFeeMinute() {
return tasksCollectFeeMinute;
}
public void setTasksCollectFeeMinute(int tasksCollectFeeMinute) {
this.tasksCollectFeeMinute = tasksCollectFeeMinute;
}
/**
* Returns the delay between kills
*
* @return
@@ -11,18 +11,28 @@ import net.sacredlabyrinth.phaed.simpleclans.Clan;
import net.sacredlabyrinth.phaed.simpleclans.ClanPlayer;
import net.sacredlabyrinth.phaed.simpleclans.Helper;
import net.sacredlabyrinth.phaed.simpleclans.SimpleClans;
import net.sacredlabyrinth.phaed.simpleclans.managers.SettingsManager;
/**
*
* @author roinujnosde
*/
public class CollectFeeTask extends BukkitRunnable {
private final SimpleClans plugin;
public CollectFeeTask() {
plugin = SimpleClans.getInstance();
}
/**
* Starts the repetitive task
*/
public void start() {
long delay = Helper.getDelayTo(1, 0);
SettingsManager sm = plugin.getSettingsManager();
int hour = sm.getTasksCollectFeeHour();
int minute = sm.getTasksCollectFeeMinute();
long delay = Helper.getDelayTo(hour, minute);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
}
@@ -32,8 +42,6 @@ public class CollectFeeTask extends BukkitRunnable {
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
for (Clan clan : plugin.getClanManager().getClans()) {
final double memberFee = clan.getMemberFee();
@@ -12,12 +12,21 @@ import org.bukkit.scheduler.BukkitRunnable;
* @author roinujnosde
*/
public class CollectUpkeepTask extends BukkitRunnable {
private final SimpleClans plugin;
private final SettingsManager settingsManager;
public CollectUpkeepTask() {
plugin = SimpleClans.getInstance();
settingsManager = plugin.getSettingsManager();
}
/**
* Starts the repetitive task
*/
public void start() {
long delay = Helper.getDelayTo(1, 30);
int hour = settingsManager.getTasksCollectUpkeepHour();
int minute = settingsManager.getTasksCollectUpkeepMinute();
long delay = Helper.getDelayTo(hour, minute);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
}
@@ -27,9 +36,10 @@ public class CollectUpkeepTask extends BukkitRunnable {
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
final SettingsManager settingsManager = plugin.getSettingsManager();
plugin.getClanManager().getClans().forEach((clan) -> {
if (plugin == null) {
throw new IllegalStateException("Use the start() method!");
}
plugin.getClanManager().getClans().forEach((clan) -> {
if (settingsManager.isChargeUpkeepOnlyIfMemberFeeEnabled() && !clan.isMemberFeeEnabled()) {
return;
}
@@ -11,15 +11,24 @@ import org.bukkit.scheduler.BukkitRunnable;
* @author roinujnosde
*/
public class UpkeepWarningTask extends BukkitRunnable {
private final SimpleClans plugin;
private final SettingsManager sm;
public UpkeepWarningTask() {
plugin = SimpleClans.getInstance();
sm = plugin.getSettingsManager();
}
/**
* Starts the repetitive task
*
*/
public void start() {
long delay = Helper.getDelayTo(12, 0);
this.runTaskTimerAsynchronously(SimpleClans.getInstance(), delay * 20, 86400 * 20);
int hour = sm.getTasksCollectUpkeepWarningHour();
int minute = sm.getTasksCollectUpkeepWarningMinute();
long delay = Helper.getDelayTo(hour, minute);
this.runTaskTimerAsynchronously(plugin, delay * 20, 86400 * 20);
}
/**
@@ -27,8 +36,9 @@ public class UpkeepWarningTask extends BukkitRunnable {
*/
@Override
public void run() {
final SimpleClans plugin = SimpleClans.getInstance();
final SettingsManager sm = plugin.getSettingsManager();
if (plugin == null) {
throw new IllegalStateException("Use the start() method!");
}
plugin.getClanManager().getClans().forEach((clan) -> {
if (sm.isChargeUpkeepOnlyIfMemberFeeEnabled() && !clan.isMemberFeeEnabled()) {
return;
+10
View File
@@ -117,6 +117,16 @@ clan:
ff-on-by-default: false
min-length: 2
min-size-to-set-ally: 3
tasks:
collect-upkeep:
hour: 1
minute: 30
collect-upkeep-warning:
hour: 12
minute: 0
collect-fee:
hour: 1
minute: 0
page:
untrusted-color: '8'
clan-name-color: b
+1
View File
@@ -262,6 +262,7 @@ your.clan.tag.must.be.longer.than.characters: "A klán tagjának hosszabbnak kel
your.tag.cannot.contain.the.following.colors: "A címke nem tartalmazhatja a következő színeket: {0}"
your.clan.name.cannot.be.longer.than.characters: "A klán neve legfeljebb {0} karakter lehet"
your.tag.cannot.contain.color.codes: "A címke nem tartalmazhat színkódokat"
you.cannot.set.colored.ranks: "You cannot set colored ranks"
your.clan.name.must.be.longer.than.characters: "A klán neveinek {0} karakter hosszúnak kell lenniük"
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "A klán tagja csak betűket, számokat és színkódokat tartalmazhat"
your.clan.name.cannot.contain.color.codes: "A klán neve nem tartalmazhat színkódokat"
+1
View File
@@ -261,6 +261,7 @@ your.clan.tag.cannot.be.longer.than.characters: "A tag do seu clã não pode ser
your.clan.tag.must.be.longer.than.characters: "A tag do seu clã deve ser maior que {0} caracteres"
your.tag.cannot.contain.the.following.colors: "Sua tag não pode conter as seguintes cores: {0}"
your.tag.cannot.contain.color.codes: "Sua tag não pode conter códigos de cor"
you.cannot.set.colored.ranks: "Você não pode definir ranks coloridos"
your.clan.name.cannot.be.longer.than.characters: "O nome do seu clã não pode ser maior que {0} caracteres"
your.clan.name.must.be.longer.than.characters: "O nome do seu clã deve ser maior que {0} caracteres"
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "A tag do seu clã pode conter apenas letras, números e códigos de cor"
+1
View File
@@ -261,6 +261,7 @@ your.clan.tag.cannot.be.longer.than.characters: "你的帮派的标签不能超
your.clan.tag.must.be.longer.than.characters: "你的帮派的标签必须超过 {0} 字符"
your.tag.cannot.contain.the.following.colors: "帮派的标签不能含有以下颜色: {0}"
your.tag.cannot.contain.color.codes: "Your tag cannot contain color codes"
you.cannot.set.colored.ranks: "You cannot set colored ranks"
your.clan.name.cannot.be.longer.than.characters: "你的帮派的名称不能超过 {0} 字符"
your.clan.name.must.be.longer.than.characters: "你的帮派的名称必须超过 {0} 字符"
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "帮派的标签只能含有字母、数字和颜色代码"
+1
View File
@@ -261,6 +261,7 @@ your.clan.tag.cannot.be.longer.than.characters: "Your clan''s tag cannot be long
your.clan.tag.must.be.longer.than.characters: "Your clan''s tag must be longer than {0} characters"
your.tag.cannot.contain.the.following.colors: "Your tag cannot contain the following colors: {0}"
your.tag.cannot.contain.color.codes: "Your tag cannot contain color codes"
you.cannot.set.colored.ranks: "You cannot set colored ranks"
your.clan.name.cannot.be.longer.than.characters: "Your clan''s name cannot be longer than {0} characters"
your.clan.name.must.be.longer.than.characters: "Your clan''s name must be longer than {0} characters"
your.clan.tag.can.only.contain.letters.numbers.and.color.codes: "Your clan''s tag can only contain letters, numbers, and color codes"
+5
View File
@@ -52,6 +52,7 @@ permissions:
description: Can view rivalries by clan
simpleclans.anyone.kdr-exempt:
description: The player's KDR is not affected on killing/dying
default: false
simpleclans.member.profile:
description: Can view his own clan's profile
simpleclans.member.roster:
@@ -140,6 +141,9 @@ permissions:
description: Can start wars
simpleclans.leader.setrank:
description: Can set ranks
simpleclans.leader.coloredrank:
description: Can set colored ranks
default: true
simpleclans.leader.coloredtag:
description: Can use color codes in tags
simpleclans.member.bank:
@@ -225,3 +229,4 @@ permissions:
simpleclans.leader.home-regroup: true
simpleclans.leader.setrank: true
simpleclans.leader.coloredtag: true
simpleclans.leader.coloredrank: true