Skip to content

Commit 4bd4df6

Browse files
author
Travis Eggett
committed
Merge branch 'development'
2 parents 7ae4f47 + 905988a commit 4bd4df6

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/main/java/com/sucy/skill/api/player/PlayerData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2137,7 +2137,7 @@ public boolean check(PlayerSkill skill, boolean cooldown, boolean mana) {
21372137

21382138
// On Cooldown
21392139
if (status == SkillStatus.ON_COOLDOWN && cooldown) {
2140-
if (!onCooldown.contains(getUUID())) {
2140+
if (skill.getData().cooldownMessage() && !onCooldown.contains(getUUID())) {
21412141
SkillAPI.getLanguage().sendMessage(ErrorNodes.COOLDOWN, getPlayer(), FilterType.COLOR, RPGFilter.COOLDOWN.setReplacement(skill.getCooldown() + ""), RPGFilter.SKILL.setReplacement(skill.getData().getName()));
21422142
onCooldown.add(getUUID());
21432143
Bukkit.getScheduler().runTaskLater(SkillAPI.inst(), () -> onCooldown.remove(getUUID()), 40L);

src/main/java/com/sucy/skill/api/skills/Skill.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public abstract class Skill implements IconHolder {
7979
private static final String REQLVL = "skill-req-lvl";
8080
private static final String MSG = "msg";
8181
private static final String PERM = "needs-permission";
82+
private static final String COOLDOWN_MESSAGE = "cooldown-message";
8283
private static final String DESC = "desc";
8384
private static final String ATTR = "attributes";
8485
private static final String COMBO = "combo";
@@ -101,6 +102,7 @@ public abstract class Skill implements IconHolder {
101102
private int maxLevel;
102103
private int skillReqLevel;
103104
private boolean needsPermission;
105+
private boolean cooldownMessage;
104106
private int combo;
105107

106108
/**
@@ -394,6 +396,15 @@ public double getCooldown(int level) {
394396
return settings.getAttr(SkillAttribute.COOLDOWN, level);
395397
}
396398

399+
/**
400+
* Checks whether a message is sent when attempting to run the skill while in cooldown
401+
*
402+
* @return true if the message is sent, false otherwise
403+
*/
404+
public boolean cooldownMessage() {
405+
return cooldownMessage;
406+
}
407+
397408
/**
398409
* Retrieves the range of the skill in blocks
399410
*
@@ -820,6 +831,7 @@ public void save(DataSection config) {
820831
config.set(REQ, skillReq);
821832
config.set(REQLVL, skillReqLevel);
822833
config.set(PERM, needsPermission);
834+
config.set(COOLDOWN_MESSAGE, cooldownMessage);
823835
if (combo >= 0 && canCast())
824836
config.set(COMBO, SkillAPI.getComboManager().getSaveString(combo));
825837
settings.save(config.createSection(ATTR));
@@ -859,6 +871,7 @@ public void load(DataSection config) {
859871
skillReqLevel = config.getInt(REQLVL, skillReqLevel);
860872
message = TextFormatter.colorString(config.getString(MSG, message));
861873
needsPermission = config.getString(PERM, needsPermission + "").equalsIgnoreCase("true");
874+
cooldownMessage = config.getBoolean(COOLDOWN_MESSAGE, true);
862875
combo = SkillAPI.getComboManager().parseCombo(config.getString(COMBO));
863876

864877
if (config.isList(DESC)) {

0 commit comments

Comments
 (0)