diff --git a/Changelog.txt b/Changelog.txt index 03e9ebbb..7c6d680b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,5 @@ # 4.15.0 -- Fixed issue for jobs browse when opened and showing the same actions. +- Fixed issue when the quest description only showed one lines of list. # 4.14.0 - Fixed %titlename% placeholder does not showed anything diff --git a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java index 9a8b43c7..a947d04d 100644 --- a/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java +++ b/src/main/java/com/gamingmesh/jobs/Gui/GuiManager.java @@ -2,9 +2,7 @@ package com.gamingmesh.jobs.Gui; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; diff --git a/src/main/java/com/gamingmesh/jobs/PlayerManager.java b/src/main/java/com/gamingmesh/jobs/PlayerManager.java index fc20f047..bbaf153e 100644 --- a/src/main/java/com/gamingmesh/jobs/PlayerManager.java +++ b/src/main/java/com/gamingmesh/jobs/PlayerManager.java @@ -115,15 +115,15 @@ public class PlayerManager { } public void addPlayerToCache(JobsPlayer jPlayer) { - if (jPlayer.getUserName() != null && playersCache.get(jPlayer.getUserName().toLowerCase()) == null) - playersCache.put(jPlayer.getUserName().toLowerCase(), jPlayer); + if (jPlayer.getName() != null && playersCache.get(jPlayer.getName().toLowerCase()) == null) + playersCache.put(jPlayer.getName().toLowerCase(), jPlayer); if (jPlayer.getUniqueId() != null && playersUUIDCache.get(jPlayer.getUniqueId()) == null) playersUUIDCache.put(jPlayer.getUniqueId(), jPlayer); } public void addPlayer(JobsPlayer jPlayer) { - if (jPlayer.getUserName() != null && players.get(jPlayer.getUserName().toLowerCase()) == null) - players.put(jPlayer.getUserName().toLowerCase(), jPlayer); + if (jPlayer.getName() != null && players.get(jPlayer.getName().toLowerCase()) == null) + players.put(jPlayer.getName().toLowerCase(), jPlayer); if (jPlayer.getUniqueId() != null && playersUUID.get(jPlayer.getUniqueId()) == null) playersUUID.put(jPlayer.getUniqueId(), jPlayer); } @@ -554,7 +554,7 @@ public class PlayerManager { if (player != null) message = message.replace("%playername%", player.getDisplayName()); else - message = message.replace("%playername%", jPlayer.getUserName()); + message = message.replace("%playername%", jPlayer.getName()); message = message.replace("%joblevel%", "" + prog.getLevel()); message = message.replace("%lostLevel%", "" + oldLevel); @@ -714,7 +714,7 @@ public class PlayerManager { if (player != null) message = message.replace("%playername%", player.getDisplayName()); else - message = message.replace("%playername%", jPlayer.getUserName()); + message = message.replace("%playername%", jPlayer.getName()); message = message.replace("%joblevel%", "" + prog.getLevel()); for (String line : message.split("\n")) { @@ -753,7 +753,7 @@ public class PlayerManager { if (player != null) message = message.replace("%playername%", player.getDisplayName()); else - message = message.replace("%playername%", jPlayer.getUserName()); + message = message.replace("%playername%", jPlayer.getName()); message = message.replace("%titlename%", levelUpEvent.getNewTitleColor() + levelUpEvent.getNewTitleName()); message = message.replace("%jobname%", job.getChatColor() + job.getName()); diff --git a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java index 5923ad67..f27782ae 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java +++ b/src/main/java/com/gamingmesh/jobs/commands/JobsCommands.java @@ -36,10 +36,8 @@ import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; -import com.gamingmesh.jobs.container.QuestProgression; import com.gamingmesh.jobs.container.Title; import com.gamingmesh.jobs.stuff.PageInfo; -import com.gamingmesh.jobs.stuff.TimeManage; public class JobsCommands implements CommandExecutor { public static final String label = "jobs"; @@ -403,10 +401,10 @@ public class JobsCommands implements CommandExecutor { String t = type == "" ? "" : " " + type; if (sender instanceof Player) - if (sender.getName().equalsIgnoreCase(player.getUserName())) + if (sender.getName().equalsIgnoreCase(player.getName())) plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs info " + job.getName() + t); else - plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs playerinfo " + player.getUserName() + " " + job.getName() + t); + plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs playerinfo " + player.getName() + " " + job.getName() + t); } /** @@ -537,18 +535,4 @@ public class JobsCommands implements CommandExecutor { "%jobmaxxp%", jobProg.getMaxExperience(level)); return " " + jobProgressMessage(jobProg.getMaxExperience(level), exp) + " " + message; } - - public String jobsQuestMessage(QuestProgression qp, JobProgression prog) { - String hoverMsg = Jobs.getLanguage().getMessage("command.quests.output.hover"); - hoverMsg = hoverMsg.replace("[jobName]", prog.getJob().getName()) - .replace("[time]", TimeManage.to24hourShort(qp.getValidUntil() - System.currentTimeMillis())); - - if (hoverMsg.contains("[desc]")) { - for (String one : qp.getQuest().getDescription()) { - hoverMsg = hoverMsg.replace("[desc]", one); - } - } - - return hoverMsg; - } } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java index 7ccb4c00..d9bc0b4a 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/archive.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/archive.java @@ -43,7 +43,7 @@ public class archive implements Cmd { return true; } - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); for (JobProgression jobInfo : AllJobs) { RawMessage rm = new RawMessage(); if (jobInfo.canRejoin()) diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java index 07d39468..d93694ce 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/editpoints.java @@ -12,14 +12,12 @@ public class editpoints implements Cmd { @Override @JobCommand(475) public boolean perform(Jobs plugin, CommandSender sender, String[] args) { - if (args.length != 3) { Jobs.getCommandManager().sendUsage(sender, "editpoints"); return true; } JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[1]); - if (jPlayer == null) { sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[1])); return true; @@ -34,9 +32,8 @@ public class editpoints implements Cmd { } PlayerPoints pointInfo = Jobs.getPointsData().getPlayerPointsInfo(jPlayer.getUniqueId()); - if (pointInfo == null) { - sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", jPlayer.getName())); return true; } @@ -44,21 +41,21 @@ public class editpoints implements Cmd { case "take": pointInfo.takePoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.take", - "%playername%", jPlayer.getUserName(), + "%playername%", jPlayer.getName(), "%amount%", amount, "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); break; case "add": pointInfo.addPoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.add", - "%playername%", jPlayer.getUserName(), + "%playername%", jPlayer.getName(), "%amount%", amount, "%total%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); break; case "set": pointInfo.setPoints(amount); sender.sendMessage(Jobs.getLanguage().getMessage("command.editpoints.output.set", - "%playername%", jPlayer.getUserName(), + "%playername%", jPlayer.getName(), "%amount%", amount)); break; default: diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/log.java b/src/main/java/com/gamingmesh/jobs/commands/list/log.java index 6d0aaa65..812d1064 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/log.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/log.java @@ -68,7 +68,7 @@ public class log implements Cmd { unsortMap = Sorting.sortDoubleDESC(unsortMap); int count = 0; int max = 10; - sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.log.output.topline", "%playername%", JPlayer.getName())); for (Entry l : logList.entrySet()) { Log one = l.getValue(); HashMap AmountList = one.getAmountList(); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/points.java b/src/main/java/com/gamingmesh/jobs/commands/list/points.java index d01251d2..c2a39119 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/points.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/points.java @@ -40,7 +40,7 @@ public class points implements Cmd { PlayerPoints pointInfo = Jobs.getPointsData().getPlayerPointsInfo(jPlayer.getUniqueId()); - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); sender.sendMessage(Jobs.getLanguage().getMessage("command.points.currentpoints", "%currentpoints%", (int) (pointInfo.getCurrentPoints() * 100) / 100D)); sender.sendMessage(Jobs.getLanguage().getMessage("command.points.totalpoints", "%totalpoints%", (int) (pointInfo.getTotalPoints() * 100) / 100D)); sender.sendMessage(Jobs.getLanguage().getMessage("general.info.separator")); diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java index 26e56171..0cf3fa92 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/quests.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/quests.java @@ -14,7 +14,7 @@ import com.gamingmesh.jobs.container.JobProgression; import com.gamingmesh.jobs.container.JobsPlayer; import com.gamingmesh.jobs.container.QuestObjective; import com.gamingmesh.jobs.container.QuestProgression; -import com.gamingmesh.jobs.stuff.Debug; +import com.gamingmesh.jobs.stuff.TimeManage; import com.gamingmesh.jobs.CMILib.RawMessage; public class quests implements Cmd { @@ -50,7 +50,7 @@ public class quests implements Cmd { return true; } - sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getUserName(), "[questsDone]", jPlayer.getDoneQuests())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.quests.toplineseparator", "[playerName]", jPlayer.getName(), "[questsDone]", jPlayer.getDoneQuests())); if (sender instanceof Player) { for (JobProgression jobProg : jPlayer.getJobProgression()) { List list = jPlayer.getQuestProgressions(jobProg.getJob()); @@ -65,8 +65,20 @@ public class quests implements Cmd { String msg = Jobs.getLanguage().getMessage("command.quests.output.questLine", "[progress]", progressLine, "[questName]", q.getQuest().getQuestName(), "[done]", q.getTotalAmountDone(), "[required]", q.getTotalAmountNeeded()); + String hoverMsg = Jobs.getLanguage().getMessage("command.quests.output.hover"); List hoverList = new ArrayList<>(); - hoverList.add(Jobs.getCommandManager().jobsQuestMessage(q, jobProg)); + for (String current : hoverMsg.split("\n")) { + current = current.replace("[jobName]", jobProg.getJob().getName()) + .replace("[time]", TimeManage.to24hourShort(q.getValidUntil() - System.currentTimeMillis())); + + if (current.contains("[desc]")) { + for (String one : q.getQuest().getDescription()) { + hoverList.add(one); + } + } else { + hoverList.add(current); + } + } for (Entry oneObjective : q.getQuest().getObjectives().entrySet()) { hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " + diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java index 62819460..f865db28 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetlimit.java @@ -24,7 +24,7 @@ public class resetlimit implements Cmd { } jPlayer.resetPaymentLimit(); - sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.resetlimit.output.reseted", "%playername%", jPlayer.getName())); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java index 9f86468d..90a15ecd 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/resetquest.java @@ -62,7 +62,7 @@ public class resetquest implements Cmd { jPlayer.resetQuests(); - sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("command.resetquest.output.reseted", "%playername%", jPlayer.getName())); return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java index 94135acd..606388d5 100644 --- a/src/main/java/com/gamingmesh/jobs/commands/list/stats.java +++ b/src/main/java/com/gamingmesh/jobs/commands/list/stats.java @@ -36,7 +36,7 @@ public class stats implements Cmd { return true; } - sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getUserName())); + sender.sendMessage(Jobs.getLanguage().getMessage("general.info.toplineseparator", "%playername%", jPlayer.getName())); for (JobProgression jobProg : jPlayer.getJobProgression()) { String[] msg = Jobs.getCommandManager().jobStatsMessage(jobProg).split("\n"); sender.sendMessage(msg); diff --git a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java index 7e3d8987..f9bc190c 100644 --- a/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/BossBarManager.java @@ -119,7 +119,7 @@ public class BossBarManager { if (target == null) return; bar.addPlayer(target); - OldOne = new BossBarInfo(player.getUserName(), jobProg.getJob().getName(), bar); + OldOne = new BossBarInfo(player.getName(), jobProg.getJob().getName(), bar); player.getBossBarInfo().add(OldOne); } bar.setVisible(true); @@ -133,7 +133,7 @@ public class BossBarManager { @Override public void run() { for (BossBarInfo one : player.getBossBarInfo()) { - if (!one.getPlayerName().equalsIgnoreCase(player.getUserName())) + if (!one.getPlayerName().equalsIgnoreCase(player.getName())) continue; if (!one.getJobName().equalsIgnoreCase(jobProg.getJob().getName())) diff --git a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java index 28322ee0..72230a8a 100644 --- a/src/main/java/com/gamingmesh/jobs/config/ShopManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/ShopManager.java @@ -193,7 +193,7 @@ public class ShopManager { skullMeta.setLore(Lore); if (item.isHeadOwner()) - skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getUserName()); + skullMeta.setOwner(Jobs.getPlayerManager().getJobsPlayer(player).getName()); else { try { OfflinePlayer offPlayer = Bukkit.getOfflinePlayer(item.getCustomHead()); diff --git a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java index 234b1d92..c8700eab 100644 --- a/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java +++ b/src/main/java/com/gamingmesh/jobs/container/JobsPlayer.java @@ -19,7 +19,6 @@ package com.gamingmesh.jobs.container; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -35,7 +34,6 @@ import com.gamingmesh.jobs.dao.JobsDAO; import com.gamingmesh.jobs.economy.PaymentData; import com.gamingmesh.jobs.resources.jfep.Parser; import com.gamingmesh.jobs.stuff.ChatColor; -import com.gamingmesh.jobs.stuff.Debug; import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling; import com.gamingmesh.jobs.stuff.TimeManage; diff --git a/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java b/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java index 8a5f4ebe..eb72e694 100644 --- a/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java +++ b/src/main/java/com/gamingmesh/jobs/container/PlayerInfo.java @@ -32,7 +32,7 @@ public class PlayerInfo { if (player == null) player = Jobs.getPlayerManager().getJobsPlayer(uuid); if (player != null) - return player.getUserName(); + return player.getName(); return name; } diff --git a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java index 722cb5c1..96298023 100644 --- a/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java +++ b/src/main/java/com/gamingmesh/jobs/container/QuestProgression.java @@ -7,7 +7,6 @@ import org.bukkit.Bukkit; import org.bukkit.event.server.ServerCommandEvent; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.stuff.Debug; public class QuestProgression { diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java index 875260f7..0d308c5e 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsDAO.java @@ -1786,7 +1786,7 @@ public abstract class JobsDAO { public JobsPlayer loadFromDao(JobsPlayer jPlayer) { - List list = getAllJobs(jPlayer.getUserName(), jPlayer.getUniqueId()); + List list = getAllJobs(jPlayer.getName(), jPlayer.getUniqueId()); // synchronized (jPlayer.saveLock) { jPlayer.progression.clear(); for (JobsDAOData jobdata : list) { @@ -1943,7 +1943,7 @@ public abstract class JobsDAO { + "` = ?, `" + UserTableFields.quests.getCollumn() + "` = ? WHERE `id` = ?;"); prest.setLong(1, System.currentTimeMillis()); - prest.setString(2, player.getUserName()); + prest.setString(2, player.getName()); prest.setInt(3, player.getDoneQuests()); prest.setString(4, player.getQuestProgressionString()); prest.setInt(5, player.getUserId()); @@ -1967,7 +1967,7 @@ public abstract class JobsDAO { + "`, `" + UserTableFields.donequests.getCollumn() + "`) VALUES (?, ?, ?, ?);"); prestt.setString(1, player.getUniqueId().toString()); - prestt.setString(2, player.getUserName()); + prestt.setString(2, player.getName()); prestt.setLong(3, player.getSeen()); prestt.setInt(4, 0); prestt.executeUpdate(); @@ -1987,7 +1987,7 @@ public abstract class JobsDAO { int id = res.getInt("id"); player.setUserId(id); Jobs.getPlayerManager().addPlayerToMap(new PlayerInfo( - player.getUserName(), + player.getName(), id, player.getUniqueId(), player.getSeen(), diff --git a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java index 62d6f582..8c17a85f 100644 --- a/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java +++ b/src/main/java/com/gamingmesh/jobs/listeners/JobsPaymentListener.java @@ -1151,7 +1151,7 @@ public class JobsPaymentListener implements Listener { if (lVictim instanceof Player && !lVictim.hasMetadata("NPC")) { Player VPlayer = (Player) lVictim; - if (jDamager.getUserName().equalsIgnoreCase(VPlayer.getName())) + if (jDamager.getName().equalsIgnoreCase(VPlayer.getName())) return; } diff --git a/src/main/java/com/gamingmesh/jobs/stuff/PerformCommands.java b/src/main/java/com/gamingmesh/jobs/stuff/PerformCommands.java index 9054b0b2..c126c9ce 100644 --- a/src/main/java/com/gamingmesh/jobs/stuff/PerformCommands.java +++ b/src/main/java/com/gamingmesh/jobs/stuff/PerformCommands.java @@ -16,7 +16,7 @@ public class PerformCommands { return; for (String one : cmds) { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", jPlayer.getUserName()).replace("[jobname]", job.getName())); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", jPlayer.getName()).replace("[jobname]", job.getName())); } } @@ -27,7 +27,7 @@ public class PerformCommands { return; for (String one : cmds) { - Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", jPlayer.getUserName()).replace("[jobname]", job.getName())); + Bukkit.dispatchCommand(Bukkit.getConsoleSender(), one.replace("[name]", jPlayer.getName()).replace("[jobname]", job.getName())); } } }