1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-02-12 18:31:32 +01:00

Misc simplifications

This commit is contained in:
montlikadani 2020-09-28 18:20:47 +02:00
parent ba37c1b746
commit 2f37a7398c
4 changed files with 13 additions and 17 deletions

View File

@ -100,7 +100,7 @@ public class GuiManager {
else else
Lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100))); Lore.add(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (job.getBonus() * 100)));
Lore.addAll(Arrays.asList(job.getDescription().contains("/n") ? job.getDescription().split("/n") : job.getDescription().split("\n"))); Lore.addAll(Arrays.asList(job.getDescription().split("/n|\\n")));
if (job.getMaxSlots() != null) if (job.getMaxSlots() != null)
Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs Lore.add(Jobs.getLanguage().getMessage("command.info.gui.leftSlots") + ((job.getMaxSlots() - Jobs.getUsedSlots(job)) > 0 ? (job.getMaxSlots() - Jobs
@ -306,13 +306,13 @@ public class GuiManager {
} }
if (!fromCommand) { if (!fromCommand) {
ItemStack skull = Jobs.getGCManager().guiBackButton; ItemStack back = Jobs.getGCManager().guiBackButton;
ItemMeta skullMeta = skull.getItemMeta(); ItemMeta meta = back.getItemMeta();
skullMeta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back")); meta.setDisplayName(Jobs.getLanguage().getMessage("command.info.gui.back"));
skull.setItemMeta(skullMeta); back.setItemMeta(meta);
gui.addButton(new CMIGuiButton(backButton, skull) { gui.addButton(new CMIGuiButton(backButton, back) {
@Override @Override
public void click(GUIClickType type) { public void click(GUIClickType type) {
openJobsBrowseGUI(player); openJobsBrowseGUI(player);

View File

@ -24,8 +24,8 @@ import com.gamingmesh.jobs.container.TopList;
public class SignUtil { public class SignUtil {
private HashMap<String, HashMap<String, jobsSign>> SignsByType = new HashMap<>(); private final HashMap<String, HashMap<String, jobsSign>> SignsByType = new HashMap<>();
private HashMap<String, jobsSign> SignsByLocation = new HashMap<>(); private final HashMap<String, jobsSign> SignsByLocation = new HashMap<>();
public HashMap<String, HashMap<String, jobsSign>> getSigns() { public HashMap<String, HashMap<String, jobsSign>> getSigns() {
return SignsByType; return SignsByType;
@ -44,10 +44,7 @@ public class SignUtil {
} }
public jobsSign getSign(Location loc) { public jobsSign getSign(Location loc) {
if (loc == null) return loc == null ? null : SignsByLocation.get(jobsSign.locToBlockString(loc));
return null;
return SignsByLocation.get(jobsSign.locToBlockString(loc));
} }
public void addSign(jobsSign jSign) { public void addSign(jobsSign jSign) {
@ -171,7 +168,6 @@ public class SignUtil {
} }
public boolean SignUpdate(Job job, SignTopType type) { public boolean SignUpdate(Job job, SignTopType type) {
if (!Jobs.getGCManager().SignsEnabled) if (!Jobs.getGCManager().SignsEnabled)
return true; return true;

View File

@ -431,7 +431,7 @@ public class ConfigManager {
material = CMIMaterial.get(myKey + (subType)); material = CMIMaterial.get(myKey + (subType));
if (material == CMIMaterial.NONE) if (material == CMIMaterial.NONE)
material = CMIMaterial.get(myKey.replace(" ", "_").toUpperCase()); material = CMIMaterial.get(myKey.replace(' ', '_').toUpperCase());
if (material == CMIMaterial.NONE) { if (material == CMIMaterial.NONE) {
// try integer method // try integer method
@ -852,7 +852,7 @@ public class ConfigManager {
CMIMaterial material = CMIMaterial.get(item + (subType)); CMIMaterial material = CMIMaterial.get(item + (subType));
if (material == null) if (material == null)
material = CMIMaterial.get(item.replace(" ", "_").toUpperCase()); material = CMIMaterial.get(item.replace(' ', '_').toUpperCase());
if (material == null) { if (material == null) {
// try integer method // try integer method
@ -1123,7 +1123,7 @@ public class ConfigManager {
try { try {
ActionType actionType = ActionType.getByName(split[0]); ActionType actionType = ActionType.getByName(split[0]);
String mats = split[1]; String mats = split[1];
String[] co = mats.contains(",") ? mats.split(",") : new String[0]; String[] co = mats.split(",");
int amount = 1; int amount = 1;
if (split.length == 3) { if (split.length == 3) {

View File

@ -392,7 +392,7 @@ public class NameTranslatorManager {
if (one == null || CMIEnchantment.getName(one) == null) if (one == null || CMIEnchantment.getName(one) == null)
continue; continue;
String name = Util.firstToUpperCase(CMIEnchantment.getName(one)).replace("_", " "); String name = Util.firstToUpperCase(CMIEnchantment.getName(one)).replace('_', ' ');
if (c.getC().isConfigurationSection("EnchantList")) if (c.getC().isConfigurationSection("EnchantList"))
for (String onek : c.getC().getConfigurationSection("EnchantList").getKeys(false)) { for (String onek : c.getC().getConfigurationSection("EnchantList").getKeys(false)) {
String old = c.getC().getString("EnchantList." + onek + ".MCName"); String old = c.getC().getString("EnchantList." + onek + ".MCName");