1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

#413 Now checks the papi version when using old version and update to latest

- Last commit fix for offlineplayer, we not using this
This commit is contained in:
montlikadani 2019-05-08 12:56:28 +02:00
parent 2147c270ea
commit afb07a69d4
4 changed files with 5 additions and 13 deletions

View File

@ -124,7 +124,7 @@
<dependency> <dependency>
<groupId>me.clip</groupId> <groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId> <artifactId>placeholderapi</artifactId>
<version>2.9.2</version> <version>2.10.1</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -227,7 +227,8 @@ public class Jobs extends JavaPlugin {
private boolean setupPlaceHolderAPI() { private boolean setupPlaceHolderAPI() {
if (!getServer().getPluginManager().isPluginEnabled("PlaceholderAPI")) if (!getServer().getPluginManager().isPluginEnabled("PlaceholderAPI"))
return false; return false;
if (!getServer().getPluginManager().getPlugin("PlaceholderAPI").getDescription().getVersion().contains("2.10.0")) { if (getVersionCheckManager().convertVersion(getServer().getPluginManager()
.getPlugin("PlaceholderAPI").getDescription().getVersion()) >= getVersionCheckManager().convertVersion("2.10.0")) {
if ((new NewPlaceholderAPIHook(this)).register()) if ((new NewPlaceholderAPIHook(this)).register())
consoleMsg("&e[Jobs] PlaceholderAPI hooked."); consoleMsg("&e[Jobs] PlaceholderAPI hooked.");
} else { } else {

View File

@ -1,6 +1,6 @@
package com.gamingmesh.jobs.Placeholders; package com.gamingmesh.jobs.Placeholders;
import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders; import com.gamingmesh.jobs.Placeholders.Placeholder.JobsPlaceHolders;
@ -16,7 +16,7 @@ public class NewPlaceholderAPIHook extends PlaceholderExpansion {
} }
@Override @Override
public String onRequest(OfflinePlayer player, String identifier) { public String onPlaceholderRequest(Player player, String identifier) {
JobsPlaceHolders placeHolder = JobsPlaceHolders.getByName(identifier); JobsPlaceHolders placeHolder = JobsPlaceHolders.getByName(identifier);
if (placeHolder == null) if (placeHolder == null)
return null; return null;

View File

@ -6,7 +6,6 @@ import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
@ -333,18 +332,10 @@ public class Placeholder {
return message; return message;
} }
public String getValue(OfflinePlayer player, JobsPlaceHolders placeHolder) {
return getValue(player.getPlayer(), placeHolder, null);
}
public String getValue(Player player, JobsPlaceHolders placeHolder) { public String getValue(Player player, JobsPlaceHolders placeHolder) {
return getValue(player, placeHolder, null); return getValue(player, placeHolder, null);
} }
public String getValue(OfflinePlayer player, JobsPlaceHolders placeHolder, String value) {
return getValue(player != null ? player.getUniqueId() : null, placeHolder, value);
}
public String getValue(Player player, JobsPlaceHolders placeHolder, String value) { public String getValue(Player player, JobsPlaceHolders placeHolder, String value) {
return getValue(player != null ? player.getUniqueId() : null, placeHolder, value); return getValue(player != null ? player.getUniqueId() : null, placeHolder, value);
} }