Changed to ML placeholder parser

This commit is contained in:
Indyuce 2022-08-18 23:15:39 +02:00
parent 9367fb1d20
commit db78c8d9c3
6 changed files with 10 additions and 4 deletions

View File

@ -88,6 +88,7 @@ public class MMOItems extends JavaPlugin {
private TierManager tierManager;
private SetManager setManager;
@Deprecated
private PlaceholderParser placeholderParser = new DefaultPlaceholderParser();
private VaultSupport vaultSupport;
private RPGHandler rpgPlugin;
@ -513,6 +514,7 @@ public class MMOItems extends JavaPlugin {
return upgradeManager;
}
@Deprecated
public PlaceholderParser getPlaceholderParser() {
return placeholderParser;
}

View File

@ -1,6 +1,6 @@
package net.Indyuce.mmoitems.api.crafting.trigger;
import net.Indyuce.mmoitems.MMOItems;
import io.lumine.mythic.lib.MythicLib;
import net.Indyuce.mmoitems.api.player.PlayerData;
import io.lumine.mythic.lib.api.MMOLineConfig;
@ -17,6 +17,6 @@ public class MessageTrigger extends Trigger {
@Override
public void whenCrafting(PlayerData data) {
if(!data.isOnline()) return;
data.getPlayer().sendMessage(MMOItems.plugin.getPlaceholderParser().parse(data.getPlayer(), message));
data.getPlayer().sendMessage(MythicLib.plugin.getPlaceholderParser().parse(data.getPlayer(), message));
}
}

View File

@ -83,7 +83,7 @@ public class UseItem {
* @param command Command to execute
*/
private void scheduleCommandExecution(CommandData command) {
String parsed = MMOItems.plugin.getPlaceholderParser().parse(player, command.getCommand());
String parsed = MythicLib.plugin.getPlaceholderParser().parse(player, command.getCommand());
if (!command.hasDelay())
dispatchCommand(parsed, command.isConsoleCommand(), command.hasOpPerms());

View File

@ -2,7 +2,9 @@ package net.Indyuce.mmoitems.comp.parse.placeholders;
import org.bukkit.OfflinePlayer;
@Deprecated
public class DefaultPlaceholderParser implements PlaceholderParser {
@Override
public String parse(OfflinePlayer player, String string) {
return string.replace("%player%", player.getName());

View File

@ -5,6 +5,7 @@ import org.bukkit.OfflinePlayer;
import me.clip.placeholderapi.PlaceholderAPI;
import io.lumine.mythic.lib.MythicLib;
@Deprecated
public class PlaceholderAPIParser implements PlaceholderParser {
public PlaceholderAPIParser() {
new MMOItemsPlaceholders().register();
@ -12,6 +13,6 @@ public class PlaceholderAPIParser implements PlaceholderParser {
@Override
public String parse(OfflinePlayer player, String string) {
return MythicLib.plugin.parseColors(PlaceholderAPI.setPlaceholders(player, string.replace("%player%", player.getName())));
return MythicLib.plugin.parseColors(PlaceholderAPI.setPlaceholders(player, string));
}
}

View File

@ -2,6 +2,7 @@ package net.Indyuce.mmoitems.comp.parse.placeholders;
import org.bukkit.OfflinePlayer;
@Deprecated
public interface PlaceholderParser {
String parse(OfflinePlayer player, String string);
}