1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-02 14:29:07 +01:00

Should fixed issue when the JobsPrePaymentEvent getJob method always returns null

This commit is contained in:
montlikadani 2019-09-14 16:14:38 +02:00
parent b0aaeb346e
commit 6cd52625e2
5 changed files with 12 additions and 19 deletions

View File

@ -5,7 +5,7 @@
- Implement more API event methods to PrePaymentEvent
- Fixed issue when the JobsExpGainEvent called when the income 0.
- Fixed issue when used the enchanted books, then can't enchanted properly
- Added argument for signUpdate command
- Added argument for signUpdate command, to update all signs
- Removed hack for removing items from inventory when in browse GUI
- Fixed issue when the player gliding is not valid in 1.9.1 version
- Fixed signs updating
@ -13,3 +13,6 @@
- New placeholder %jobsr_user_job_(jname/number)% to show the player job.
- Added option to ignore the boosted items usage in off hand.
- Fixed money dupping issue when left clicked to block and earn income
- Fixed 1.11 & 1.12 entities don't work
- Fix bone meals dupping issue when interacted with seeds
- Should fixed issue when the JobsPrePaymentEvent getJob method always returns null

View File

@ -1139,7 +1139,7 @@ public class Jobs extends JavaPlugin {
Boost boost = getPlayerManager().getFinalBonus(jPlayer, prog.getJob(), ent, victim);
JobsPrePaymentEvent JobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), noneJob, income,
JobsPrePaymentEvent JobsPrePaymentEvent = new JobsPrePaymentEvent(jPlayer.getPlayer(), prog.getJob(), income,
pointAmount, block, ent, victim, info);
Bukkit.getServer().getPluginManager().callEvent(JobsPrePaymentEvent);
// If event is canceled, don't do anything

View File

@ -95,10 +95,7 @@ public class editjobs implements Cmd {
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);
String materialName = one.getRealisticName();
RawMessage rm = new RawMessage();
rm.add(Jobs.getLanguage().getMessage("command.editjobs.help.list.material", "%materialname%", materialName), one.getName(), "jobs editjobs list " + job.getName() + " " + actionT
@ -494,10 +491,7 @@ public class editjobs implements Cmd {
// check entities
EntityType entity = EntityType.fromName(myKey.toUpperCase());
if (entity == null) {
try {
entity = EntityType.valueOf(myKey.toUpperCase());
} catch (IllegalArgumentException e) {
}
entity = EntityType.valueOf(myKey.toUpperCase());
}
if (entity != null && entity.isAlive()) {
@ -565,7 +559,8 @@ public class editjobs implements Cmd {
}
}
type = myKey;
} else if (actionT == ActionType.CUSTOMKILL || actionT == ActionType.SHEAR || actionT == ActionType.MMKILL)
} else if (actionT == ActionType.CUSTOMKILL || actionT == ActionType.SHEAR || actionT == ActionType.MMKILL
|| actionT == ActionType.COLLECT)
type = myKey;
else if (actionT == ActionType.EXPLORE) {
type = myKey;
@ -580,9 +575,6 @@ public class editjobs implements Cmd {
Jobs.getExplore().setPlayerAmount(amount + 1);
} else if (actionT == ActionType.CRAFT && myKey.startsWith("!"))
type = myKey.substring(1, myKey.length());
else if (actionT == ActionType.COLLECT) {
type = myKey;
}
if (type == null) {
player.sendMessage(ChatColor.GOLD + "Job " + job.getName() + " has an invalid " + actionT.getName() + " type property: " + key + "!");

View File

@ -1138,7 +1138,8 @@ public class ConfigManager {
continue;
}
type = enchant == null ? myKey : enchant.toString();
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.SHEAR || actionType == ActionType.MMKILL)
} else if (actionType == ActionType.CUSTOMKILL || actionType == ActionType.COLLECT || actionType == ActionType.MMKILL
|| actionType == ActionType.SHEAR)
type = myKey;
else if (actionType == ActionType.EXPLORE) {
type = myKey;
@ -1153,9 +1154,6 @@ public class ConfigManager {
Jobs.getExplore().setPlayerAmount(amount + 1);
} else if (actionType == ActionType.CRAFT && myKey.startsWith("!"))
type = myKey.substring(1, myKey.length());
else if (actionType == ActionType.COLLECT) {
type = myKey;
}
if (type == null) {
Jobs.getPluginLogger().warning("Job " + jobKey + " has an invalid " + actionType.getName() + " type property: " + key + "!");

View File

@ -426,7 +426,7 @@ public class JobsPaymentListener implements Listener {
return;
if (Version.isCurrentEqualOrLower(Version.v1_12_R1)
&& ItemManager.getItem(event.getItemInHand()).isSimilar(ItemManager.getItem(CMIMaterial.BONE_MEAL)))
&& ItemManager.getItem(event.getItemInHand()).isSimilar(ItemManager.getItem(CMIMaterial.BONE_MEAL)))
return;
// check if in creative