1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-26 04:25:15 +01:00

Jobs price editor ingame

This commit is contained in:
Zrips 2017-08-31 14:11:50 +03:00
parent 25e3b87de5
commit 7f461910aa
4 changed files with 210 additions and 89 deletions

View File

@ -1256,4 +1256,28 @@ public class Jobs extends JavaPlugin {
} else } else
((CommandSender) sender).sendMessage(ChatColor.translateAlternateColorCodes('&', msg)); ((CommandSender) sender).sendMessage(ChatColor.translateAlternateColorCodes('&', msg));
} }
public void ShowPagination(CommandSender sender, int pageCount, int CurrentPage, String cmd) {
if (!(sender instanceof Player))
return;
if (!cmd.startsWith("/"))
cmd = "/" + cmd;
// String separator = Jobs.getLanguage().getMessage("command.help.output.fliperSimbols");
if (pageCount == 1)
return;
int NextPage = CurrentPage + 1;
NextPage = CurrentPage < pageCount ? NextPage : CurrentPage;
int Prevpage = CurrentPage - 1;
Prevpage = CurrentPage > 1 ? Prevpage : CurrentPage;
RawMessage rm = new RawMessage();
rm.add((CurrentPage > 1 ? Jobs.getLanguage().getMessage("command.help.output.prev") : Jobs.getLanguage().getMessage("command.help.output.prevOff")), CurrentPage > 1 ? "<<<" : null, CurrentPage > 1
? cmd + " " + Prevpage : null);
rm.add(pageCount > CurrentPage ? Jobs.getLanguage().getMessage("command.help.output.next") : Jobs.getLanguage().getMessage("command.help.output.nextOff"), pageCount > CurrentPage ? ">>>" : null,
pageCount > CurrentPage ? cmd + " " + NextPage : null);
if (pageCount != 0)
rm.show(sender);
}
} }

View File

@ -18,12 +18,12 @@ import com.gamingmesh.jobs.container.CurrencyType;
import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.Job;
import com.gamingmesh.jobs.container.JobInfo; import com.gamingmesh.jobs.container.JobInfo;
import com.gamingmesh.jobs.stuff.ChatColor; import com.gamingmesh.jobs.stuff.ChatColor;
import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.stuff.RawMessage; import com.gamingmesh.jobs.stuff.RawMessage;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
public class editjobs implements Cmd { public class editjobs implements Cmd {
// [jobName] [add/del/edit]
@Override @Override
@JobCommand(475) @JobCommand(475)
public boolean perform(Jobs plugin, CommandSender sender, String[] args) { public boolean perform(Jobs plugin, CommandSender sender, String[] args) {
@ -38,89 +38,83 @@ public class editjobs implements Cmd {
switch (args[0]) { switch (args[0]) {
case "list": case "list":
if (args.length == 1) { if (args.length == 1) {
showPath(player, null, null, null); showPath(player, null, null, null);
for (Job one : Jobs.getJobs()) { for (Job one : Jobs.getJobs()) {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(" -> [" + one.getChatColor() + one.getName() + "&r]", one.getName(), "jobs editjobs list " + one.getName()); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", one.getChatColor() + one.getName()), one.getName(), "jobs editjobs list " + one.getName());
rm.show(sender); rm.show(sender);
} }
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
return true; return true;
} }
if (args.length == 2) { if (args.length == 2) {
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) if (job == null)
return false; return false;
showPath(player, job, null, null); showPath(player, job, null, null);
for (ActionType oneI : ActionType.values()) { for (ActionType oneI : ActionType.values()) {
List<JobInfo> action = job.getJobInfo(oneI); List<JobInfo> action = job.getJobInfo(oneI);
if (action == null || action.isEmpty()) if (action == null || action.isEmpty())
continue; continue;
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(" -> &e[&6" + oneI.getName() + "&e]", oneI.getName(), "jobs editjobs list " + job.getName() + " " + oneI.getName()); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", oneI.getName()), oneI.getName(), "jobs editjobs list " + job.getName() + " " + oneI.getName()
rm.show(sender); + " 1");
}
Util.getJobsEditorMap().remove(player.getUniqueId());
return true;
}
if (args.length == 3) {
Job job = Jobs.getJob(args[1]);
if (job == null)
return false;
ActionType actionT = ActionType.getByName(args[2]);
if (actionT == null)
return false;
List<JobInfo> action = job.getJobInfo(actionT);
if (action == null || action.isEmpty())
return false;
showPath(player, job, actionT, null);
for (JobInfo one : action) {
String materialName = one.getName().toLowerCase().replace('_', ' ');
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
materialName = Jobs.getNameTranslatorManager().Translate(materialName, one);
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
RawMessage rm = new RawMessage();
rm.add(" -> &e[&6" + materialName + "&e] ", one.getName(), "jobs editjobs list " + job.getName() + " " + actionT.getName() + " " + one.getName());
rm.add("&c[X]", "Remove", "jobs editjobs remove " + job.getName() + " " + actionT.getName() + " " + one.getName());
rm.show(sender); rm.show(sender);
} }
RawMessage rm = new RawMessage();
rm.add(" -> &e[&2+&e]", "&eAdd new", "jobs editjobs add " + job.getName() + " " + actionT.getName());
rm.show(sender);
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
return true; return true;
} }
if (args.length == 4) { if (args.length == 4) {
Integer page = null;
try {
page = Integer.parseInt(args[3]);
} catch (Exception e) {
}
if (page != null) {
Job job = Jobs.getJob(args[1]);
if (job == null)
return false;
ActionType actionT = ActionType.getByName(args[2]);
if (actionT == null)
return false;
List<JobInfo> action = job.getJobInfo(actionT);
if (action == null || action.isEmpty())
return false;
showPath(player, job, actionT, null);
PageInfo pi = new PageInfo(15, action.size(), page);
for (JobInfo one : action) {
if (!pi.isEntryOk())
continue;
String materialName = one.getName().toLowerCase().replace('_', ' ');
materialName = Character.toUpperCase(materialName.charAt(0)) + materialName.substring(1);
materialName = Jobs.getNameTranslatorManager().Translate(materialName, one);
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.material", "%materialname%", materialName), one.getName(), "jobs editjobs list " + job.getName() + " " + actionT
.getName() + " " + one.getName());
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.materialRemove"), "&cRemove", "jobs editjobs remove " + job.getName() + " " + actionT.getName() + " " + one
.getName());
rm.show(sender);
}
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.materialAdd"), "&eAdd new", "jobs editjobs add " + job.getName() + " " + actionT.getName());
rm.show(sender);
Util.getJobsEditorMap().remove(player.getUniqueId());
Jobs.getInstance().ShowPagination(sender, pi.getTotalPages(), page, "jobs editjobs list " + job.getName() + " " + actionT.getName());
return true;
}
Job job = Jobs.getJob(args[1]); Job job = Jobs.getJob(args[1]);
if (job == null) if (job == null)
@ -151,16 +145,19 @@ public class editjobs implements Cmd {
showPath(player, job, actionT, jInfo); showPath(player, job, actionT, jInfo);
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add(" -> &eMoney: &6" + jInfo.getBaseIncome(), jInfo.getBaseIncome() + "", "jobs editjobs modify " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() + " money "); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.money", "%amount%", jInfo.getBaseIncome()), "&e" + jInfo.getBaseIncome(), "jobs editjobs modify " + job.getName() + " "
+ actionT.getName() + " " + jInfo.getName() + " money ");
rm.show(sender); rm.show(sender);
rm = new RawMessage(); rm = new RawMessage();
rm.add(" -> &ePoints: &6" + jInfo.getBasePoints(), jInfo.getBasePoints() + "", "jobs editjobs modify " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.points", "%amount%", jInfo.getBasePoints()), "&e" + jInfo.getBasePoints(), "jobs editjobs modify " + job.getName() + " "
+ actionT.getName() + " " + jInfo.getName()
+ " points "); + " points ");
rm.show(sender); rm.show(sender);
rm = new RawMessage(); rm = new RawMessage();
rm.add(" -> &eExp: &6" + jInfo.getBaseXp(), jInfo.getBaseXp() + "", "jobs editjobs modify " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() + " exp "); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.exp", "%amount%", jInfo.getBaseXp()), "&e" + jInfo.getBaseXp(), "jobs editjobs modify " + job.getName() + " " + actionT
.getName() + " " + jInfo.getName() + " exp ");
rm.show(sender); rm.show(sender);
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
@ -205,7 +202,7 @@ public class editjobs implements Cmd {
Util.getJobsEditorMap().put(player.getUniqueId(), "jobs editjobs modify " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() + " " + type.getName() + " "); Util.getJobsEditorMap().put(player.getUniqueId(), "jobs editjobs modify " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() + " " + type.getName() + " ");
sender.sendMessage(ChatColor.GOLD + "Enter new value"); sender.sendMessage(Jobs.getLanguage().getMessage("command.editjobs.help.modify.newValue"));
return true; return true;
} }
@ -252,8 +249,6 @@ public class editjobs implements Cmd {
return false; return false;
} }
sender.sendMessage("Set new value " + job.getName() + " " + actionT.getName() + " " + jInfo.getName() + " " + type.getName() + " " + value);
String sType = null; String sType = null;
switch (type) { switch (type) {
case EXP: case EXP:
@ -310,7 +305,6 @@ public class editjobs implements Cmd {
} }
if (jInfo == null) { if (jInfo == null) {
player.sendMessage("Cant find this one");
return true; return true;
} }
@ -318,7 +312,8 @@ public class editjobs implements Cmd {
Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath(), null); Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath(), null);
sender.sendMessage("Removed"); player.performCommand("jobs editjobs list " + job.getName() + " " + actionT.getName() + " 1");
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
return true; return true;
@ -345,12 +340,14 @@ public class editjobs implements Cmd {
return false; return false;
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add("&eEnter new name or press"); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.modify.enter"));
rm.add(" &6HAND ", "Press to grab info from item in your hand", "jobs editjobs add " + job.getName() + " " + actionT.getName() + " hand"); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.modify.hand"), Jobs.getLanguage().getMessage("command.editjobs.help.modify.handHover"), "jobs editjobs add " + job.getName()
rm.add("&eor"); + " " + actionT.getName() + " hand");
rm.add(" &6LOOKING AT", "Press to grab info from block you are looking", "jobs editjobs add " + job.getName() + " " + actionT.getName() + " looking"); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.modify.or"));
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.modify.look"), Jobs.getLanguage().getMessage("command.editjobs.help.modify.lookHover"), "jobs editjobs add " + job.getName()
+ " " + actionT.getName() + " looking");
rm.show(sender); rm.show(sender);
Util.getJobsEditorMap().put(player.getUniqueId(), "jobs editjobs add " + job.getName() + " " + actionT.getName() + " "); Util.getJobsEditorMap().put(player.getUniqueId(), "jobs editjobs add " + job.getName() + " " + actionT.getName() + " ");
return true; return true;
@ -414,8 +411,8 @@ public class editjobs implements Cmd {
if (matId != null) { if (matId != null) {
material = Material.getMaterial(matId); material = Material.getMaterial(matId);
if (material != null) { if (material != null) {
player.sendMessage("Job " + job.getName() + " " + actionT.getName() + " is using ID: " + key + "!"); player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " " + actionT.getName() + " is using ID: " + key + "!");
player.sendMessage("Please use the Material name instead: " + material.toString() + "!"); player.sendMessage(ChatColor.GOLD + "Please use the Material name instead: " + material.toString() + "!");
} }
} }
} }
@ -446,16 +443,16 @@ public class editjobs implements Cmd {
if (actionT == ActionType.BREAK || actionT == ActionType.PLACE) { if (actionT == ActionType.BREAK || actionT == ActionType.PLACE) {
if (!material.isBlock()) { if (!material.isBlock()) {
player.sendMessage("Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key
+ "! Material must be a block!"); + "! Material must be a block!");
break; break;
} }
} }
if (material == Material.REDSTONE_ORE && actionT == ActionType.BREAK) { if (material == Material.REDSTONE_ORE && actionT == ActionType.BREAK) {
player.sendMessage("Job " + job.getName() + " is using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE."); player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " is using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE.");
player.sendMessage("Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration."); player.sendMessage(ChatColor.GOLD + "Automatically changing block to GLOWING_REDSTONE_ORE. Please update your configuration.");
player.sendMessage("In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with."); player.sendMessage(ChatColor.GOLD + "In vanilla minecraft, REDSTONE_ORE changes to GLOWING_REDSTONE_ORE when interacted with.");
player.sendMessage("In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly."); player.sendMessage(ChatColor.GOLD + "In the future, Jobs using REDSTONE_ORE instead of GLOWING_REDSTONE_ORE may fail to work correctly.");
material = Material.GLOWING_REDSTONE_ORE; material = Material.GLOWING_REDSTONE_ORE;
} }
@ -532,7 +529,7 @@ public class editjobs implements Cmd {
try { try {
amount = Integer.valueOf(myKey); amount = Integer.valueOf(myKey);
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
player.sendMessage("Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key + "!"); player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key + "!");
break; break;
} }
Jobs.getExplore().setExploreEnabled(); Jobs.getExplore().setExploreEnabled();
@ -542,7 +539,7 @@ public class editjobs implements Cmd {
} }
if (type == null) { if (type == null) {
player.sendMessage("Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key + "!"); player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key + "!");
break; break;
} }
@ -571,7 +568,7 @@ public class editjobs implements Cmd {
Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/income", 0); Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/income", 0);
Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/points", 0); Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/points", 0);
Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/experience", 0); Jobs.getConfigManager().changeJobsSettings(jInfo.getConfigPath() + "/experience", 0);
Util.getJobsEditorMap().remove(player.getUniqueId()); Util.getJobsEditorMap().remove(player.getUniqueId());
return true; return true;
@ -583,22 +580,22 @@ public class editjobs implements Cmd {
return true; return true;
} }
private void showPath(Player player, Job job, ActionType action, JobInfo jInfo) { private static void showPath(Player player, Job job, ActionType action, JobInfo jInfo) {
RawMessage rm = new RawMessage(); RawMessage rm = new RawMessage();
rm.add("&eJobs:", "&eJob list", "jobs editjobs"); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.job"), "&eJob list", "jobs editjobs");
rm.show(player); rm.show(player);
if (job != null) { if (job != null) {
rm = new RawMessage(); rm = new RawMessage();
rm.add(" -> [" + job.getChatColor() + job.getName() + "&r]", job.getName(), "jobs editjobs list " + job.getName()); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.jobs", "%jobname%", job.getChatColor() + job.getName()), job.getName(), "jobs editjobs list " + job.getName());
rm.show(player); rm.show(player);
} }
if (action != null && job != null) { if (action != null && job != null) {
rm = new RawMessage(); rm = new RawMessage();
rm.add(" -> &e[&6" + action.getName() + "&e]", action.getName(), "jobs editjobs list " + job.getName() + " " + action.getName()); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.actions", "%actionname%", action.getName()), action.getName(), "jobs editjobs list " + job.getName() + " " + action.getName() + " 1");
rm.show(player); rm.show(player);
} }
@ -610,7 +607,7 @@ public class editjobs implements Cmd {
materialName = Jobs.getNameTranslatorManager().Translate(materialName, jInfo); materialName = Jobs.getNameTranslatorManager().Translate(materialName, jInfo);
materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName); materialName = org.bukkit.ChatColor.translateAlternateColorCodes('&', materialName);
rm.add(" -> &e[&6" + jInfo.getName() + "&e]", jInfo.getName(), "jobs editjobs list " + job.getName() + " " + action.getName() + " " + materialName); rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.material", "%materialname%", jInfo.getName()), jInfo.getName(), "jobs editjobs list " + job.getName() + " " + action.getName() + " " + materialName);
rm.show(player); rm.show(player);
} }
} }

View File

@ -5,8 +5,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.container.LocaleReader; import com.gamingmesh.jobs.container.LocaleReader;
@ -58,13 +56,13 @@ public class LanguageManager {
for (String lang : languages) { for (String lang : languages) {
File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); File f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
// Fail safe if file get corrupted and being created with corrupted data, we need to recreate it // Fail safe if file get corrupted and being created with corrupted data, we need to recreate it
if ((f.length() / 1024) > 1024) { if ((f.length() / 1024) > 1024) {
f.delete(); f.delete();
f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml"); f = new File(plugin.getDataFolder(), "locale" + File.separator + "messages_" + lang + ".yml");
} }
YamlConfiguration config = YamlConfiguration.loadConfiguration(f); YamlConfiguration config = YamlConfiguration.loadConfiguration(f);
CommentedYamlConfiguration writer = new CommentedYamlConfiguration(); CommentedYamlConfiguration writer = new CommentedYamlConfiguration();
@ -169,8 +167,11 @@ public class LanguageManager {
c.get("command.help.output.usage", "Usage: %usage%"); c.get("command.help.output.usage", "Usage: %usage%");
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------"); c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----"); c.get("command.help.output.page", "&e-----&e ====== Page &6[1] &eof &6[2] &e====== &e-----");
c.get("command.help.output.fliperSimbols", "&e----------");
c.get("command.help.output.prev", "&e--- <<<<< &6Prev page &e|"); c.get("command.help.output.prev", "&e--- <<<<< &6Prev page &e|");
c.get("command.help.output.prevOff", "&7--- <<<<< Prev page &e|");
c.get("command.help.output.next", "&e|&6 Next Page &e>>>> ---"); c.get("command.help.output.next", "&e|&6 Next Page &e>>>> ---");
c.get("command.help.output.nextOff", "&e|&7 Next Page >>>> ---");
c.get("command.points.help.info", "Shows how much points player have."); c.get("command.points.help.info", "Shows how much points player have.");
c.get("command.points.help.args", "[playername]"); c.get("command.points.help.args", "[playername]");
@ -185,6 +186,25 @@ public class LanguageManager {
c.get("command.editpoints.output.add", "&ePlayer (&6%playername%&e) got aditinal &6%amount% &epoints. Now he has &6%total%"); c.get("command.editpoints.output.add", "&ePlayer (&6%playername%&e) got aditinal &6%amount% &epoints. Now he has &6%total%");
c.get("command.editpoints.output.take", "&ePlayer (&6%playername%&e) lost &6%amount% &epoints. Now he has &6%total%"); c.get("command.editpoints.output.take", "&ePlayer (&6%playername%&e) lost &6%amount% &epoints. Now he has &6%total%");
c.get("command.editjobs.help.info", "Edit current jobs.");
c.get("command.editjobs.help.args", "");
c.get("command.editjobs.help.list.job", "&eJobs:");
c.get("command.editjobs.help.list.jobs", " -> [&e%jobname%&r]");
c.get("command.editjobs.help.list.actions", " -> [&e%actionname%&r]");
c.get("command.editjobs.help.list.material", " -> [&e%materialname%&r] ");
c.get("command.editjobs.help.list.materialRemove", "&c[X]");
c.get("command.editjobs.help.list.materialAdd", " -> &e[&2+&e]");
c.get("command.editjobs.help.list.money", " -> &eMoney: &6%amount%");
c.get("command.editjobs.help.list.exp", " -> &ePoints: &6%amount%");
c.get("command.editjobs.help.list.points", " -> &eExp: &6%amount%");
c.get("command.editjobs.help.modify.newValue", "&eEnter new value");
c.get("command.editjobs.help.modify.enter", "&eEnter new name or press ");
c.get("command.editjobs.help.modify.hand", "&6HAND ");
c.get("command.editjobs.help.modify.handHover", "&6Press to grab info from item in your hand");
c.get("command.editjobs.help.modify.or", "&eor ");
c.get("command.editjobs.help.modify.look", "&6LOOKING AT");
c.get("command.editjobs.help.modify.lookHover", "&6Press to grab info from block you are looking");
c.get("command.blockinfo.help.info", "Shows block information you looking at."); c.get("command.blockinfo.help.info", "Shows block information you looking at.");
c.get("command.blockinfo.help.args", ""); c.get("command.blockinfo.help.args", "");
c.get("command.blockinfo.output.name", " &eBlock name: &6%blockname%"); c.get("command.blockinfo.output.name", " &eBlock name: &6%blockname%");
@ -415,7 +435,7 @@ public class LanguageManager {
c.get("command.promote.help.args", "[playername] [jobname] [levels]"); c.get("command.promote.help.args", "[playername] [jobname] [levels]");
Jobs.getGCManager().commandArgs.put("promote", Arrays.asList("[playername]", "[jobname]", "[levels]")); Jobs.getGCManager().commandArgs.put("promote", Arrays.asList("[playername]", "[jobname]", "[levels]"));
c.get("command.promote.output.target", "You have been promoted %levelsgained% levels in %jobname%."); c.get("command.promote.output.target", "You have been promoted %levelsgained% levels in %jobname%.");
c.get("command.exp.help.info", "Change the player exp for job."); c.get("command.exp.help.info", "Change the player exp for job.");
c.get("command.exp.help.args", "[playername] [jobname] [set/add/take] [amount]"); c.get("command.exp.help.args", "[playername] [jobname] [set/add/take] [amount]");
Jobs.getGCManager().commandArgs.put("exp", Arrays.asList("[playername]", "[jobname]", "take%%set%%add")); Jobs.getGCManager().commandArgs.put("exp", Arrays.asList("[playername]", "[jobname]", "take%%set%%add"));

View File

@ -0,0 +1,80 @@
package com.gamingmesh.jobs.stuff;
public class PageInfo {
private int totalEntries = 0;
private int totalPages = 0;
private int start = 0;
private int end = 0;
private int currentPage = 0;
private int currentEntry = 0;
private int perPage = 6;
public PageInfo(int perPage, int totalEntries, int currentPage) {
this.perPage = perPage;
this.totalEntries = totalEntries;
this.currentPage = currentPage;
calculate();
}
public int getPositionForOutput() {
return currentEntry;
}
public int getPositionForOutput(int place) {
return this.start + place + 1;
}
private void calculate() {
this.start = (this.currentPage - 1) * this.perPage;
this.end = this.start + this.perPage - 1;
if (this.end + 1 > this.totalEntries)
this.end = this.totalEntries - 1;
this.totalPages = (int) Math.ceil((double) this.totalEntries / (double) this.perPage);
}
public boolean isInRange(int place) {
if (place >= start && place <= end)
return true;
return false;
}
public boolean isEntryOk() {
currentEntry++;
return currentEntry - 1 >= start && currentEntry - 1 <= end;
}
public boolean isPageOk() {
return isPageOk(this.currentPage);
}
public boolean isPageOk(int page) {
if (this.totalPages < page)
return false;
if (page < 1)
return false;
return true;
}
public int getStart() {
return start;
}
public int getEnd() {
return end;
}
public int getTotalPages() {
return totalPages;
}
public int getCurrentPage() {
return currentPage;
}
public int getTotalEntries() {
return totalEntries;
}
}