mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 14:05:25 +01:00
Fix when Entity#isPersistent method does not exist on 1.8 servers
This commit is contained in:
parent
149a71e5da
commit
5c83fcbd11
@ -40,8 +40,7 @@ public class BossBarManager {
|
||||
if (Version.getCurrent().isLower(Version.v1_9_R1) || !Jobs.getGCManager().BossBarsMessageByDefault)
|
||||
return;
|
||||
|
||||
Boolean show = ToggleBarHandling.getBossBarToggle().getOrDefault(player.getPlayer().getUniqueId().toString(), true);
|
||||
if (!show)
|
||||
if (!ToggleBarHandling.getBossBarToggle().getOrDefault(player.getUniqueId().toString(), true))
|
||||
return;
|
||||
|
||||
BossBar bar = null;
|
||||
|
@ -670,9 +670,7 @@ public class ConfigManager {
|
||||
String fileName = jobKey.equalsIgnoreCase(EXAMPLEJOBNAME) ? jobKey.toUpperCase() : jobKey.toLowerCase();
|
||||
|
||||
YmlMaker newJobFile = new YmlMaker(jobsPathFolder, fileName + ".yml");
|
||||
if (!newJobFile.exists()) {
|
||||
newJobFile.createNewFile();
|
||||
}
|
||||
newJobFile.createNewFile();
|
||||
|
||||
FileConfiguration conf = newJobFile.getConfig();
|
||||
conf.options().pathSeparator(File.separatorChar);
|
||||
|
@ -27,8 +27,8 @@ public class ExploreManager {
|
||||
}
|
||||
|
||||
public void setPlayerAmount(int amount) {
|
||||
if (this.playerAmount < amount)
|
||||
this.playerAmount = amount;
|
||||
if (playerAmount < amount)
|
||||
playerAmount = amount;
|
||||
}
|
||||
|
||||
public boolean isExploreEnabled() {
|
||||
@ -44,9 +44,12 @@ public class ExploreManager {
|
||||
public void load() {
|
||||
if (!exploreEnabled)
|
||||
return;
|
||||
|
||||
Jobs.consoleMsg("&e[Jobs] Loading explorer data");
|
||||
Jobs.getJobsDAO().loadExplore();
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded explorer data" + (getSize() != 0 ? " (" + getSize() + ")" : "."));
|
||||
|
||||
int size = getSize();
|
||||
Jobs.consoleMsg("&e[Jobs] Loaded explorer data" + (size != 0 ? " (" + size + ")" : "."));
|
||||
}
|
||||
|
||||
public Map<String, ExploreRegion> getWorlds() {
|
||||
|
@ -21,9 +21,9 @@ import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
public class NameTranslatorManager {
|
||||
|
||||
private final HashMap<CMIMaterial, NameList> ListOfNames = new HashMap<>();
|
||||
private final ArrayList<NameList> ListOfEntities = new ArrayList<>(), ListOfColors = new ArrayList<>();
|
||||
private final HashMap<String, NameList> ListOfEnchants = new HashMap<>(), ListOfMMEntities = new HashMap<>();
|
||||
private final Map<CMIMaterial, NameList> ListOfNames = new HashMap<>();
|
||||
private final List<NameList> ListOfEntities = new ArrayList<>(), ListOfColors = new ArrayList<>();
|
||||
private final Map<String, NameList> ListOfEnchants = new HashMap<>(), ListOfMMEntities = new HashMap<>();
|
||||
|
||||
public String Translate(String materialName, JobInfo info) {
|
||||
return Translate(materialName, info.getActionType(), info.getId(), info.getMeta(), info.getName());
|
||||
@ -123,8 +123,9 @@ public class NameTranslatorManager {
|
||||
String mName = materialName;
|
||||
String level = "";
|
||||
if (mName.contains(":")) {
|
||||
mName = materialName.split(":")[0];
|
||||
level = ":" + materialName.split(":")[1];
|
||||
String[] split = materialName.split(":", 2);
|
||||
mName = split[0];
|
||||
level = ":" + split[1];
|
||||
}
|
||||
NameList nameInfo = ListOfEnchants.get(mName.toLowerCase().replace("_", ""));
|
||||
if (nameInfo != null) {
|
||||
@ -247,9 +248,7 @@ public class NameTranslatorManager {
|
||||
return;
|
||||
|
||||
File tWordsFolder = new File(Jobs.getFolder(), "TranslatableWords");
|
||||
if (!tWordsFolder.exists()) {
|
||||
tWordsFolder.mkdirs();
|
||||
}
|
||||
tWordsFolder.mkdirs();
|
||||
|
||||
File file = new File(Jobs.getFolder(), "TranslatableWords.yml");
|
||||
File file2 = new File(tWordsFolder, "Words_" + ls + ".yml");
|
||||
|
@ -2,7 +2,6 @@ package com.gamingmesh.jobs.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.CMIItemStack;
|
||||
@ -31,20 +30,18 @@ public class RestrictedBlockManager {
|
||||
"If you want to have default value for all blocks, enable GlobalBlockTimer in generalConfig file");
|
||||
|
||||
if (cfg.getC().isConfigurationSection("blocksTimer")) {
|
||||
Set<String> lss = cfg.getC().getConfigurationSection("blocksTimer").getKeys(false);
|
||||
for (String one : lss) {
|
||||
if (((cfg.getC().isString("blocksTimer." + one + ".id")) || (cfg.getC().isInt("blocksTimer." + one + ".id"))) && (cfg.getC().isInt("blocksTimer." + one
|
||||
+ ".cd"))) {
|
||||
CMIItemStack cm = ItemManager.getItem(CMIMaterial.get(cfg.getC().getString("blocksTimer." + one + ".id")));
|
||||
if ((cm == null) || (!cm.getCMIType().isBlock())) {
|
||||
org.bukkit.configuration.ConfigurationSection section = cfg.getC().getConfigurationSection("blocksTimer");
|
||||
for (String one : section.getKeys(false)) {
|
||||
if (((section.isString(one + ".id")) || (section.isInt(one + ".id"))) && (section.isInt(one + ".cd"))) {
|
||||
CMIItemStack cm = ItemManager.getItem(CMIMaterial.get(section.getString(one + ".id")));
|
||||
if (cm == null || !cm.getCMIType().isBlock()) {
|
||||
Jobs.consoleMsg("&e[Jobs] Your defined (" + one + ") protected block id/name is not correct!");
|
||||
continue;
|
||||
}
|
||||
|
||||
restrictedBlocksTimer.put(cm.getCMIType(), cfg.getC().getInt("blocksTimer." + one + ".cd"));
|
||||
|
||||
cfg.set("blocksTimer." + cm.getCMIType().name(), cfg.getC().getInt("blocksTimer." + one + ".cd"));
|
||||
|
||||
int cd = section.getInt(one + ".cd");
|
||||
restrictedBlocksTimer.put(cm.getCMIType(), cd);
|
||||
cfg.set("blocksTimer." + cm.getCMIType().name(), cd);
|
||||
} else {
|
||||
CMIMaterial mat = CMIMaterial.get(one);
|
||||
if (mat == CMIMaterial.NONE)
|
||||
|
@ -416,7 +416,7 @@ public abstract class JobsDAO {
|
||||
public String getQuery() {
|
||||
String rp = "";
|
||||
List<JobsTableInterface> uniques = new ArrayList<>();
|
||||
for (JobsTableInterface one : getInterface()) {
|
||||
for (JobsTableInterface one : c) {
|
||||
if (one.isUnique()) {
|
||||
uniques.add(one);
|
||||
}
|
||||
@ -550,9 +550,11 @@ public abstract class JobsDAO {
|
||||
|
||||
private boolean checkDefaultCollumns() {
|
||||
for (DBTables one : DBTables.values()) {
|
||||
String tableName = one.getTableName();
|
||||
|
||||
for (JobsTableInterface oneT : one.getInterface()) {
|
||||
if (!isCollumn(one.getTableName(), oneT.getCollumn()))
|
||||
addCollumn(one.getTableName(), oneT.getCollumn(), oneT.getType());
|
||||
if (!isCollumn(tableName, oneT.getCollumn()))
|
||||
addCollumn(tableName, oneT.getCollumn(), oneT.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1689,7 +1689,7 @@ public class JobsPaymentListener implements Listener {
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
||||
for (Entity entity : event.getChunk().getEntities()) {
|
||||
if (entity.isPersistent())
|
||||
if (Version.isCurrentEqualOrHigher(Version.v1_13_R1) && entity.isPersistent())
|
||||
break;
|
||||
|
||||
if (entity.hasMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata()))
|
||||
|
Loading…
Reference in New Issue
Block a user