mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 22:13:25 +01:00
Lowercase some method names in paymentData
This commit is contained in:
parent
20594c3e91
commit
ee21d95a43
@ -2657,7 +2657,7 @@ public enum CMIMaterial {
|
||||
}
|
||||
|
||||
public boolean equals(Material mat) {
|
||||
return getMaterial() != null && getMaterial() == mat;
|
||||
return getMaterial() == mat;
|
||||
}
|
||||
|
||||
public List<String> getLegacyNames() {
|
||||
|
@ -456,10 +456,10 @@ public class Placeholder {
|
||||
return Integer.toString(user.getLimit(t));
|
||||
case plimit_$1:
|
||||
t = CurrencyType.getByName(vals.get(0));
|
||||
return Double.toString(user.getPaymentLimit().GetAmount(t));
|
||||
return Double.toString(user.getPaymentLimit().getAmount(t));
|
||||
case plimit_tleft_$1:
|
||||
t = CurrencyType.getByName(vals.get(0));
|
||||
return TimeManage.to24hourShort(user.getPaymentLimit().GetLeftTime(t));
|
||||
return TimeManage.to24hourShort(user.getPaymentLimit().getLeftTime(t));
|
||||
case user_jlevel_$1:
|
||||
return j == null ? "0" : Integer.toString(j.getLevel());
|
||||
case user_jexp_$1:
|
||||
|
@ -351,7 +351,7 @@ public class SignUtil {
|
||||
return;
|
||||
|
||||
Skull skull = (Skull) b.getState();
|
||||
if (skull.getOwner() != null && skull.getOwner().equalsIgnoreCase(Playername))
|
||||
if (Playername.equalsIgnoreCase(skull.getOwner()))
|
||||
return;
|
||||
|
||||
skull.setOwner(Playername);
|
||||
|
@ -81,9 +81,7 @@ public class jobsSign {
|
||||
}
|
||||
|
||||
public static String locToBlockString(Location loc) {
|
||||
if (loc == null)
|
||||
return "";
|
||||
return loc.getWorld().getName() + ";" + loc.getBlockX() + ";" + loc.getBlockY() + ";" + loc.getBlockZ();
|
||||
return loc == null ? "" : loc.getWorld().getName() + ";" + loc.getBlockX() + ";" + loc.getBlockY() + ";" + loc.getBlockZ();
|
||||
}
|
||||
|
||||
public void setLoc(Location loc) {
|
||||
@ -101,7 +99,7 @@ public class jobsSign {
|
||||
if (!string.contains(";"))
|
||||
return;
|
||||
|
||||
String[] split = string.replace(",", ".").split(";");
|
||||
String[] split = string.replace(',', '.').split(";");
|
||||
|
||||
int x = 0, y = 0, z = 0;
|
||||
|
||||
|
@ -60,10 +60,10 @@ public class limit implements Cmd {
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
continue;
|
||||
}
|
||||
if (limit.GetLeftTime(type) > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.GetLeftTime(type))));
|
||||
if (limit.getLeftTime(type) > 0) {
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "time", "%time%", TimeManage.to24hourShort(limit.getLeftTime(type))));
|
||||
sender.sendMessage(Jobs.getLanguage().getMessage("command.limit.output." + type.getName().toLowerCase() + "Limit",
|
||||
"%current%", (int) (limit.GetAmount(type) * 100) / 100D,
|
||||
"%current%", (int) (limit.getAmount(type) * 100) / 100D,
|
||||
"%total%", JPlayer.getLimit(type)));
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -161,7 +162,7 @@ public class JobsPlayer {
|
||||
return true;
|
||||
PaymentData data = getPaymentLimit();
|
||||
Integer value = limits.get(type);
|
||||
if (data.IsReachedLimit(type, value == null ? 0 : value)) {
|
||||
if (data.isReachedLimit(type, value == null ? 0 : value)) {
|
||||
String name = type.getName().toLowerCase();
|
||||
|
||||
if (player.isOnline() && !data.isInformed() && !data.isReseted()) {
|
||||
@ -173,15 +174,15 @@ public class JobsPlayer {
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + name + "limit"));
|
||||
player.sendMessage(Jobs.getLanguage().getMessage("command.limit.output.reached" + name + "limit2"));
|
||||
}
|
||||
data.setInformed();
|
||||
data.setInformed(true);
|
||||
}
|
||||
if (data.IsAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline())
|
||||
ActionBarManager.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", TimeManage.to24hourShort(data.GetLeftTime(type))));
|
||||
if (data.isAnnounceTime(limit.getAnnouncementDelay()) && player.isOnline())
|
||||
ActionBarManager.send(player, Jobs.getLanguage().getMessage("command.limit.output." + name + "time", "%time%", TimeManage.to24hourShort(data.getLeftTime(type))));
|
||||
if (data.isReseted())
|
||||
data.setReseted(false);
|
||||
return false;
|
||||
}
|
||||
data.AddAmount(type, amount);
|
||||
data.addAmount(type, amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1067,10 +1068,7 @@ public class JobsPlayer {
|
||||
}
|
||||
}
|
||||
|
||||
List<QuestProgression> pr = new ArrayList<>();
|
||||
tmp.values().forEach(pr::add);
|
||||
|
||||
return pr;
|
||||
return tmp.values().stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public String getQuestProgressionString() {
|
||||
@ -1203,7 +1201,7 @@ public class JobsPlayer {
|
||||
public int getMaxBrewingStandsAllowed() {
|
||||
Double maxV = Jobs.getPermissionManager().getMaxPermission(this, "jobs.maxbrewingstands");
|
||||
|
||||
if (maxV == null || maxV == 0)
|
||||
if (maxV == 0)
|
||||
maxV = (double) Jobs.getGCManager().getBrewingStandsMaxDefault();
|
||||
|
||||
return maxV.intValue();
|
||||
|
@ -1281,15 +1281,15 @@ public abstract class JobsDAO {
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
if (limit == null)
|
||||
continue;
|
||||
if (limit.GetAmount(type) == 0D)
|
||||
if (limit.getAmount(type) == 0D)
|
||||
continue;
|
||||
if (limit.GetLeftTime(type) < 0)
|
||||
if (limit.getLeftTime(type) < 0)
|
||||
continue;
|
||||
|
||||
prest.setInt(1, jPlayer.getUserId());
|
||||
prest.setInt(2, type.getId());
|
||||
prest.setDouble(3, limit.GetAmount(type));
|
||||
prest.setLong(4, limit.GetTime(type));
|
||||
prest.setDouble(3, limit.getAmount(type));
|
||||
prest.setLong(4, limit.getTime(type));
|
||||
prest.setString(5, type.toString());
|
||||
prest.addBatch();
|
||||
}
|
||||
@ -1333,7 +1333,7 @@ public abstract class JobsDAO {
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
data.AddNewAmount(type, res.getDouble(LimitTableFields.collected.getCollumn()), res.getLong(LimitTableFields.started.getCollumn()));
|
||||
data.addNewAmount(type, res.getDouble(LimitTableFields.collected.getCollumn()), res.getLong(LimitTableFields.started.getCollumn()));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
@ -1372,7 +1372,7 @@ public abstract class JobsDAO {
|
||||
if (type == null)
|
||||
continue;
|
||||
|
||||
data.AddNewAmount(type, res.getDouble(LimitTableFields.collected.getCollumn()), res.getLong(LimitTableFields.started.getCollumn()));
|
||||
data.addNewAmount(type, res.getDouble(LimitTableFields.collected.getCollumn()), res.getLong(LimitTableFields.started.getCollumn()));
|
||||
map.put(id, data);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
|
@ -207,31 +207,25 @@ public class BufferedEconomy {
|
||||
}
|
||||
|
||||
public void ShowActionBar(BufferedPayment payment) {
|
||||
if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline())
|
||||
if (payment.getOfflinePlayer() == null || !payment.getOfflinePlayer().isOnline()
|
||||
|| !Jobs.getGCManager().ActionBarsMessageByDefault || !payment.containsPayment())
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().ActionBarsMessageByDefault)
|
||||
return;
|
||||
|
||||
if (!payment.containsPayment())
|
||||
return;
|
||||
|
||||
String playerUUID = payment.getOfflinePlayer().getUniqueId().toString();
|
||||
|
||||
Boolean show = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID, true);
|
||||
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
|
||||
if ((abp != null) && (show.booleanValue())) {
|
||||
UUID playerUUID = payment.getOfflinePlayer().getUniqueId();
|
||||
Boolean show = ToggleBarHandling.getActionBarToggle().getOrDefault(playerUUID.toString(), true);
|
||||
Player abp = Bukkit.getPlayer(playerUUID);
|
||||
if (abp != null && show.booleanValue()) {
|
||||
String Message = Jobs.getLanguage().getMessage("command.toggle.output.paid.main");
|
||||
if (payment.get(CurrencyType.MONEY) != 0D) {
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(),
|
||||
Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.money", "[amount]", String.format(Jobs.getGCManager().getDecimalPlacesMoney(),
|
||||
payment.get(CurrencyType.MONEY)));
|
||||
}
|
||||
if (payment.get(CurrencyType.POINTS) != 0D) {
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(),
|
||||
Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.points", "[points]", String.format(Jobs.getGCManager().getDecimalPlacesPoints(),
|
||||
payment.get(CurrencyType.POINTS)));
|
||||
}
|
||||
if (payment.get(CurrencyType.EXP) != 0D) {
|
||||
Message = Message + " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(),
|
||||
Message += " " + Jobs.getLanguage().getMessage("command.toggle.output.paid.exp", "[exp]", String.format(Jobs.getGCManager().getDecimalPlacesExp(),
|
||||
payment.get(CurrencyType.EXP)));
|
||||
}
|
||||
ActionBarManager.send(abp, Message);
|
||||
|
@ -8,10 +8,12 @@ import com.gamingmesh.jobs.container.CurrencyType;
|
||||
public class PaymentData {
|
||||
|
||||
private Long lastAnnouced = 0L;
|
||||
private HashMap<CurrencyType, Double> payments = new HashMap<>();
|
||||
private HashMap<CurrencyType, Long> paymentsTimes = new HashMap<>();
|
||||
private boolean Informed = false;
|
||||
private boolean Reseted = false;
|
||||
|
||||
private final HashMap<CurrencyType, Double> payments = new HashMap<>();
|
||||
private final HashMap<CurrencyType, Long> paymentsTimes = new HashMap<>();
|
||||
|
||||
private boolean informed = false;
|
||||
private boolean reseted = false;
|
||||
|
||||
public PaymentData(Long time, Double Payment, Double Points, Double Exp, Long lastAnnouced, boolean Informed) {
|
||||
paymentsTimes.put(CurrencyType.EXP, time);
|
||||
@ -20,127 +22,114 @@ public class PaymentData {
|
||||
payments.put(CurrencyType.EXP, Exp);
|
||||
payments.put(CurrencyType.MONEY, Payment);
|
||||
payments.put(CurrencyType.POINTS, Points);
|
||||
|
||||
this.lastAnnouced = lastAnnouced;
|
||||
this.Informed = Informed;
|
||||
this.informed = Informed;
|
||||
}
|
||||
|
||||
public PaymentData(CurrencyType type, Double amount) {
|
||||
paymentsTimes.put(type, System.currentTimeMillis());
|
||||
payments.put(type, amount);
|
||||
|
||||
this.lastAnnouced = 0L;
|
||||
this.Informed = false;
|
||||
this.informed = false;
|
||||
}
|
||||
|
||||
public PaymentData() {
|
||||
resetLimits();
|
||||
}
|
||||
|
||||
public Long GetTime(CurrencyType type) {
|
||||
public Long getTime(CurrencyType type) {
|
||||
return paymentsTimes.get(type);
|
||||
}
|
||||
|
||||
public void setReseted(boolean Reseted) {
|
||||
this.Reseted = Reseted;
|
||||
public void setReseted(boolean reseted) {
|
||||
this.reseted = reseted;
|
||||
}
|
||||
|
||||
public boolean isReseted() {
|
||||
return Reseted;
|
||||
return reseted;
|
||||
}
|
||||
|
||||
public Double GetAmount(CurrencyType type) {
|
||||
if (!payments.containsKey(type))
|
||||
return 0D;
|
||||
return (int) (payments.get(type) * 100) / 100D;
|
||||
public Double getAmount(CurrencyType type) {
|
||||
return !payments.containsKey(type) ? 0D : (int) (payments.get(type) * 100) / 100D;
|
||||
}
|
||||
|
||||
public Double GetAmountBylimit(CurrencyType type, int limit) {
|
||||
if (GetAmount(type) > limit)
|
||||
return (double) limit;
|
||||
return (int) (GetAmount(type) * 100) / 100D;
|
||||
public Double getAmountBylimit(CurrencyType type, int limit) {
|
||||
return getAmount(type) > limit ? (double) limit : (int) (getAmount(type) * 100) / 100D;
|
||||
}
|
||||
|
||||
public Long GetLastAnnounced() {
|
||||
public Long getLastAnnounced() {
|
||||
return lastAnnouced;
|
||||
}
|
||||
|
||||
public boolean IsAnnounceTime(int t) {
|
||||
if (this.lastAnnouced + (t * 1000) > System.currentTimeMillis())
|
||||
public boolean isAnnounceTime(int t) {
|
||||
if (lastAnnouced + (t * 1000) > System.currentTimeMillis())
|
||||
return false;
|
||||
SetAnnouncmentTime();
|
||||
|
||||
setAnnouncementTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetAnnouncmentTime() {
|
||||
public void setAnnouncementTime() {
|
||||
this.lastAnnouced = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void AddNewAmount(CurrencyType type, Double Payment) {
|
||||
AddNewAmount(type, Payment, null);
|
||||
public void addNewAmount(CurrencyType type, Double Payment) {
|
||||
addNewAmount(type, Payment, null);
|
||||
}
|
||||
|
||||
public void AddNewAmount(CurrencyType type, Double Payment, Long time) {
|
||||
public void addNewAmount(CurrencyType type, Double Payment, Long time) {
|
||||
paymentsTimes.put(type, time == null ? System.currentTimeMillis() : time);
|
||||
payments.put(type, Payment);
|
||||
}
|
||||
|
||||
public void setInformed() {
|
||||
this.Informed = true;
|
||||
}
|
||||
|
||||
public void setNotInformed() {
|
||||
this.Informed = false;
|
||||
}
|
||||
|
||||
public void AddAmount(CurrencyType type, Double Payment) {
|
||||
public void addAmount(CurrencyType type, Double Payment) {
|
||||
payments.put(type, payments.get(type) + Payment);
|
||||
}
|
||||
|
||||
public long GetLeftTime(CurrencyType type) {
|
||||
public long getLeftTime(CurrencyType type) {
|
||||
long left = 0;
|
||||
if (this.GetTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis())
|
||||
left = (this.GetTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) - System.currentTimeMillis());
|
||||
if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis())
|
||||
left = (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) - System.currentTimeMillis());
|
||||
return left;
|
||||
}
|
||||
|
||||
public boolean IsOverLimit(CurrencyType type, int limit) {
|
||||
if (this.payments.get(type) < limit)
|
||||
public boolean isOverLimit(CurrencyType type, int limit) {
|
||||
if (payments.get(type) < limit)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public double percentOverLimit(CurrencyType type, int limit) {
|
||||
return ((this.payments.get(type) / limit) - 1) * 100;
|
||||
return ((payments.get(type) / limit) - 1) * 100;
|
||||
}
|
||||
|
||||
public boolean IsOverTimeLimit(CurrencyType type) {
|
||||
if (this.GetTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis())
|
||||
public boolean isOverTimeLimit(CurrencyType type) {
|
||||
if (getTime(type) + (Jobs.getGCManager().getLimit(type).getTimeLimit() * 1000) > System.currentTimeMillis())
|
||||
return false;
|
||||
if (this.Informed)
|
||||
this.Informed = false;
|
||||
if (informed)
|
||||
informed = false;
|
||||
resetLimits();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void resetLimits() {
|
||||
for (CurrencyType type : CurrencyType.values()) {
|
||||
AddNewAmount(type, 0D);
|
||||
addNewAmount(type, 0D);
|
||||
}
|
||||
this.Reseted = true;
|
||||
reseted = true;
|
||||
}
|
||||
|
||||
public boolean IsReachedLimit(CurrencyType type, int money) {
|
||||
if (IsOverTimeLimit(type))
|
||||
return true;
|
||||
if (IsOverLimit(type, money))
|
||||
return true;
|
||||
return false;
|
||||
public boolean isReachedLimit(CurrencyType type, int money) {
|
||||
return isOverTimeLimit(type) || isOverLimit(type, money);
|
||||
}
|
||||
|
||||
public boolean isInformed() {
|
||||
return Informed;
|
||||
return informed;
|
||||
}
|
||||
|
||||
public void setInformed(boolean Informed) {
|
||||
this.Informed = Informed;
|
||||
public void setInformed(boolean informed) {
|
||||
this.informed = informed;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package com.gamingmesh.jobs.hooks.McMMO;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -50,10 +49,7 @@ public class McMMO1_X_listener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
if (!JobsPaymentListener.payForItemDurabilityLoss(player))
|
||||
return;
|
||||
|
||||
if (event.getTreasure() == null)
|
||||
if (!JobsPaymentListener.payForItemDurabilityLoss(player) || event.getTreasure() == null)
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -71,7 +67,7 @@ public class McMMO1_X_listener implements Listener {
|
||||
|
||||
Player player = event.getPlayer();
|
||||
//disabling plugin in world
|
||||
if (player == null || !Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||
return;
|
||||
|
||||
ItemStack resultStack = event.getRepairedObject();
|
||||
@ -82,7 +78,7 @@ public class McMMO1_X_listener implements Listener {
|
||||
return;
|
||||
|
||||
// check if in creative
|
||||
if (player.getGameMode().equals(GameMode.CREATIVE) && !player.hasPermission("jobs.paycreative") && !Jobs.getGCManager().payInCreative())
|
||||
if (!JobsPaymentListener.payIfCreative(player))
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
|
@ -3,7 +3,6 @@ package com.gamingmesh.jobs.hooks.WorldGuard;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -38,16 +37,14 @@ public class WorldGuardManager {
|
||||
if (useOld) {
|
||||
ApplicableRegionSet regions = wg.getRegionContainer().get(loc.getWorld()).getApplicableRegions(loc);
|
||||
for (ProtectedRegion one : regions.getRegions()) {
|
||||
if (!Jobs.getRestrictedAreaManager().isExist(one.getId()))
|
||||
continue;
|
||||
if (Jobs.getRestrictedAreaManager().isExist(one.getId()))
|
||||
return Jobs.getRestrictedAreaManager().getRestrictedAreasByName(one.getId());
|
||||
}
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
if (!Jobs.getRestrictedAreaManager().isExist(one.getId()))
|
||||
continue;
|
||||
if (Jobs.getRestrictedAreaManager().isExist(one.getId()))
|
||||
return Jobs.getRestrictedAreaManager().getRestrictedAreasByName(one.getId());
|
||||
}
|
||||
}
|
||||
@ -61,16 +58,14 @@ public class WorldGuardManager {
|
||||
if (useOld) {
|
||||
ApplicableRegionSet regions = wg.getRegionContainer().get(loc.getWorld()).getApplicableRegions(loc);
|
||||
for (ProtectedRegion one : regions.getRegions()) {
|
||||
if (!one.getId().equalsIgnoreCase(name) || !one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
continue;
|
||||
if (one.getId().equalsIgnoreCase(name) && one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
RegionManager regions = container.get(BukkitAdapter.adapt(loc.getWorld()));
|
||||
for (ProtectedRegion one : regions.getRegions().values()) {
|
||||
if (!one.getId().equalsIgnoreCase(name) || !one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
continue;
|
||||
if (one.getId().equalsIgnoreCase(name) && one.contains(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -79,17 +74,16 @@ public class WorldGuardManager {
|
||||
|
||||
public String getNameByName(String name) {
|
||||
for (World one : Bukkit.getWorlds()) {
|
||||
Map<String, ProtectedRegion> regions = null;
|
||||
Map<String, ProtectedRegion> regions;
|
||||
if (useOld) {
|
||||
regions = wg.getRegionContainer().get(one).getRegions();
|
||||
} else {
|
||||
RegionContainer container = WorldGuard.getInstance().getPlatform().getRegionContainer();
|
||||
regions = container.get(BukkitAdapter.adapt(one)).getRegions();
|
||||
}
|
||||
for (Entry<String, ProtectedRegion> oneR : regions.entrySet()) {
|
||||
if (!oneR.getKey().equalsIgnoreCase(name))
|
||||
continue;
|
||||
return oneR.getKey();
|
||||
for (String oneR : regions.keySet()) {
|
||||
if (oneR.equalsIgnoreCase(name))
|
||||
return oneR;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -97,10 +97,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
public void AsyncPlayerChatEvent(final AsyncPlayerChatEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (Util.getJobsEditorMap().isEmpty())
|
||||
if (event.isCancelled() || Util.getJobsEditorMap().isEmpty())
|
||||
return;
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
@ -133,10 +130,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
public void onSelection(PlayerInteractEvent event) {
|
||||
if (event.getClickedBlock() == null)
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
if (event.getClickedBlock() == null || event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
@ -147,10 +141,7 @@ public class JobsListener implements Listener {
|
||||
if (iih.getType() != CMIMaterial.get(Jobs.getGCManager().getSelectionTool()).getMaterial())
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()))
|
||||
return;
|
||||
|
||||
if (!player.hasPermission("jobs.area.select"))
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(event.getPlayer().getWorld()) || !player.hasPermission("jobs.area.select"))
|
||||
return;
|
||||
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
@ -218,10 +209,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onSignInteract(PlayerInteractEvent event) {
|
||||
if (!Jobs.getGCManager().SignsEnabled)
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
if (!Jobs.getGCManager().SignsEnabled || event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
Block block = event.getClickedBlock();
|
||||
@ -396,7 +384,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
|
||||
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
|
||||
if (honorific.equalsIgnoreCase(" "))
|
||||
if (honorific.equals(" "))
|
||||
honorific = "";
|
||||
|
||||
String format = event.getFormat();
|
||||
@ -412,7 +400,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
|
||||
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
|
||||
if (honorific.equalsIgnoreCase(" "))
|
||||
if (honorific.equals(" "))
|
||||
honorific = "";
|
||||
|
||||
String format = event.getFormat();
|
||||
@ -431,7 +419,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(event.getPlayer());
|
||||
String honorific = jPlayer != null ? jPlayer.getDisplayHonorific() : "";
|
||||
if (honorific.equalsIgnoreCase(" "))
|
||||
if (honorific.equals(" "))
|
||||
honorific = "";
|
||||
|
||||
String format = event.getFormat();
|
||||
@ -489,9 +477,8 @@ public class JobsListener implements Listener {
|
||||
}
|
||||
|
||||
String meinOk = null;
|
||||
List<JobProgression> prog = JPlayer.getJobProgression();
|
||||
|
||||
mein: for (JobProgression one : prog) {
|
||||
mein: for (JobProgression one : JPlayer.getJobProgression()) {
|
||||
for (JobLimitedItems oneItem : one.getJob().getLimitedItems().values()) {
|
||||
if (one.getLevel() >= oneItem.getLevel())
|
||||
continue;
|
||||
@ -535,10 +522,7 @@ public class JobsListener implements Listener {
|
||||
|
||||
@EventHandler
|
||||
public void onChunkChangeMove(PlayerMoveEvent event) {
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().isOnline())
|
||||
if (event.isCancelled() || !event.getPlayer().isOnline())
|
||||
return;
|
||||
|
||||
//disabling plugin in world
|
||||
|
@ -232,9 +232,6 @@ public class JobsPaymentListener implements Listener {
|
||||
|
||||
// pay
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
if (!Jobs.isPlayerHaveAction(jPlayer, ActionType.MILK)) {
|
||||
return;
|
||||
}
|
||||
@ -414,11 +411,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, bInfo, block);
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), bInfo, block);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -464,11 +457,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.PLACE), block);
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new BlockActionInfo(block, ActionType.PLACE), block);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1070,11 +1059,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new ItemActionInfo(event.getResult(), ActionType.SMELT));
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new ItemActionInfo(event.getResult(), ActionType.SMELT));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||
@ -1297,11 +1282,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new EntityActionInfo(event.getEntity(), ActionType.PLACE));
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(event.getEntity(), ActionType.PLACE));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1328,11 +1309,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new EntityActionInfo(event.getEntity(), ActionType.BREAK));
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(event.getEntity(), ActionType.BREAK));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1380,11 +1357,7 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jPlayer, new EntityActionInfo(ent, ActionType.PLACE));
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(ent, ActionType.PLACE));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1419,11 +1392,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// pay
|
||||
JobsPlayer jDamager = Jobs.getPlayerManager().getJobsPlayer(pDamager);
|
||||
if (jDamager == null)
|
||||
return;
|
||||
|
||||
Jobs.action(jDamager, new EntityActionInfo(ent, ActionType.BREAK), e.getDamager());
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(pDamager), new EntityActionInfo(ent, ActionType.BREAK), e.getDamager());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
@ -1487,10 +1456,7 @@ public class JobsPaymentListener implements Listener {
|
||||
return;
|
||||
|
||||
// pay
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
Jobs.action(jPlayer, new EntityActionInfo(animal, ActionType.BREED));
|
||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new EntityActionInfo(animal, ActionType.BREED));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1698,7 +1664,7 @@ public class JobsPaymentListener implements Listener {
|
||||
}
|
||||
} else if (Version.isCurrentEqualOrHigher(Version.v1_13_R1) &&
|
||||
block.getType().toString().startsWith("STRIPPED_") &&
|
||||
event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||
event.getAction() == Action.RIGHT_CLICK_BLOCK && jPlayer != null) {
|
||||
ItemStack iih = Jobs.getNms().getItemInMainHand(p);
|
||||
if (iih.getType().toString().endsWith("_AXE")) {
|
||||
// check if player is riding
|
||||
@ -1710,10 +1676,8 @@ public class JobsPaymentListener implements Listener {
|
||||
- Jobs.getNms().getDurability(iih) != iih.getType().getMaxDurability())
|
||||
return;
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
|
||||
if (jPlayer != null)
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block);
|
||||
}, 1);
|
||||
Bukkit.getScheduler().runTaskLater(plugin, () ->
|
||||
Jobs.action(jPlayer, new BlockActionInfo(block, ActionType.STRIPLOGS), block), 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class Util {
|
||||
JarEntry entry = en.nextElement();
|
||||
String entryName = entry.getName();
|
||||
|
||||
packageName = packageName.replace(".", "/");
|
||||
packageName = packageName.replace('.', '/');
|
||||
|
||||
if (entryName != null && entryName.endsWith("." + fileType) && entryName.startsWith(packageName)) {
|
||||
String name = entryName.replace(packageName, "").replace("." + fileType, "").replace("/", "");
|
||||
|
Loading…
Reference in New Issue
Block a user