1
0
mirror of https://github.com/Zrips/Jobs.git synced 2025-01-06 00:08:13 +01:00

Check for null plaayer data

This commit is contained in:
Zrips 2016-11-20 11:53:19 +02:00
parent 5836581eec
commit b518f7f6ff
7 changed files with 15 additions and 9 deletions

View File

@ -26,7 +26,7 @@ import org.bukkit.plugin.RegisteredServiceProvider;
import com.gamingmesh.jobs.economy.BlackholeEconomy; import com.gamingmesh.jobs.economy.BlackholeEconomy;
import com.gamingmesh.jobs.economy.VaultEconomy; import com.gamingmesh.jobs.economy.VaultEconomy;
import com.gamingmesh.jobs.economy.IConomy6Adapter; import com.gamingmesh.jobs.economy.IConomyAdapter;
public class HookEconomyTask implements Runnable { public class HookEconomyTask implements Runnable {
private Jobs plugin; private Jobs plugin;
@ -79,7 +79,7 @@ public class HookEconomyTask implements Runnable {
return false; return false;
try { try {
Jobs.setEconomy(this.plugin, new IConomy6Adapter((com.iCo6.iConomy) p)); Jobs.setEconomy(this.plugin, new IConomyAdapter((com.iCo6.iConomy) p));
} catch (Exception e) { } catch (Exception e) {
Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] UNKNOWN iConomy version."); Jobs.consoleMsg("&e[" + this.plugin.getDescription().getName() + "] UNKNOWN iConomy version.");
return false; return false;

View File

@ -375,13 +375,13 @@ public class JobsCommands implements CommandExecutor {
} }
} }
if (job.getBoost().get(BoostType.EXP) != 1.0) if (job.getBoost().get(BoostType.EXP) != 0D)
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getBoost().get(BoostType.EXP)) + "\n"); message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.expboost.output.infostats", "%boost%", job.getBoost().get(BoostType.EXP)) + "\n");
if (job.getBoost().get(BoostType.MONEY) != 1.0) if (job.getBoost().get(BoostType.MONEY) != 0D)
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getBoost().get(BoostType.MONEY)) + "\n"); message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.moneyboost.output.infostats", "%boost%", job.getBoost().get(BoostType.MONEY)) + "\n");
if (job.getBoost().get(BoostType.POINTS) != 1.0) if (job.getBoost().get(BoostType.POINTS) != 0D)
message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getBoost().get(BoostType.POINTS)) + "\n"); message.append(ChatColor.GOLD + Jobs.getLanguage().getMessage("command.pointboost.output.infostats", "%boost%", job.getBoost().get(BoostType.POINTS)) + "\n");
if (Jobs.getGCManager().useDynamicPayment) if (Jobs.getGCManager().useDynamicPayment)

View File

@ -28,8 +28,8 @@ public class JobInfo {
private String name; private String name;
private double baseIncome, baseXp, basePoints; private double baseIncome, baseXp, basePoints;
private Parser moneyEquation, xpEquation, pointsEquation; private Parser moneyEquation, xpEquation, pointsEquation;
private int fromLevel; private int fromLevel = 0;
private int untilLevel; private int untilLevel = Integer.MAX_VALUE;
public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation, public JobInfo(ActionType actionType, int id, String meta, String name, double baseIncome, Parser moneyEquation, double baseXp, Parser xpEquation,
Parser pointsEquation, double basePoints, int fromLevel, int untilLevel) { Parser pointsEquation, double basePoints, int fromLevel, int untilLevel) {

View File

@ -56,6 +56,8 @@ public class RestrictedArea {
* @return false - the location is outside the restricted area * @return false - the location is outside the restricted area
*/ */
public boolean inRestrictedArea(Player player) { public boolean inRestrictedArea(Player player) {
if (player == null)
return false;
if (isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) && if (isBetween(player.getLocation().getX(), this.location1.getX(), this.location2.getX()) &&
isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) && isBetween(player.getLocation().getY(), this.location1.getY(), this.location2.getY()) &&
isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) && isBetween(player.getLocation().getZ(), this.location1.getZ(), this.location2.getZ()) &&

View File

@ -7,3 +7,4 @@
/PointsData.class /PointsData.class
/IConomy6Adapter.class /IConomy6Adapter.class
/IConomy7Adapter.class /IConomy7Adapter.class
/IConomyAdapter.class

View File

@ -5,11 +5,11 @@ import org.bukkit.OfflinePlayer;
import com.iCo6.iConomy; import com.iCo6.iConomy;
import com.iCo6.system.Accounts; import com.iCo6.system.Accounts;
public class IConomy6Adapter implements Economy { public class IConomyAdapter implements Economy {
iConomy icon; iConomy icon;
public IConomy6Adapter(iConomy iconomy) { public IConomyAdapter(iConomy iconomy) {
icon = iconomy; icon = iconomy;
} }

View File

@ -81,6 +81,9 @@ public class McMMOlistener implements Listener {
public double getMultiplier(Player player) { public double getMultiplier(Player player) {
if (player == null)
return 0D;
HashMap<AbilityType, Long> InfoMap = map.get(player.getName()); HashMap<AbilityType, Long> InfoMap = map.get(player.getName());
if (InfoMap == null) { if (InfoMap == null) {
return 0D; return 0D;