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

Fix #323 /jobs employ if target has, then checked the permission at the target

- Now checking correctly for plants when break
This commit is contained in:
montlikadani 2019-01-05 19:01:27 +01:00
parent 33c1bb961d
commit aadf514dba
4 changed files with 34 additions and 36 deletions

View File

@ -19,15 +19,15 @@ public class employ implements Cmd {
return true;
}
if (!Jobs.hasPermission(sender, "jobs.command.employ", true))
return true;
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]);
if (jPlayer == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.noinfoByPlayer", "%playername%", args[0]));
return true;
}
if (!Jobs.hasPermission(jPlayer.getPlayer(), "jobs.command.employ", true))
return true;
Job job = Jobs.getJob(args[1]);
if (job == null) {
sender.sendMessage(Jobs.getLanguage().getMessage("general.error.job"));

View File

@ -100,8 +100,8 @@ public class GeneralConfigManager {
private boolean useTnTFinder = false;
public boolean CancelCowMilking;
public boolean fixAtMaxLevel, ToggleActionBar, TitleChangeChat, TitleChangeActionBar, LevelChangeChat,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAcountChat,
EmptyServerAcountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
LevelChangeActionBar, SoundLevelupUse, SoundTitleChangeUse, UseServerAccount, EmptyServerAccountChat,
EmptyServerAccountActionBar, ActionBarsMessageByDefault, ShowTotalWorkers, ShowPenaltyBonus, useDynamicPayment,
JobsGUIOpenOnBrowse, JobsGUIShowChatBrowse, JobsGUISwitcheButtons, JobsGUIOpenOnJoin;
private int JobsGUIRows, JobsGUIBackButton,
@ -128,7 +128,7 @@ public class GeneralConfigManager {
public boolean useMaxPaymentCurve;
public float maxPaymentCurveFactor;
public double TaxesAmount;
public String SoundLevelupSound, SoundTitleChangeSound, ServerAcountName, ServertaxesAcountName;
public String SoundLevelupSound, SoundTitleChangeSound, ServerAccountName, ServertaxesAccountName;
public ArrayList<String> keys;
public boolean hideJobsInfoWithoutPermission;
public boolean UseTaxes;
@ -621,15 +621,15 @@ public class GeneralConfigManager {
useMaxPaymentCurve = c.get("Economy.MaxPayment.curve.use", false);
int temp = c.get("Economy.MaxPayment.curve.factor", 10);
maxPaymentCurveFactor = ((float) temp) / 1000;
c.getW().addComment("Economy.UseServerAcount", "Server economy account", "With this enabled, players will get money from defined user (server account)",
c.getW().addComment("Economy.UseServerAccount", "Server economy account", "With this enabled, players will get money from defined user (server account)",
"If this account don't have enough money to pay for players for, player will get message");
UseServerAccount = c.get("Economy.UseServerAcount", false);
c.getW().addComment("Economy.AcountName", "Username should be with Correct capitalization");
ServerAcountName = c.get("Economy.AcountName", "Server");
UseServerAccount = c.get("Economy.UseServerAccount", false);
c.getW().addComment("Economy.AccountName", "Username should be with Correct capitalization");
ServerAccountName = c.get("Economy.AccountName", "Server");
c.getW().addComment("Economy.Taxes.use", "Do you want to use taxes feature for jobs payment");
UseTaxes = c.get("Economy.Taxes.use", false);
c.getW().addComment("Economy.Taxes.AccountName", "Username should be with Correct capitalization, it can be same as setup in server account before");
ServertaxesAcountName = c.get("Economy.Taxes.AccountName", "Server");
ServertaxesAccountName = c.get("Economy.Taxes.AccountName", "Server");
c.getW().addComment("Economy.Taxes.Amount", "Amount in percentage");
TaxesAmount = c.get("Economy.Taxes.Amount", 15.0);
c.getW().addComment("Economy.Taxes.TransferToServerAccount", "Do you want to transfer taxes to server account");
@ -869,12 +869,12 @@ public class GeneralConfigManager {
c.getW().addComment("ShowActionBars", "You can enable/disable message shown for players in action bar");
TitleChangeActionBar = c.get("ShowActionBars.OnTitleChange", true);
LevelChangeActionBar = c.get("ShowActionBars.OnLevelChange", true);
EmptyServerAcountActionBar = c.get("ShowActionBars.OnEmptyServerAcount", true);
EmptyServerAccountActionBar = c.get("ShowActionBars.OnEmptyServerAccount", true);
c.getW().addComment("ShowChatMessage", "Chat messages", "You can enable/disable message shown for players in chat");
TitleChangeChat = c.get("ShowChatMessage.OnTitleChange", true);
LevelChangeChat = c.get("ShowChatMessage.OnLevelChange", true);
EmptyServerAcountChat = c.get("ShowChatMessage.OnEmptyServerAcount", true);
EmptyServerAccountChat = c.get("ShowChatMessage.OnEmptyServerAccount", true);
c.getW().addComment("Sounds", "Sounds", "Extra sounds on some events",
"All sounds can be found in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html");

View File

@ -131,8 +131,8 @@ public class BufferedEconomy {
}
boolean hasMoney = false;
String ServerAccountname = Jobs.getGCManager().ServerAcountName;
String ServerTaxesAccountname = Jobs.getGCManager().ServertaxesAcountName;
String ServerAccountname = Jobs.getGCManager().ServerAccountName;
String ServerTaxesAccountname = Jobs.getGCManager().ServertaxesAccountName;
if (this.ServerAccount == null)
this.ServerAccount = Bukkit.getOfflinePlayer(ServerAccountname);
@ -145,11 +145,9 @@ public class BufferedEconomy {
if (ServerTaxesAccount.isOnline()) {
if (!Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getGCManager().ActionBarsMessageByDefault)
Jobs.getActionbarToggleList().put(ServerTaxesAccountname, true);
if (Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getActionbarToggleList().get(ServerTaxesAccountname)) {
Jobs.getActionBar();
if (Jobs.getActionbarToggleList().containsKey(ServerTaxesAccountname) && Jobs.getActionbarToggleList().get(ServerTaxesAccountname))
Jobs.getActionBar().send(Bukkit.getPlayer(ServerAccountname), Jobs.getLanguage().getMessage("message.taxes", "[amount]", (int) (TotalAmount * 100)
/ 100.0));
}
}
}
@ -184,14 +182,14 @@ public class BufferedEconomy {
Jobs.getActionBar().send(payment.getOfflinePlayer().getPlayer(), Jobs.getLanguage().getMessage("economy.error.nomoney"));
continue;
}
if (Jobs.getGCManager().isEconomyAsync()) {
if (Jobs.getGCManager().isEconomyAsync())
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
} else
else
Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
} else {
if (Jobs.getGCManager().isEconomyAsync()) {
if (Jobs.getGCManager().isEconomyAsync())
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new BufferedPaymentTask(this, economy, payment), i);
} else
else
Bukkit.getScheduler().runTaskLater(plugin, new BufferedPaymentTask(this, economy, payment), i);
}
try {
@ -211,19 +209,19 @@ public class BufferedEconomy {
}
public void ShowActionBar(BufferedPayment payment) {
if (!payment.getOfflinePlayer().isOnline()) {
if (!payment.getOfflinePlayer().isOnline())
return;
}
String playername = payment.getOfflinePlayer().getName();
if ((!Jobs.getActionbarToggleList().containsKey(playername)) && (Jobs.getGCManager().ActionBarsMessageByDefault)) {
if ((!Jobs.getActionbarToggleList().containsKey(playername)) && (Jobs.getGCManager().ActionBarsMessageByDefault))
Jobs.getActionbarToggleList().put(playername, Boolean.valueOf(true));
}
if (playername == null) {
if (playername == null)
return;
}
if (!Jobs.getActionbarToggleList().containsKey(playername)) {
if (!Jobs.getActionbarToggleList().containsKey(playername))
return;
}
Boolean show = Jobs.getActionbarToggleList().get(playername);
Player abp = Bukkit.getPlayer(payment.getOfflinePlayer().getUniqueId());
if ((abp != null) && (show.booleanValue())) {

View File

@ -1850,23 +1850,23 @@ Jobs:
income: 1.5
points: 1.5
experience: 3.0
beetroots:
beetroots-7:
income: 1.5
points: 1.5
experience: 3.0
wheat:
wheat-7:
income: 1.5
points: 1.5
experience: 3.0
carrots:
carrots-7:
income: 1.0
points: 1.0
experience: 1.0
potatoes:
potatoes-7:
income: 1.0
points: 1.0
experience: 1.0
pumpkin:
pumpkin-7:
income: 0.5
points: 0.5
experience: 1.0
@ -1874,7 +1874,7 @@ Jobs:
income: 0.2
points: 0.2
experience: 0.2
cocoa:
cocoa-2:
income: 4
points: 4
experience: 4.0