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

Slot specific boosted items

This commit is contained in:
Zrips 2022-08-08 15:18:35 +03:00
parent b1a4e64288
commit c1675cf928
4 changed files with 920 additions and 879 deletions

Binary file not shown.

BIN
libs/CMILib1.2.3.3.jar Normal file

Binary file not shown.

View File

@ -31,6 +31,7 @@ import java.util.concurrent.ThreadLocalRandom;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
import org.bukkit.Material;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Firework;
@ -39,6 +40,7 @@ import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.FireworkMeta;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.gamingmesh.jobs.api.JobsJoinEvent;
@ -65,6 +67,7 @@ import com.gamingmesh.jobs.stuff.Util;
import net.Zrips.CMILib.ActionBar.CMIActionBar;
import net.Zrips.CMILib.Items.CMIItemStack;
import net.Zrips.CMILib.Items.CMIMaterial;
import net.Zrips.CMILib.Logs.CMIDebug;
import net.Zrips.CMILib.Messages.CMIMessages;
import net.Zrips.CMILib.NBT.CMINBT;
@ -994,20 +997,54 @@ public class PlayerManager {
// Check mainhand slot
if (Jobs.getGCManager().boostedItemsInMainHand) {
ItemStack iih = CMIItemStack.getItemInMainHand(player);
if (iih != null && Jobs.getGCManager().boostedItemsSlotSpecific && (!CMIMaterial.isArmor(iih.getType()) || CMIMaterial.isShield(iih.getType())) || !Jobs
.getGCManager().boostedItemsSlotSpecific) {
jitems.add(getJobsItemByNbt(CMIItemStack.getItemInMainHand(player)));
}
}
// Check offhand slot
if (Version.isCurrentEqualOrHigher(Version.v1_9_R1) && Jobs.getGCManager().boostedItemsInOffHand) {
ItemStack iih = CMIItemStack.getItemInOffHand(player);
if (iih != null && Jobs.getGCManager().boostedItemsSlotSpecific && (!CMIMaterial.isArmor(iih.getType()) || CMIMaterial.isShield(iih.getType())) || !Jobs
.getGCManager().boostedItemsSlotSpecific) {
jitems.add(getJobsItemByNbt(player.getInventory().getItemInOffHand()));
}
}
// Check armor slots
if (Jobs.getGCManager().boostedArmorItems) {
for (ItemStack oneArmor : player.getInventory().getArmorContents()) {
if (oneArmor != null && oneArmor.getType() != org.bukkit.Material.AIR) {
jitems.add(getJobsItemByNbt(oneArmor));
for (int i = 0; i < player.getInventory().getArmorContents().length; i++) {
ItemStack item = player.getInventory().getArmorContents()[i];
if (item == null || item.getType().equals(Material.AIR))
continue;
if (Jobs.getGCManager().boostedItemsSlotSpecific) {
//Boots
if (i == 0 && (!CMIMaterial.isArmor(item.getType()) || CMIMaterial.isArmor(item.getType()) && !CMIMaterial.isBoots(item.getType()))) {
continue;
}
//Leggings
if (i == 1 && (!CMIMaterial.isArmor(item.getType()) || CMIMaterial.isArmor(item.getType()) && !CMIMaterial.isLeggings(item.getType()))) {
continue;
}
//Chestplate
if (i == 2 && (!CMIMaterial.isArmor(item.getType()) || CMIMaterial.isArmor(item.getType()) && !CMIMaterial.isChestplate(item.getType()))) {
continue;
}
// Helmet slot
if (i == 3 && !CMIMaterial.isArmor(item.getType()) && (CMIMaterial.isWeapon(item.getType()) || CMIMaterial.isTool(item.getType())) || i == 3 && CMIMaterial.isArmor(item.getType())
&& !CMIMaterial.isHelmet(item.getType())) {
continue;
}
}
jitems.add(getJobsItemByNbt(item));
}
}

View File

@ -90,7 +90,7 @@ public class GeneralConfigManager {
SignsColorizeJobName, ShowToplistInScoreboard, useGlobalTimer, useSilkTouchProtection, UseCustomNames,
PreventSlimeSplit, PreventMagmaCubeSplit, PreventHopperFillUps, PreventBrewingStandFillUps, informOnPaymentDisable,
BrowseUseNewLook, payExploringWhenGliding = false, resetExploringData = false, disablePaymentIfMaxLevelReached, disablePaymentIfRiding,
boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, multiplyBoostedExtraValues/*, preventCropResizePayment*/, payItemDurabilityLoss,
boostedItemsInOffHand = false, boostedItemsInMainHand, boostedArmorItems, boostedItemsSlotSpecific, multiplyBoostedExtraValues/*, preventCropResizePayment*/, payItemDurabilityLoss,
applyToNegativeIncome, useMinimumOveralPayment, useMinimumOveralPoints, useMinimumOveralExp, useBreederFinder,
CancelCowMilking, fixAtMaxLevel, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
@ -479,6 +479,10 @@ public class GeneralConfigManager {
c.addComment("enable-boosted-armor-items", "Do the jobs boost ignore the boosted items usage in armor slots?");
boostedArmorItems = c.get("enable-boosted-armor-items", true);
c.addComment("boosted-items-slot-specific", "While this is enabled we will check if boosted item is in correct slot", "Armor items will be ignored if player only holds one in their hand",
"Tool and weapon items will be ignored if those are equiped in players armor slots", "None tool or weapon items will be allowed in players head slot");
boostedItemsSlotSpecific = c.get("boosted-items-slot-specific", true);
c.addComment("multiply-boosted-extra-values", "Extra boost values for nearSpawner and petPay will be multiplied by sum of other boost values",
"When set to true and for example nearSpawner set to -0.98 aka 2% of original payment with other bonuses which should double payment will result in you getting 4% instead of corrent 102% payment",
"If set to false all bonus are sumed to one");