mirror of
https://github.com/zeshan321/ActionHealth.git
synced 2025-03-10 13:49:07 +01:00
Added support for PlaceholderAPI and MVdWPlaceholderAPI
This commit is contained in:
parent
f8a17d4fb2
commit
87dc8a9c99
@ -4,6 +4,7 @@
|
||||
# {maxhealth} shows the max health of the mob or player.
|
||||
# {usestyle} will use the defined chars.
|
||||
# {displayname} will use player/mob custom name.
|
||||
# Has support for PlaceholderAPI and MVdWPlaceholderAPI.
|
||||
Health Message: '&7&l{name}: {usestyle}'
|
||||
|
||||
# The message the player is sent to the player if they have actionhealth disabled.
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
name: ActionHealth
|
||||
main: com.zeshanaslam.actionhealth.Main
|
||||
version: 3.2.1
|
||||
version: 3.2.2
|
||||
softdepend: [PlaceholderAPI, MVdWPlaceholderAPI]
|
||||
commands:
|
||||
Actionhealth:
|
||||
description: Actionhealth main command.
|
@ -3,6 +3,7 @@ package com.zeshanaslam.actionhealth;
|
||||
import be.maximvdw.placeholderapi.PlaceholderAPI;
|
||||
import com.sk89q.worldguard.protection.ApplicableRegionSet;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -103,6 +104,15 @@ public class HealthUtil {
|
||||
}
|
||||
|
||||
output = output.replace("{displayname}", displayName);
|
||||
|
||||
// Placeholder apis
|
||||
if (plugin.settingsManager.hasMVdWPlaceholderAPI) {
|
||||
output = be.maximvdw.placeholderapi.PlaceholderAPI.replacePlaceholders(player, output);
|
||||
}
|
||||
|
||||
if (plugin.settingsManager.hasPlaceholderAPI) {
|
||||
output = me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(player, output);
|
||||
}
|
||||
} else {
|
||||
output = output.replace("{displayname}", name);
|
||||
}
|
||||
@ -148,10 +158,6 @@ public class HealthUtil {
|
||||
output = output.replace("{usestyle}", style.toString());
|
||||
}
|
||||
|
||||
if (plugin.settingsManager.placeholderAPI) {
|
||||
output = PlaceholderAPI.replacePlaceholders(receiver, output);
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ public class SettingsManager {
|
||||
public String toggleMessage;
|
||||
public String enableMessage;
|
||||
public String disableMessage;
|
||||
public boolean placeholderAPI;
|
||||
public boolean hasMVdWPlaceholderAPI;
|
||||
public boolean hasPlaceholderAPI;
|
||||
public int limitHealth;
|
||||
|
||||
public SettingsManager(Main plugin) {
|
||||
@ -49,7 +50,10 @@ public class SettingsManager {
|
||||
if (plugin.taskID != -1) Bukkit.getScheduler().cancelTask(plugin.taskID);
|
||||
|
||||
// Check if using MVdWPlaceholderAPI
|
||||
placeholderAPI = Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI");
|
||||
hasMVdWPlaceholderAPI = Bukkit.getPluginManager().isPluginEnabled("MVdWPlaceholderAPI");
|
||||
|
||||
// Check if using placeholderAPI
|
||||
hasPlaceholderAPI = Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI");
|
||||
|
||||
// Get settings from config
|
||||
healthMessage = plugin.getConfig().getString("Health Message");
|
||||
|
Loading…
Reference in New Issue
Block a user