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

Fix nearspawner does not accepts minus values

Fixes #998
This commit is contained in:
montlikadani 2020-11-13 08:04:03 +01:00
parent f7313be846
commit f55c02570e
5 changed files with 60 additions and 73 deletions

View File

@ -18,7 +18,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.3-R0.1-SNAPSHOT</version>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- McMMO -->
@ -153,6 +153,7 @@
<groupId>com.github.Nathat23</groupId>
<artifactId>StackMob-5</artifactId>
<version>master-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- MyPet -->
<dependency>
@ -220,7 +221,7 @@
<!-- Make a Jar -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>

View File

@ -258,9 +258,7 @@ public class PlayerManager {
* Save all the information of all of the players
*/
public void convertChacheOfPlayers(boolean resetID) {
int y = 0;
int i = 0;
int total = playersUUIDCache.size();
int y = 0, i = 0, total = playersUUIDCache.size();
for (JobsPlayer jPlayer : playersUUIDCache.values()) {
if (resetID)
@ -917,11 +915,8 @@ public class PlayerManager {
if (itemName == null)
return null;
}
JobItems b = ItemBoostManager.getItemByKey(itemName.toString());
if (b == null)
return null;
return b;
return ItemBoostManager.getItemByKey(itemName.toString());
}
// public BoostMultiplier getJobsBoostByNbt(ItemStack item) {
@ -960,34 +955,34 @@ public class PlayerManager {
if (HookManager.getMcMMOManager().mcMMOPresent || HookManager.getMcMMOManager().mcMMOOverHaul)
boost.add(BoostOf.McMMO, new BoostMultiplier().add(HookManager.getMcMMOManager().getMultiplier(player.getPlayer())));
Double petPay = null;
double petPay = 0D;
if (ent instanceof Tameable) {
Tameable t = (Tameable) ent;
if (t.isTamed() && t.getOwner() instanceof Player) {
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false, true);
if (petPay != null)
if (petPay != 0D)
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
}
}
if (ent != null && HookManager.getMyPetManager() != null && HookManager.getMyPetManager().isMyPet(ent, player.getPlayer())) {
if (petPay == null)
if (petPay == 0D)
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", false, false, true);
if (petPay != null)
if (petPay != 0D)
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
}
if (victim != null && victim.hasMetadata(getMobSpawnerMetadata())) {
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner");
if (amount != null)
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", false, false, true);
if (amount != 0D)
boost.add(BoostOf.NearSpawner, new BoostMultiplier().add(amount));
}
if (getall) {
if (petPay == null)
if (petPay == 0D)
petPay = Jobs.getPermissionManager().getMaxPermission(player, "jobs.petpay", force, false, true);
if (petPay != null)
if (petPay != 0D)
boost.add(BoostOf.PetPay, new BoostMultiplier().add(petPay));
Double amount = Jobs.getPermissionManager().getMaxPermission(player, "jobs.nearspawner", force);
if (amount != null)

View File

@ -51,7 +51,7 @@ public class ExploreChunk {
StringBuilder s = new StringBuilder();
for (Integer one : playerIds) {
if (!s.toString().isEmpty())
s.append(";");
s.append(';');
s.append(one);
}
return s.toString();

View File

@ -153,16 +153,14 @@ public class JobsPlayer {
public boolean isUnderLimit(CurrencyType type, Double amount) {
Player player = getPlayer();
if (player == null)
return true;
if (amount == 0)
if (player == null || amount == 0)
return true;
CurrencyLimit limit = Jobs.getGCManager().getLimit(type);
if (!limit.isEnabled())
return true;
PaymentData data = getPaymentLimit();
Integer value = limits.get(type);
if (data.isReachedLimit(type, value == null ? 0 : value)) {
Integer value = limits.getOrDefault(type, 0);
if (data.isReachedLimit(type, value)) {
String name = type.getName().toLowerCase();
if (player.isOnline() && !data.isInformed() && !data.isReseted(type)) {

View File

@ -6,34 +6,27 @@ import java.util.List;
public class ShopItem {
private String NodeName = null;
private double price = 0D;
private int slot = -1;
private int page = -1;
private int slot = -1, page = -1, iconAmount = 1;
private String IconMaterial = null;
private int IconAmount = 1;
private String IconName = null;
private final List<String> IconLore = new ArrayList<>();
private String nodeName = null, iconMaterial = null, iconName = null;
private boolean HideWithoutPerm = false;
private boolean hideWithoutPerm = false;
private boolean hideNoEnoughPoint = false;
private int RequiredTotalLevels = -1;
private int requiredTotalLevels = -1;
private HashMap<String, Integer> RequiredJobs = new HashMap<>();
private HashMap<String, Integer> requiredJobs = new HashMap<>();
private final List<String> RequiredPerm = new ArrayList<>();
private final List<String> Commands = new ArrayList<>();
private final List<String> iconLore = new ArrayList<>(), requiredPerm = new ArrayList<>(), commands = new ArrayList<>();
private final List<JobItems> items = new ArrayList<>();
private String PlayerName;
private String playerName;
private boolean useCurrentPlayer = false;
public ShopItem(String NodeName, double price) {
this.NodeName = NodeName;
public ShopItem(String nodeName, double price) {
this.nodeName = nodeName;
this.price = price;
}
@ -62,30 +55,30 @@ public class ShopItem {
return items;
}
public void setCommands(List<String> Commands) {
this.Commands.clear();
this.Commands.addAll(Commands == null ? new ArrayList<>() : Commands);
public void setCommands(List<String> commands) {
this.commands.clear();
this.commands.addAll(commands == null ? new ArrayList<>() : commands);
}
public List<String> getCommands() {
return Commands;
return commands;
}
public void setRequiredJobs(HashMap<String, Integer> RequiredJobs) {
this.RequiredJobs = RequiredJobs;
public void setRequiredJobs(HashMap<String, Integer> requiredJobs) {
this.requiredJobs = requiredJobs;
}
public HashMap<String, Integer> getRequiredJobs() {
return RequiredJobs;
return requiredJobs;
}
public void setRequiredPerm(List<String> RequiredPerm) {
this.RequiredPerm.clear();
this.RequiredPerm.addAll(RequiredPerm == null ? new ArrayList<>() : RequiredPerm);
public void setRequiredPerm(List<String> requiredPerm) {
this.requiredPerm.clear();
this.requiredPerm.addAll(requiredPerm == null ? new ArrayList<>() : requiredPerm);
}
public List<String> getRequiredPerm() {
return RequiredPerm;
return requiredPerm;
}
public void setHideIfThereIsNoEnoughPoints(boolean hideNoEnoughPoint) {
@ -96,69 +89,69 @@ public class ShopItem {
return hideNoEnoughPoint;
}
public void setHideWithoutPerm(boolean HideWithoutPerm) {
this.HideWithoutPerm = HideWithoutPerm;
public void setHideWithoutPerm(boolean hideWithoutPerm) {
this.hideWithoutPerm = hideWithoutPerm;
}
public boolean isHideWithoutPerm() {
return HideWithoutPerm;
return hideWithoutPerm;
}
public void setIconLore(List<String> IconLore) {
this.IconLore.clear();
this.IconLore.addAll(IconLore == null ? new ArrayList<>() : IconLore);
public void setIconLore(List<String> iconLore) {
this.iconLore.clear();
this.iconLore.addAll(iconLore == null ? new ArrayList<>() : iconLore);
}
public List<String> getIconLore() {
return IconLore;
return iconLore;
}
public String getNodeName() {
return NodeName;
return nodeName;
}
public String getIconMaterial() {
return IconMaterial;
return iconMaterial;
}
public void setIconMaterial(String IconMaterial) {
this.IconMaterial = IconMaterial;
public void setIconMaterial(String iconMaterial) {
this.iconMaterial = iconMaterial;
}
public double getPrice() {
return price;
}
public void setIconAmount(int IconAmount) {
this.IconAmount = IconAmount;
public void setIconAmount(int iconAmount) {
this.iconAmount = iconAmount;
}
public int getIconAmount() {
return IconAmount;
return iconAmount;
}
public void setIconName(String IconName) {
this.IconName = IconName;
public void setIconName(String iconName) {
this.iconName = iconName;
}
public String getIconName() {
return IconName;
return iconName;
}
public int getRequiredTotalLevels() {
return RequiredTotalLevels;
return requiredTotalLevels;
}
public void setRequiredTotalLevels(int RequiredTotalLevels) {
this.RequiredTotalLevels = RequiredTotalLevels;
public void setRequiredTotalLevels(int requiredTotalLevels) {
this.requiredTotalLevels = requiredTotalLevels;
}
public String getCustomHead() {
return PlayerName;
return playerName;
}
public void setCustomHead(String PlayerName) {
this.PlayerName = PlayerName;
public void setCustomHead(String playerName) {
this.playerName = playerName;
}
public boolean isHeadOwner() {