1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-06 00:08:13 +01:00

Lets remove data value for gui filler and back button as we can use full

names now
Set filler display name to empty field for better looks.
This commit is contained in:
Zrips 2018-11-12 12:38:08 +02:00
parent a75b128630
commit 66f2c4e743
3 changed files with 134 additions and 129 deletions

View File

@ -48,159 +48,159 @@ public class browse implements Cmd {
Job j = null;
int page = 1;
if (sender instanceof Player) {
for (String one : args) {
if (one.startsWith("-p:")) {
try {
page = Integer.parseInt(one.substring("-p:".length()));
continue;
} catch (Exception e) {
}
for (String one : args) {
if (one.startsWith("-p:")) {
try {
page = Integer.parseInt(one.substring("-p:".length()));
continue;
} catch (Exception e) {
}
}
}
}
for (String one : args) {
if (one.startsWith("-j:")) {
try {
j = Jobs.getJob(one.substring("-j:".length()));
continue;
} catch (Exception e) {
}
}
if (one.startsWith("-j:")) {
try {
j = Jobs.getJob(one.substring("-j:".length()));
continue;
} catch (Exception e) {
}
}
}
if (sender instanceof Player) {
if (j == null) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
for (Job one : jobList) {
if (!pi.isEntryOk())
continue;
if (pi.isBreak())
break;
if (j == null) {
PageInfo pi = new PageInfo(Jobs.getGCManager().getBrowseAmountToShow(), jobList.size(), page);
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.newHeader", "[amount]", jobList.size()));
for (Job one : jobList) {
if (!pi.isEntryOk())
continue;
if (pi.isBreak())
break;
RawMessage rm = new RawMessage();
RawMessage rm = new RawMessage();
String hoverMsg = "";
String hoverMsg = "";
if (!one.getDescription().isEmpty())
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one.getDescription().replace("/n", ""));
if (!one.getDescription().isEmpty())
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one.getDescription().replace("/n", ""));
if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender));
}
if (one.getMaxLevel(sender) > 0) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", one.getMaxLevel(sender));
}
if (Jobs.getGCManager().ShowTotalWorkers) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers());
if (Jobs.getGCManager().ShowTotalWorkers) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", one.getTotalPlayers());
}
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
if ((int) (one.getBonus() * 100) < 0)
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
if ((int) (one.getBonus() * 100) < 0)
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (one.getBonus() * 100));
}
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click");
if (!hoverMsg.isEmpty())
hoverMsg += " \n";
hoverMsg += Jobs.getLanguage().getMessage("command.browse.output.click");
rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()),
hoverMsg, "jobs browse -j:" + one.getName());
rm.add(Jobs.getLanguage().getMessage("command.browse.output.list", "[place]", pi.getPositionForOutput(), "[jobname]", one.getName()),
hoverMsg, "jobs browse -j:" + one.getName());
rm.show(sender);
}
plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:");
} else {
rm.show(sender);
}
plugin.ShowPagination(sender, pi.getTotalPages(), page, "jobs browse", "-p:");
} else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
if (j.getMaxLevel(sender) > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
if (j.getMaxLevel(sender) > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
}
}
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
}
}
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"),
Jobs.getLanguage().getMessage("command.browse.output.detailed"),
"jobs info " + j.getName());
rm.show(sender);
rm.clear();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"),
Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"),
"jobs join " + j.getName() + " -needConfirmation");
rm.show(sender);
}
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.detailed"),
Jobs.getLanguage().getMessage("command.browse.output.detailed"),
"jobs info " + j.getName());
rm.show(sender);
rm.clear();
rm.add(Jobs.getLanguage().getMessage("command.browse.output.chooseJob"),
Jobs.getLanguage().getMessage("command.browse.output.chooseJobHover"),
"jobs join " + j.getName() + " -needConfirmation");
rm.show(sender);
}
} else {
if (j == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n"));
for (Job one : jobList) {
if (j == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.console.newHeader", "[amount]", jobList.size(), "\\n", "\n"));
for (Job one : jobList) {
String msg = "";
String msg = "";
if (!one.getDescription().isEmpty())
msg += Jobs.getLanguage().getMessage("command.browse.output.console.description", "[description]", one.getDescription().replace("/n", ""));
if (!one.getDescription().isEmpty())
msg += Jobs.getLanguage().getMessage("command.browse.output.console.description", "[description]", one.getDescription().replace("/n", ""));
if (one.getMaxLevel(sender) > 0)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.newMax", "[max]", one.getMaxLevel(sender));
if (one.getMaxLevel(sender) > 0)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.newMax", "[max]", one.getMaxLevel(sender));
if (Jobs.getGCManager().ShowTotalWorkers)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.totalWorkers", "[amount]", one.getTotalPlayers());
if (Jobs.getGCManager().ShowTotalWorkers)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.totalWorkers", "[amount]", one.getTotalPlayers());
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (one.getBonus() * 100) < 0)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
msg += Jobs.getLanguage().getMessage("command.browse.output.console.bonus", "[amount]", (int) (one.getBonus() * 100));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (one.getBonus() * 100) < 0)
msg += Jobs.getLanguage().getMessage("command.browse.output.console.penalty", "[amount]", (int) (one.getBonus() * 100) * -1);
else
msg += Jobs.getLanguage().getMessage("command.browse.output.console.bonus", "[amount]", (int) (one.getBonus() * 100));
}
msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName());
msg += Jobs.getLanguage().getMessage("command.browse.output.console.list", "[jobname]", one.getName());
sender.sendMessage(msg);
}
} else {
sender.sendMessage(msg);
}
} else {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.jobHeader", "[jobname]", j.getName()));
if (j.getMaxLevel(sender) > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
if (j.getMaxLevel(sender) > 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.info.help.newMax", "[max]", j.getMaxLevel(sender)));
if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
if (Jobs.getGCManager().ShowTotalWorkers)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.totalWorkers", "[amount]", j.getTotalPlayers()));
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (Jobs.getGCManager().useDynamicPayment && Jobs.getGCManager().ShowPenaltyBonus) {
if ((int) (j.getBonus() * 100) < 0)
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.penalty", "[amount]", (int) (j.getBonus() * 100) * -1));
else
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.bonus", "[amount]", (int) (j.getBonus() * 100)));
}
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
}
}
}
if (!j.getFullDescription().isEmpty()) {
for (String one : j.getFullDescription()) {
sender.sendMessage(Jobs.getLanguage().getMessage("command.browse.output.description", "[description]", one));
}
}
}
}
} else {

View File

@ -32,6 +32,7 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.CMILib.ItemManager.CMIMaterial;
@ -446,9 +447,9 @@ public class GeneralConfigManager {
c.getW().addComment("selectionTool", "Tool used when selecting bounds for restricted area");
if (CMIMaterial.get(getSelectionTooldID) == null)
getSelectionTooldID = 294;
getSelectionTooldID = 294;
else
getSelectionTooldID = c.get("selectionTool", 294);
getSelectionTooldID = c.get("selectionTool", 294);
c.getW().addComment("MultiServerCompatability", "Enable if you are using one data base for multiple servers across bungee network",
"This will force to load players data every time he is logging in to have most up to date data instead of having preloaded data",
@ -844,11 +845,11 @@ public class GeneralConfigManager {
BossBarEnabled = c.get("BossBar.Enabled", true);
if (BossBarEnabled == true) {
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) {
Jobs.consoleMsg("&c[Jobs] Your server version don't support BossBar. This feature will be disabled.");
c.getW().set("BossBar.Enabled", false);
BossBarEnabled = false;
}
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) {
Jobs.consoleMsg("&c[Jobs] Your server version don't support BossBar. This feature will be disabled.");
c.getW().set("BossBar.Enabled", false);
BossBarEnabled = false;
}
}
c.getW().addComment("BossBar.Messages.EnabledByDefault", "When this set to true player will see Bossbar messages by default");
@ -932,10 +933,14 @@ public class GeneralConfigManager {
c.getW().addComment("JobsTop.AmountToShow", "Defines amount of players to be shown in one page for /jobs top & /jobs gtop");
JobsTopAmount = c.get("JobsTop.AmountToShow", 15);
Material tmat = Material.getMaterial(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
guiBackButton = new ItemStack(tmat == null ? Material.JACK_O_LANTERN : tmat, 1, (byte) c.get("JobsGUI.BackButton.Data", 0));
tmat = Material.getMaterial(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));
guiFiller = new ItemStack(tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE.getMaterial() : tmat, 1, (byte) c.get("JobsGUI.Filler.Data", 15));
CMIMaterial tmat = CMIMaterial.get(c.get("JobsGUI.BackButton.Material", "JACK_O_LANTERN"));
guiBackButton = tmat == null ? CMIMaterial.JACK_O_LANTERN.newItemStack() : tmat.newItemStack();
tmat = CMIMaterial.get(c.get("JobsGUI.Filler.Material", "STAINED_GLASS_PANE"));
guiFiller = tmat == null ? CMIMaterial.GREEN_STAINED_GLASS_PANE.newItemStack() : tmat.newItemStack();
ItemMeta meta = guiFiller.getItemMeta();
meta.setDisplayName("");
guiFiller.setItemMeta(meta);
// c.getW().addComment("Schedule.Boost.Enable", "Do you want to enable scheduler for global boost");
// useGlobalBoostScheduler = c.get("Schedule.Boost.Enable", false);

View File

@ -1104,7 +1104,7 @@ public class JobsPaymentListener implements Listener {
//disabling plugin in world
if (event.getEntity() != null && !Jobs.getGCManager().canPerformActionInWorld(event.getEntity().getWorld()))
return;
if (event.getSpawnReason() == SpawnReason.SPAWNER || event.getSpawnReason() == SpawnReason.SPAWNER_EGG) {
if (event.getSpawnReason().equals(SpawnReason.SPAWNER) || event.getSpawnReason().equals(SpawnReason.SPAWNER_EGG)) {
LivingEntity creature = event.getEntity();
creature.setMetadata(Jobs.getPlayerManager().getMobSpawnerMetadata(), new FixedMetadataValue(this.plugin, true));
}