mirror of
https://github.com/Zrips/Jobs.git
synced 2025-02-19 13:51:38 +01:00
Implement global max owner ship permission for all known furnace types
Closes #1073
This commit is contained in:
parent
d51dc146bf
commit
68b7630500
@ -1046,8 +1046,8 @@ public class Jobs extends JavaPlugin {
|
||||
if (!jPlayer.isUnderLimit(CurrencyType.MONEY, income)) {
|
||||
if (gConfigManager.useMaxPaymentCurve) {
|
||||
double percentOver = jPlayer.percentOverLimit(CurrencyType.MONEY);
|
||||
float factor = gConfigManager.maxPaymentCurveFactor;
|
||||
double percentLoss = 100 / ((1 / factor * percentOver * percentOver) + 1);
|
||||
double percentLoss = 100 / ((1 / gConfigManager.maxPaymentCurveFactor * percentOver * percentOver) + 1);
|
||||
|
||||
income = income - (income * percentLoss / 100);
|
||||
} else
|
||||
income = 0D;
|
||||
@ -1097,9 +1097,7 @@ public class Jobs extends JavaPlugin {
|
||||
expiredJobs.add(prog.getJob());
|
||||
}
|
||||
|
||||
int level = prog.getLevel();
|
||||
|
||||
JobInfo jobinfo = prog.getJob().getJobInfo(info, level);
|
||||
JobInfo jobinfo = prog.getJob().getJobInfo(info, prog.getLevel());
|
||||
|
||||
checkDailyQuests(jPlayer, prog.getJob(), info);
|
||||
|
||||
@ -1107,9 +1105,9 @@ public class Jobs extends JavaPlugin {
|
||||
continue;
|
||||
}
|
||||
|
||||
double income = jobinfo.getIncome(level, numjobs, jPlayer.maxJobsEquation);
|
||||
double pointAmount = jobinfo.getPoints(level, numjobs, jPlayer.maxJobsEquation);
|
||||
double expAmount = jobinfo.getExperience(level, numjobs, jPlayer.maxJobsEquation);
|
||||
double income = jobinfo.getIncome(prog.getLevel(), numjobs, jPlayer.maxJobsEquation);
|
||||
double pointAmount = jobinfo.getPoints(prog.getLevel(), numjobs, jPlayer.maxJobsEquation);
|
||||
double expAmount = jobinfo.getExperience(prog.getLevel(), numjobs, jPlayer.maxJobsEquation);
|
||||
|
||||
if (income == 0D && pointAmount == 0D && expAmount == 0D)
|
||||
continue;
|
||||
|
@ -26,7 +26,7 @@ public class ExploreChunk {
|
||||
newChunkForPlayer = true;
|
||||
}
|
||||
|
||||
if (playerIds.size() >= Jobs.getExplore().getPlayerAmount() && Jobs.getGCManager().ExploreCompact) {
|
||||
if (Jobs.getGCManager().ExploreCompact && playerIds.size() >= Jobs.getExplore().getPlayerAmount()) {
|
||||
playerIds = null;
|
||||
}
|
||||
|
||||
@ -73,9 +73,8 @@ public class ExploreChunk {
|
||||
for (String one : names.split(";")) {
|
||||
try {
|
||||
int id = Integer.parseInt(one);
|
||||
PlayerInfo info = Jobs.getPlayerManager().getPlayerInfo(id);
|
||||
|
||||
if (info != null)
|
||||
if (Jobs.getPlayerManager().getPlayerInfo(id) != null)
|
||||
playerIds.add(id);
|
||||
} catch (NumberFormatException e) {
|
||||
updated = true;
|
||||
@ -86,7 +85,7 @@ public class ExploreChunk {
|
||||
}
|
||||
}
|
||||
|
||||
if (playerIds.size() >= Jobs.getExplore().getPlayerAmount() && Jobs.getGCManager().ExploreCompact) {
|
||||
if (Jobs.getGCManager().ExploreCompact && playerIds.size() >= Jobs.getExplore().getPlayerAmount()) {
|
||||
playerIds = null;
|
||||
|
||||
if (!names.isEmpty())
|
||||
|
@ -223,7 +223,7 @@ public class JobsPlayer {
|
||||
if (data.isReachedLimit(type, getLimit(type))) {
|
||||
String name = type.getName().toLowerCase();
|
||||
|
||||
if (player.isOnline() && !data.isInformed() && !data.isReseted(type)) {
|
||||
if (!data.isInformed() && player.isOnline() && !data.isReseted(type)) {
|
||||
if (Jobs.getGCManager().useMaxPaymentCurve) {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + name + "limit"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + name + "limit2"));
|
||||
@ -1353,12 +1353,16 @@ public class JobsPlayer {
|
||||
* @return max allowed owner ship
|
||||
*/
|
||||
public int getMaxOwnerShipAllowed(BlockTypes type) {
|
||||
String perm = "jobs.max" + (type == BlockTypes.FURNACE
|
||||
? "furnaces" : type == BlockTypes.BLAST_FURNACE ? "blastfurnaces" : type == BlockTypes.SMOKER ? "smokers" : type == BlockTypes.BREWING_STAND ? "brewingstands" : "");
|
||||
if (perm.isEmpty())
|
||||
return 0;
|
||||
double maxV = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxownership");
|
||||
if (maxV > 0D) {
|
||||
return (int) maxV;
|
||||
}
|
||||
|
||||
double maxV = Jobs.getPermissionManager().getMaxPermission(this, perm);
|
||||
String perm = "jobs.max" + (type == BlockTypes.FURNACE
|
||||
? "furnaces" : type == BlockTypes.BLAST_FURNACE ? "blastfurnaces" : type == BlockTypes.SMOKER ? "smokers"
|
||||
: type == BlockTypes.BREWING_STAND ? "brewingstands" : "");
|
||||
|
||||
maxV = Jobs.getPermissionManager().getMaxPermission(this, perm);
|
||||
|
||||
if (maxV == 0D && type == BlockTypes.FURNACE)
|
||||
maxV = (double) Jobs.getGCManager().getFurnacesMaxDefault();
|
||||
|
@ -88,11 +88,12 @@ import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class JobsPaymentListener implements Listener {
|
||||
public final class JobsPaymentListener implements Listener {
|
||||
|
||||
private final Jobs plugin;
|
||||
private final String blockMetadata = "BlockOwner";
|
||||
@ -600,7 +601,7 @@ public class JobsPaymentListener implements Listener {
|
||||
ItemStack[] sourceItems = event.getInventory().getContents();
|
||||
|
||||
// For dye check
|
||||
List<ItemStack> dyeStack = new ArrayList<>();
|
||||
List<ItemStack> dyeStack = new java.util.ArrayList<>();
|
||||
|
||||
int y = -1;
|
||||
|
||||
@ -896,7 +897,7 @@ public class JobsPaymentListener implements Listener {
|
||||
ItemStack secondSlotItem = inv.getItem(1);
|
||||
|
||||
if (Jobs.getGCManager().PayForEnchantingOnAnvil && secondSlotItem != null && secondSlotItem.getType() == Material.ENCHANTED_BOOK) {
|
||||
for (Entry<Enchantment, Integer> oneEnchant : resultStack.getEnchantments().entrySet()) {
|
||||
for (Map.Entry<Enchantment, Integer> oneEnchant : resultStack.getEnchantments().entrySet()) {
|
||||
Enchantment enchant = oneEnchant.getKey();
|
||||
if (enchant == null)
|
||||
continue;
|
||||
@ -953,7 +954,7 @@ public class JobsPaymentListener implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
for (Entry<Enchantment, Integer> oneEnchant : event.getEnchantsToAdd().entrySet()) {
|
||||
for (Map.Entry<Enchantment, Integer> oneEnchant : event.getEnchantsToAdd().entrySet()) {
|
||||
Enchantment enchant = oneEnchant.getKey();
|
||||
if (enchant == null)
|
||||
continue;
|
||||
@ -1708,7 +1709,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getNms().getDurability(hand) == 0)
|
||||
return true;
|
||||
|
||||
for (Entry<Enchantment, Integer> oneG : got.entrySet()) {
|
||||
for (Map.Entry<Enchantment, Integer> oneG : got.entrySet()) {
|
||||
Map<Enchantment, Integer> map = hand.getEnchantments();
|
||||
Integer key = map.get(oneG.getKey());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user