1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-12-01 15:03:36 +01:00

Added option to config to pay exploring when player gliding

- Now not generates the bossbar options when using 1.8 or lower versions.
This commit is contained in:
montlikadani 2019-02-27 19:02:00 +01:00
parent b79f761524
commit 0dca69e891
2 changed files with 33 additions and 32 deletions

View File

@ -49,6 +49,7 @@ public class GeneralConfigManager {
protected boolean isBroadcastingLevelups;
protected boolean payInCreative;
protected boolean payExploringWhenFlying;
public boolean payExploringWhenGliding;
protected boolean addXpPlayer;
public boolean payItemDurabilityLoss;
protected boolean hideJobsWithoutPermission;
@ -516,6 +517,11 @@ public class GeneralConfigManager {
c.addComment("enable-pay-for-exploring-when-flying", "Option to allow payment to be made for exploring when player flies");
payExploringWhenFlying = c.get("enable-pay-for-exploring-when-flying", false);
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)) {
c.addComment("enable-pay-for-exploring-when-gliding", "Option to allow payment to be made for exploring when player gliding.");
payExploringWhenGliding = c.get("enable-pay-for-exploring-when-gliding", false);
}
c.addComment("add-xp-player", "Adds the Jobs xp received to the player's Minecraft XP bar");
addXpPlayer = c.get("add-xp-player", false);
@ -821,17 +827,10 @@ public class GeneralConfigManager {
c.addComment("ActionBars.Messages.EnabledByDefault", "When this set to true player will see action bar messages by default");
ActionBarsMessageByDefault = c.get("ActionBars.Messages.EnabledByDefault", true);
if (Jobs.getVersionCheckManager().getVersion().isEqualOrHigher(Version.v1_9_R1)) {
c.addComment("BossBar.Enabled", "Enables BossBar feature", "Works only from 1.9 mc version");
BossBarEnabled = c.get("BossBar.Enabled", true);
if (BossBarEnabled == true) {
if (Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1)) {
Jobs.consoleMsg("&c[Jobs] Your server version don't support BossBar. This feature will be disabled.");
c.set("BossBar.Enabled", false);
BossBarEnabled = false;
}
}
c.addComment("BossBar.Messages.EnabledByDefault", "When this set to true player will see Bossbar messages by default");
BossBarsMessageByDefault = c.get("BossBar.Messages.EnabledByDefault", true);
@ -841,6 +840,7 @@ public class GeneralConfigManager {
c.addComment("BossBar.Timer", "How long in sec to show BossBar for player",
"If you have disabled ShowOnEachAction, then keep this number higher than payment interval for better experience");
BossBarTimer = c.get("BossBar.Timer", economyBatchDelay + 1);
}
c.addComment("ShowActionBars", "You can enable/disable message shown for players in action bar");
TitleChangeActionBar = c.get("ShowActionBars.OnTitleChange", true);
@ -855,11 +855,11 @@ public class GeneralConfigManager {
c.addComment("Sounds", "Sounds", "Extra sounds on some events",
"All sounds can be found in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html");
SoundLevelupUse = c.get("Sounds.LevelUp.use", true);
SoundLevelupSound = c.get("Sounds.LevelUp.sound", "ENTITY_PLAYER_LEVELUP");
SoundLevelupSound = c.get("Sounds.LevelUp.sound", Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP");
SoundLevelupVolume = c.get("Sounds.LevelUp.volume", 1);
SoundLevelupPitch = c.get("Sounds.LevelUp.pitch", 3);
SoundTitleChangeUse = c.get("Sounds.TitleChange.use", true);
SoundTitleChangeSound = c.get("Sounds.TitleChange.sound", "ENTITY_PLAYER_LEVELUP");
SoundTitleChangeSound = c.get("Sounds.TitleChange.sound", Jobs.getVersionCheckManager().getVersion().isLower(Version.v1_9_R1) ? "LEVEL_UP " : "ENTITY_PLAYER_LEVELUP");
SoundTitleChangeVolume = c.get("Sounds.TitleChange.volume", 1);
SoundTitleChangePitch = c.get("Sounds.TitleChange.pitch", 3);

View File

@ -241,9 +241,7 @@ public class JobsPaymentListener implements Listener {
if (jPlayer == null)
return;
// Fix bug when the player has not joined a job, milk a cow and get paid
for (com.gamingmesh.jobs.container.Job jobs : Jobs.getJobs()) {
if (jPlayer.isInJob(jobs) && Jobs.getGCManager().CowMilkingTimer > 0) {
if (Jobs.getGCManager().CowMilkingTimer > 0) {
if (cow.hasMetadata(CowMetadata)) {
long time = cow.getMetadata(CowMetadata).get(0).asLong();
if (System.currentTimeMillis() < time + Jobs.getGCManager().CowMilkingTimer) {
@ -256,7 +254,6 @@ public class JobsPaymentListener implements Listener {
}
}
}
}
Jobs.action(jPlayer, new EntityActionInfo(cow, ActionType.MILK));
@ -1626,6 +1623,10 @@ public class JobsPaymentListener implements Listener {
if (!Jobs.getGCManager().payExploringWhenFlying() && player.isFlying())
return;
if (!Jobs.getGCManager().payExploringWhenGliding && player.isGliding())
return;
ExploreRespond respond = Jobs.getExplore().ChunkRespond(player, event.getNewChunk());
if (!respond.isNewChunk())