use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CommandCombatLogXUntag method execute.
@Override
protected boolean execute(CommandSender sender, String[] args) {
if (!checkPermission(sender, "combatlogx.command.combatlogx.untag", true)) {
return true;
}
if (args.length < 1) {
return false;
}
Player target = findTarget(sender, args[0]);
if (target == null) {
return true;
}
String targetName = target.getName();
Replacer replacer = message -> message.replace("{target}", targetName);
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = plugin.getCombatManager();
if (!combatManager.isInCombat(target)) {
sendMessageWithPrefix(sender, "error.target-not-in-combat", replacer, true);
return true;
}
combatManager.untag(target, UntagReason.EXPIRE);
sendMessageWithPrefix(sender, "command.combatlogx.untag-player", replacer, true);
return true;
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CommandCombatLogXVersion method getPluginVersion.
private String getPluginVersion() {
ICombatLogX combatLogX = getCombatLogX();
JavaPlugin plugin = combatLogX.getPlugin();
PluginDescriptionFile information = plugin.getDescription();
return information.getVersion();
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CommandCombatLogXVersion method addDependencyInformation.
private void addDependencyInformation(List<String> messageList) {
ICombatLogX combatLogX = getCombatLogX();
JavaPlugin plugin = combatLogX.getPlugin();
PluginDescriptionFile information = plugin.getDescription();
messageList.add("&f&lDependency Information:");
List<String> loadBeforeList = information.getLoadBefore();
List<String> dependList = information.getDepend();
List<String> softDependList = information.getSoftDepend();
List<String> fullDependencyList = new ArrayList<>(loadBeforeList);
fullDependencyList.addAll(dependList);
fullDependencyList.addAll(softDependList);
PluginManager pluginManager = Bukkit.getPluginManager();
for (String dependencyName : fullDependencyList) {
Plugin dependency = pluginManager.getPlugin(dependencyName);
if (dependency == null) {
continue;
}
PluginDescriptionFile dependencyInformation = dependency.getDescription();
String dependencyFullName = dependencyInformation.getFullName();
messageList.add("&f&l - &7" + dependencyFullName);
}
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class CommandCombatLogXVersion method getSpigotVersion.
private String getSpigotVersion() {
ICombatLogX combatLogX = getCombatLogX();
JavaPlugin plugin = combatLogX.getPlugin();
CorePlugin corePlugin = JavaPlugin.getPlugin(CorePlugin.class);
UpdateManager updateManager = corePlugin.getUpdateManager();
String spigotVersion = updateManager.getSpigotVersion(plugin);
if (spigotVersion == null) {
return "Not Available";
}
return spigotVersion;
}
use of com.github.sirblobman.combatlogx.api.ICombatLogX in project CombatLogX by SirBlobman.
the class ListenerConfiguration method runTagCommands.
private void runTagCommands(Player player, LivingEntity enemy) {
ConfigurationManager configurationManager = getPluginConfigurationManager();
YamlConfiguration configuration = configurationManager.get("commands.yml");
ICombatLogX plugin = getCombatLogX();
ICombatManager combatManager = getCombatManager();
List<String> tagCommandList = configuration.getStringList("tag-command-list");
if (tagCommandList.isEmpty())
return;
for (String tagCommand : tagCommandList) {
String replacedCommand = combatManager.replaceVariables(player, enemy, tagCommand);
if (replacedCommand.startsWith("[PLAYER]")) {
String command = replacedCommand.substring("[PLAYER]".length());
CommandHelper.runAsPlayer(plugin, player, command);
continue;
}
if (replacedCommand.startsWith("[OP]")) {
String command = replacedCommand.substring("[OP]".length());
CommandHelper.runAsOperator(plugin, player, command);
continue;
}
CommandHelper.runAsConsole(plugin, replacedCommand);
}
}
Aggregations