mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
Fixing jobs browse on older versions
This commit is contained in:
parent
7e78a43094
commit
a707bf8155
File diff suppressed because it is too large
Load Diff
@ -18,6 +18,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||
|
||||
public class ItemManager {
|
||||
|
||||
@ -51,30 +52,30 @@ public class ItemManager {
|
||||
|
||||
String mojangName = null;
|
||||
try {
|
||||
mojangName = ItemReflection.getItemMinecraftName(new ItemStack(mat));
|
||||
if (Version.isCurrentEqualOrLower(Version.v1_14_R1) || mat.isItem())
|
||||
mojangName = ItemReflection.getItemMinecraftName(new ItemStack(mat));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
mojangName = mojangName == null ? mat.toString().replace("_", "").replace(" ", "").toLowerCase()
|
||||
: mojangName.replace("_", "").replace(" ", "").toLowerCase();
|
||||
: mojangName.replace("_", "").replace(" ", "").toLowerCase();
|
||||
|
||||
if (byName.containsKey(cmiName)) {
|
||||
byName.put(cmiName + ":" + data, one);
|
||||
} else
|
||||
byName.put(cmiName, one);
|
||||
|
||||
if (byName.containsKey(materialName))
|
||||
byName.put(materialName + ":" + data, one);
|
||||
else
|
||||
byName.put(materialName, one);
|
||||
byName.put(materialName, one);
|
||||
if (!byName.containsKey(cmiName + ":" + data))
|
||||
byName.put(cmiName + ":" + data, one);
|
||||
|
||||
if (!one.getLegacyNames().isEmpty()) {
|
||||
for (String oneL : one.getLegacyNames()) {
|
||||
String legacyName = oneL.replace("_", "").replace(" ", "").toLowerCase();
|
||||
if (byName.containsKey(legacyName) || data > 0)
|
||||
if (byName.containsKey(legacyName) || data > 0) {
|
||||
byName.put(legacyName + ":" + data, one);
|
||||
else
|
||||
byName.put(legacyName, one);
|
||||
}
|
||||
byName.put(legacyName, one);
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,7 +432,7 @@ public class ItemManager {
|
||||
|
||||
if (ncm != null && subdata != null) {
|
||||
if (ncm.getCMIType().isPotion() || ncm.getCMIType().equals(CMIMaterial.SPLASH_POTION)
|
||||
|| ncm.getCMIType().equals(CMIMaterial.TIPPED_ARROW)) {
|
||||
|| ncm.getCMIType().equals(CMIMaterial.TIPPED_ARROW)) {
|
||||
Integer d = null;
|
||||
PotionEffectType type = null;
|
||||
Boolean upgraded = false;
|
||||
@ -495,7 +496,7 @@ public class ItemManager {
|
||||
continue;
|
||||
}
|
||||
if (Jobs.getNms().getDurability(result) == -1 ||
|
||||
Jobs.getNms().getDurability(result) == Jobs.getNms().getDurability(stack)) {
|
||||
Jobs.getNms().getDurability(result) == Jobs.getNms().getDurability(stack)) {
|
||||
results.add(recipe);
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.gamingmesh.jobs.CMILib.CMIMaterial;
|
||||
import com.gamingmesh.jobs.CMILib.VersionChecker.Version;
|
||||
import com.gamingmesh.jobs.commands.Cmd;
|
||||
import com.gamingmesh.jobs.commands.JobCommand;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
public class blockinfo implements Cmd {
|
||||
@ -29,7 +30,10 @@ public class blockinfo implements Cmd {
|
||||
Player player = (Player) sender;
|
||||
Block block = Util.getTargetBlock(player, 15);
|
||||
|
||||
if (block == null || CMIMaterial.isAir(block.getState().getType()))
|
||||
|
||||
Debug.D(block.getType(), CMIMaterial.get(block).toString());
|
||||
|
||||
if (block == null || CMIMaterial.isAir(block.getType()))
|
||||
return true;
|
||||
|
||||
String dataString = CMIMaterial.getBlockData(block) == 0 ? "" : "-" + CMIMaterial.getBlockData(block);
|
||||
|
@ -31,6 +31,7 @@ import com.gamingmesh.jobs.stuff.ChatColor;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
@ -1022,21 +1023,21 @@ public class ConfigManager {
|
||||
String mats = split[1];
|
||||
String[] co = mats.split(",");
|
||||
if (co.length > 0) {
|
||||
for (String c : co) {
|
||||
KeyValues kv = getKeyValue(c, actionType, jobFullName);
|
||||
if (kv == null) {
|
||||
continue;
|
||||
}
|
||||
for (String c : co) {
|
||||
KeyValues kv = getKeyValue(c, actionType, jobFullName);
|
||||
if (kv == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int amount = 1;
|
||||
if (split.length == 3) {
|
||||
amount = Integer.parseInt(split[2]);
|
||||
}
|
||||
int amount = 1;
|
||||
if (split.length == 3) {
|
||||
amount = Integer.parseInt(split[2]);
|
||||
}
|
||||
|
||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
||||
kv.getType() + kv.getSubType(), amount);
|
||||
quest.addObjective(objective);
|
||||
}
|
||||
QuestObjective objective = new QuestObjective(actionType, kv.getId(), kv.getMeta(),
|
||||
kv.getType() + kv.getSubType(), amount);
|
||||
quest.addObjective(objective);
|
||||
}
|
||||
} else {
|
||||
KeyValues kv = getKeyValue(mats, actionType, jobFullName);
|
||||
if (kv != null) {
|
||||
@ -1166,6 +1167,18 @@ public class ConfigManager {
|
||||
|
||||
}
|
||||
|
||||
if (actionType == ActionType.STRIPLOGS && Version.isCurrentLower(Version.v1_13_R1))
|
||||
continue;
|
||||
|
||||
if (material != null && material.getMaterial() != null && material.getMaterial() == Material.AIR) {
|
||||
log.warning("Job " + jobKey + " " + actionType.getName() + " cant recognize material! (" + key+")");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (material != null && Version.isCurrentLower(Version.v1_13_R1) && meta.isEmpty())
|
||||
meta = String.valueOf(material.getData());
|
||||
|
||||
|
||||
c: if (material != null && material != CMIMaterial.NONE && material.getMaterial() != null) {
|
||||
|
||||
// Need to include those ones and count as regular blocks
|
||||
|
@ -19,6 +19,7 @@ import com.gamingmesh.jobs.container.ActionType;
|
||||
import com.gamingmesh.jobs.container.JobInfo;
|
||||
import com.gamingmesh.jobs.container.NameList;
|
||||
import com.gamingmesh.jobs.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
|
||||
public class NameTranslatorManager {
|
||||
@ -50,10 +51,28 @@ public class NameTranslatorManager {
|
||||
case BREW:
|
||||
case FISH:
|
||||
case STRIPLOGS:
|
||||
|
||||
CMIMaterial mat = CMIMaterial.get(materialName);
|
||||
NameList nameLs = ListOfNames.get(mat);
|
||||
if (nameLs == null)
|
||||
if (nameLs == null) {
|
||||
return mat.getName();
|
||||
}
|
||||
|
||||
if (meta != null && !meta.isEmpty()) {
|
||||
mat = CMIMaterial.get(materialName + ":" + meta);
|
||||
nameLs = ListOfNames.get(mat);
|
||||
if (nameLs == null) {
|
||||
return mat.getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (id != null && meta != null && !meta.isEmpty()) {
|
||||
mat = CMIMaterial.get(id + ":" + meta);
|
||||
nameLs = ListOfNames.get(mat);
|
||||
if (nameLs == null) {
|
||||
return mat.getName();
|
||||
}
|
||||
}
|
||||
|
||||
return nameLs.getName();
|
||||
case BREED:
|
||||
@ -195,7 +214,7 @@ public class NameTranslatorManager {
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
synchronized void load() {
|
||||
synchronized void load() {
|
||||
String ls = Jobs.getGCManager().localeString;
|
||||
if (ls.isEmpty())
|
||||
return;
|
||||
|
@ -20,6 +20,7 @@ package com.gamingmesh.jobs.container;
|
||||
|
||||
import com.gamingmesh.jobs.Jobs;
|
||||
import com.gamingmesh.jobs.resources.jfep.Parser;
|
||||
import com.gamingmesh.jobs.stuff.Debug;
|
||||
|
||||
public class JobInfo {
|
||||
private ActionType actionType;
|
||||
|
@ -1,14 +1,30 @@
|
||||
package com.gamingmesh.jobs.stuff;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Debug {
|
||||
public static void D(Object message) {
|
||||
public static void D(Object... message) {
|
||||
Player player = Bukkit.getPlayer("Zrips");
|
||||
if (player == null)
|
||||
if (player == null || !player.isOnline())
|
||||
return;
|
||||
player.sendMessage(org.bukkit.ChatColor.translateAlternateColorCodes('&', "&8[JD]&3 " + String.valueOf(message)));
|
||||
return;
|
||||
|
||||
String FullMessage = "";
|
||||
int i = 1;
|
||||
ChatColor cl = ChatColor.GRAY;
|
||||
for (Object one : message) {
|
||||
i++;
|
||||
if (i >= 2) {
|
||||
i = 0;
|
||||
if (cl == ChatColor.GRAY)
|
||||
cl = ChatColor.WHITE;
|
||||
else
|
||||
cl = ChatColor.GRAY;
|
||||
FullMessage += cl;
|
||||
}
|
||||
FullMessage += String.valueOf(one) + " ";
|
||||
}
|
||||
player.sendMessage(ChatColor.DARK_GRAY + "[CMID] " + ChatColor.DARK_AQUA + FullMessage);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user