Default configs no longer use %player%

This commit is contained in:
Jules 2024-05-24 19:42:08 -07:00
parent 7edd17962c
commit b150817964
7 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.api.quest.trigger;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.Bukkit;
@ -23,7 +24,9 @@ public class CommandTrigger extends Trigger {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), format(player.getPlayer()));
}
@BackwardsCompatibility(version = "1.12-SNAPSHOT")
private String format(Player player) {
// TODO remove use of confusing non-PAPI %player% placeholder
return MMOCore.plugin.placeholderParser.parse(player, command.replace("%player%", player.getName()));
}
}

View File

@ -6,8 +6,6 @@ import net.Indyuce.mmocore.api.player.PlayerData;
import net.Indyuce.mmocore.api.quest.trigger.api.Removable;
import net.Indyuce.mmocore.skill.RegisteredSkill;
import java.util.Objects;
public class LevelUpSkillTrigger extends Trigger implements Removable {
private final RegisteredSkill skill;
private final int amount;
@ -17,7 +15,7 @@ public class LevelUpSkillTrigger extends Trigger implements Removable {
config.validateKeys("skill", "amount");
amount = config.getInt("amount");
skill = Objects.requireNonNull(MMOCore.plugin.skillManager.getSkill(config.getString("skill")));
skill = MMOCore.plugin.skillManager.getSkillOrThrow(config.getString("skill"));
}
@Override

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.api.quest.trigger;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import net.Indyuce.mmocore.MMOCore;
import net.Indyuce.mmocore.api.player.PlayerData;
import org.bukkit.entity.Player;
@ -22,7 +23,9 @@ public class MessageTrigger extends Trigger {
player.getPlayer().sendMessage(format(player.getPlayer()));
}
@BackwardsCompatibility(version = "1.12-SNAPSHOT")
private String format(Player player) {
// TODO remove use of confusing non-PAPI %player% placeholder
return MMOCore.plugin.placeholderParser.parse(player, message.replace("%player%", player.getName()));
}
}

View File

@ -1,5 +1,6 @@
package net.Indyuce.mmocore.comp.placeholder;
import io.lumine.mythic.lib.util.annotation.BackwardsCompatibility;
import org.bukkit.OfflinePlayer;
import io.lumine.mythic.lib.MythicLib;
@ -7,7 +8,9 @@ import io.lumine.mythic.lib.MythicLib;
public class DefaultParser implements PlaceholderParser {
@Override
@BackwardsCompatibility(version = "1.12-SNAPSHOT")
public String parse(OfflinePlayer player, String string) {
// TODO remove use of confusing non-PAPI %player% placeholder
return MythicLib.plugin.parseColors(string.replace("%player%", player.getName()));
}
}

View File

@ -47,7 +47,7 @@ class_exp_table:
skill_point:
period: 1
triggers:
- 'command{format="mmocore admin skill-points give %player% 1"}'
- 'command{format="mmocore admin skill-points give %player_name% 1"}'
second_exp_table:

View File

@ -35,5 +35,5 @@ objectives:
triggers:
- message{format="&aThis looked like apple. But owell, thanks! Here are a a few coins'"}
- sound{sound=ENTITY_EXPERIENCE_ORB_PICKUP;pitch=1;volume=1}
- command{format="mmocore coins %player% 10"}
- command{format="mmocore coins %player_name% 10"}
- 'experience{amount=30}'

View File

@ -35,7 +35,7 @@ objectives:
type: 'goto{world="world";x=56;y=68;z=115;range=5}'
lore: 'Head to the camp.'
triggers:
- 'message{format="&aBlacksmith> &fHello, %player%! I am currently looking for some help."}'
- 'message{format="&aBlacksmith> &fHello, %player_name%! I am currently looking for some help."}'
- 'message{format="&aBlacksmith> &fCould you please get me 3 oak logs?"}'
- 'sound{sound=ENTITY_EXPERIENCE_ORB_PICKUP}'
2: