1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 12:05:16 +01:00

Re-worked the quest list to support crowdin

- Fixed %titlename% placeholder does not showed anything
- Re-added Cat, Cat is ALIVE!!
This commit is contained in:
montlikadani 2019-08-19 18:31:29 +02:00
parent c5d967a2f1
commit 88c6d1fc38
11 changed files with 59 additions and 77 deletions

View File

@ -77,8 +77,8 @@
<!-- WorldGuard new version -->
<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-legacy</artifactId>
<version>7.0.0-SNAPSHOT</version>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.1-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
@ -94,7 +94,7 @@
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>
@ -109,7 +109,7 @@
<dependency>
<groupId>com.sk89q.worldedit</groupId>
<artifactId>worldedit-core</artifactId>
<version>7.0.0-SNAPSHOT</version>
<version>7.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>bukkit</artifactId>

View File

@ -132,7 +132,6 @@ public class ItemManager {
/**
* Gets the item by material
*
* @deprecated Use {@link #getItem(ItemStack)}
* @param mat Material
* @return {@link CMIItemStack}
@ -181,7 +180,7 @@ public class ItemManager {
String a = name.split("-")[1];
try {
amount = Integer.parseInt(a);
} catch (Throwable e) {
} catch (NumberFormatException e) {
}
name = name.split("-")[0];
}
@ -191,7 +190,7 @@ public class ItemManager {
if (name.contains(":")) {
try {
data = (short) Integer.parseInt(name.split(":")[1]);
} catch (Throwable e) {
} catch (NumberFormatException e) {
}
try {
CMIEntityType e = CMIEntityType.getByName(name.split(":")[1]);
@ -276,7 +275,7 @@ public class ItemManager {
if (cm == null) {
try {
cm = byId.get(Integer.parseInt(name));
} catch (Throwable e) {
} catch (NumberFormatException e) {
}
if (cm == null) {
@ -354,7 +353,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)) {
if (ncm.getCMIType().isPotion() || ncm.getCMIType().equals(CMIMaterial.TIPPED_ARROW)) {
Integer d = null;
PotionEffectType type = null;
Boolean upgraded = false;
@ -632,6 +631,7 @@ public class ItemManager {
ENDERMITE(67, "Endermite"),
GUARDIAN(68, "Guardian"),
SHULKER(69, "Shulker"),
CAT(75, "Cat"),
PIG(90, "Pig"),
SHEEP(91, "Sheep"),
COW(92, "Cow"),
@ -640,7 +640,7 @@ public class ItemManager {
WOLF(95, "Wolf"),
MUSHROOM_COW(96, "Mushroom Cow", "Mooshroom"),
SNOWMAN(97, "Snowman"),
OCELOT(98, "Ocelot", "Cat"),
OCELOT(98, "Ocelot"),
IRON_GOLEM(99, "Iron Golem"),
HORSE(100, "Horse"),
RABBIT(101, "Rabbit"),
@ -732,7 +732,7 @@ public class ItemManager {
}
public static CMIEntityType getByName(String name) {
String main = name;
String main = name;
String sub = null;
if (name.contains("_")) {
@ -752,7 +752,7 @@ public class ItemManager {
Integer id = null;
try {
id = Integer.parseInt(main);
} catch (Exception e) {
} catch (NumberFormatException e) {
}
for (CMIEntityType one : CMIEntityType.values()) {
@ -1910,7 +1910,6 @@ public class ItemManager {
/**
* Get the legacy id from the material enum
*
* @deprecated Not used, above 1.13
* @return legacy id
*/
@ -1921,7 +1920,6 @@ public class ItemManager {
/**
* Get the id from the material enum
*
* @deprecated If the id is exist under 1.13 then success
* @return id
*/
@ -1997,7 +1995,6 @@ public class ItemManager {
/**
* Get the data
*
* @deprecated Not used, above 1.13+
* @return data
*/
@ -2011,7 +2008,6 @@ public class ItemManager {
/**
* Get the legacy data
*
* @deprecated Not used, above 1.13+
* @return legacy data
*/
@ -2021,7 +2017,6 @@ public class ItemManager {
}
public static CMIMaterial getRandom(CMIMaterial mat) {
List<CMIMaterial> ls = new ArrayList<CMIMaterial>();
for (CMIMaterial one : CMIMaterial.values()) {
@ -2077,7 +2072,7 @@ public class ItemManager {
if (Version.isCurrentEqualOrLower(Version.v1_13_R2)) {
try {
ids = Integer.parseInt(id);
} catch (Throwable e) {
} catch (NumberFormatException e) {
if (id.contains(":")) {
try {
ids = Integer.parseInt(id.split(":")[0]);
@ -2089,7 +2084,7 @@ public class ItemManager {
try {
data = Integer.parseInt(id.split(":")[1]);
id = id.split(":")[0];
} catch (Throwable t) {
} catch (NumberFormatException t) {
}
}
}

View File

@ -33,27 +33,27 @@ public class ItemReflection {
private static void initialize() {
try {
CraftServerClass = getBukkitClass("CraftServer");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
CraftServer = CraftServerClass.cast(Bukkit.getServer());
} catch (SecurityException | IllegalArgumentException e) {
} catch (ClassCastException e) {
e.printStackTrace();
}
try {
CraftItemStack = getBukkitClass("inventory.CraftItemStack");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
Item = getMinecraftClass("Item");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
IStack = getMinecraftClass("ItemStack");
} catch (ClassNotFoundException | SecurityException | IllegalArgumentException e) {
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}

View File

@ -36,8 +36,9 @@ 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.Title;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.stuff.PageInfo;
import com.gamingmesh.jobs.stuff.TimeManage;
public class JobsCommands implements CommandExecutor {
private static final String label = "jobs";
@ -488,17 +489,12 @@ public class JobsCommands implements CommandExecutor {
* @return the message
*/
public String jobStatsMessage(JobProgression jobProg) {
Title t = null;
for (Title title : new ArrayList<Title>()) {
if (t == null)
t = title;
}
String message = Jobs.getLanguage().getMessage("command.stats.output",
"%joblevel%", jobProg.getLevel(),
"%jobname%", jobProg.getJob().getChatColor() + jobProg.getJob().getName(),
"%jobxp%", Math.round(jobProg.getExperience() * 100.0) / 100.0,
"%jobmaxxp%", jobProg.getMaxExperience(),
"%titlename%", t == null ? "" : t.getName());
"%titlename%", Jobs.gettitleManager().getTitle(jobProg.getLevel(), jobProg.getJob().getName()).getName());
return " " + jobProgressMessage(jobProg.getMaxExperience(), jobProg.getExperience()) + " " + message;
}
@ -539,4 +535,18 @@ 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;
}
}

View File

@ -76,7 +76,7 @@ public class editjobs implements Cmd {
Integer page = null;
try {
page = Integer.parseInt(args[3]);
} catch (Throwable e) {
} catch (NumberFormatException e) {
}
if (page != null) {

View File

@ -55,7 +55,7 @@ public class exp implements Cmd {
double amount = 0.0;
try {
amount = Double.parseDouble(args[3]);
} catch (Throwable e) {
} catch (NumberFormatException e) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.admin.error"));
return true;
}

View File

@ -27,12 +27,9 @@ public class expboost implements Cmd {
return true;
}
String PlayerName = sender.getName();
String jobName = args[0];
Job job = Jobs.getJob(jobName);
if (PlayerName == null) {
Jobs.getCommandManager().sendUsage(sender, "expboost");
Job job = Jobs.getJob(args[0]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
@ -40,6 +37,7 @@ public class expboost implements Cmd {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.EXP, 1.0);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.allreset"));
return true;
} else if (args[0].equalsIgnoreCase("reset")) {
@ -59,7 +57,6 @@ public class expboost implements Cmd {
}
if (args[0].equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.EXP, rate);
}
@ -67,10 +64,7 @@ public class expboost implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostalladded", "%boost%", rate));
return true;
}
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.EXP, rate);
sender.sendMessage(Jobs.getLanguage().getMessage("command.expboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
return true;

View File

@ -28,19 +28,18 @@ public class moneyboost implements Cmd {
return true;
}
String PlayerName = sender.getName();
String jobName = args[0];
Job job = Jobs.getJob(jobName);
if (PlayerName == null) {
Jobs.getCommandManager().sendUsage(sender, "moneyboost");
Job job = Jobs.getJob(args[0]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
if (args[0].equalsIgnoreCase("reset") && args[1].equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.MONEY, 1.0);
}
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.allreset"));
return true;
} else if (args[0].equalsIgnoreCase("reset")) {
@ -60,7 +59,6 @@ public class moneyboost implements Cmd {
}
if (args[0].equalsIgnoreCase("all")) {
for (Job one : Jobs.getJobs()) {
one.addBoost(CurrencyType.MONEY, rate);
}
@ -68,10 +66,7 @@ public class moneyboost implements Cmd {
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostalladded", "%boost%", rate));
return true;
}
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));
return true;
}
job.addBoost(CurrencyType.MONEY, rate);
sender.sendMessage(Jobs.getLanguage().getMessage("command.moneyboost.output.boostadded", "%boost%", rate, "%jobname%", job.getName()));
return true;

View File

@ -15,7 +15,6 @@ import com.gamingmesh.jobs.container.JobsPlayer;
import com.gamingmesh.jobs.container.QuestObjective;
import com.gamingmesh.jobs.container.QuestProgression;
import com.gamingmesh.jobs.CMILib.RawMessage;
import com.gamingmesh.jobs.stuff.TimeManage;
public class quests implements Cmd {
@ -64,19 +63,8 @@ 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());
List<String> hoverMsgs = Jobs.getLanguage().getMessageList("command.quests.output.hover");
List<String> hoverList = new ArrayList<>();
for (String current : hoverMsgs) {
current = current.replace("[jobName]", jobProg.getJob().getName());
current = current.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);
}
hoverList.add(Jobs.getCommandManager().jobsQuestMessage(q, jobProg));
for (Entry<String, QuestObjective> oneObjective : q.getQuest().getObjectives().entrySet()) {
hoverList.add(Jobs.getLanguage().getMessage("command.info.output." + oneObjective.getValue().getAction().toString().toLowerCase() + ".info") + " " +

View File

@ -157,7 +157,7 @@ public class LanguageManager {
c.get("command.help.output.label", "Jobs");
c.get("command.help.output.cmdInfoFormat", "[command] &f- &2[description]");
c.get("command.help.output.cmdFormat", "&7/[command]&f[arguments]");
c.get("command.help.output.cmdFormat", "&7/[command] &f[arguments]");
c.get("command.help.output.helpPageDescription", "&2* [description]");
c.get("command.help.output.title", "&e-------&e ======= &6Jobs &e======= &e-------");
@ -485,10 +485,10 @@ public class LanguageManager {
c.get("command.quests.help.args", "[playername]");
Jobs.getGCManager().getCommandArgs().put("quests", Arrays.asList("[playername]"));
c.get("command.quests.error.noquests", "&cThere are no quests");
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName]&2(&f[questsDone]&2) &7***********************");
c.get("command.quests.toplineseparator", "&7*********************** &6[playerName] &2(&f[questsDone]&2) &7***********************");
c.get("command.quests.output.completed", "&2 !Completed!&r ");
c.get("command.quests.output.questLine", "[progress] &7[questName] &f[done]&7/&8[required]");
c.get("command.quests.output.hover", Arrays.asList("&f[jobName]", "[desc]", "&7New quest in: [time]"));
c.get("command.quests.output.hover", "&f[jobName] \n[desc] \n&7New quest in: [time]");
c.get("command.fire.help.info", "Fire the player from the job.");
c.get("command.fire.help.args", "[playername] [jobname]");

View File

@ -29,13 +29,13 @@ public class Util {
public static List<String> confirmLeave = new ArrayList<>();
@SuppressWarnings("deprecation")
public static ItemStack setEntityType(ItemStack is, EntityType type) throws IllegalArgumentException {
public static ItemStack setEntityType(ItemStack is, EntityType type) {
boolean useMeta;
try {
ItemStack testis = CMIMaterial.SPAWNER.newItemStack();
ItemMeta meta = testis.getItemMeta();
useMeta = meta instanceof BlockStateMeta;
} catch (Throwable e) {
} catch (Exception e) {
useMeta = false;
}
@ -126,7 +126,7 @@ public class Util {
continue;
if (lookingFor == null) {
if (!CMIMaterial.AIR.equals(material) && !CMIMaterial.CAVE_AIR.equals(material) && !CMIMaterial.VOID_AIR.equals(material)) {
if (!CMIMaterial.isAir(material)) {
break;
}
} else {