mirror of
https://github.com/Zrips/Jobs.git
synced 2025-01-16 13:11:19 +01:00
PyroFishing fix
This commit is contained in:
parent
eed592e5bd
commit
1708d3b0a2
@ -1306,7 +1306,7 @@ public final class Jobs extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//need to update bp
|
//need to update bp
|
||||||
if (block != null) {
|
if (block != null && !Jobs.getGCManager().useBlockProtectionBlockTracker) {
|
||||||
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
BlockProtection bp = getBpManager().getBp(block.getLocation());
|
||||||
if (bp != null)
|
if (bp != null)
|
||||||
bp.setPaid(true);
|
bp.setPaid(true);
|
||||||
|
@ -384,6 +384,8 @@ public class LanguageManager {
|
|||||||
c.get("command.info.output.mmkill.none", "%jobname% does not get money for killing Mythic monsters.");
|
c.get("command.info.output.mmkill.none", "%jobname% does not get money for killing Mythic monsters.");
|
||||||
c.get("command.info.output.fish.info", "&eFish");
|
c.get("command.info.output.fish.info", "&eFish");
|
||||||
c.get("command.info.output.fish.none", "%jobname% does not get money from fishing.");
|
c.get("command.info.output.fish.none", "%jobname% does not get money from fishing.");
|
||||||
|
c.get("command.info.output.pyrofishingpro.info", "&eFish");
|
||||||
|
c.get("command.info.output.pyrofishingpro.none", "%jobname% does not get money from fishing.");
|
||||||
c.get("command.info.output.craft.info", "&eCraft");
|
c.get("command.info.output.craft.info", "&eCraft");
|
||||||
c.get("command.info.output.craft.none", "%jobname% does not get money from crafting.");
|
c.get("command.info.output.craft.none", "%jobname% does not get money from crafting.");
|
||||||
c.get("command.info.output.smelt.info", "&eSmelt");
|
c.get("command.info.output.smelt.info", "&eSmelt");
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package com.gamingmesh.jobs.hooks.pyroFishingPro;
|
package com.gamingmesh.jobs.hooks.pyroFishingPro;
|
||||||
|
|
||||||
import com.gamingmesh.jobs.Jobs;
|
|
||||||
import me.arsmagica.API.PyroFishCatchEvent;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
|
import com.gamingmesh.jobs.Jobs;
|
||||||
|
|
||||||
|
import me.arsmagica.API.PyroFishCatchEvent;
|
||||||
|
|
||||||
public class PyroFishingProManager implements Listener {
|
public class PyroFishingProManager implements Listener {
|
||||||
public static String lastFish;
|
private static String lastFish;
|
||||||
|
private static long time = 0;
|
||||||
private final Jobs jobs;
|
private final Jobs jobs;
|
||||||
|
|
||||||
public PyroFishingProManager() {
|
public PyroFishingProManager() {
|
||||||
@ -18,5 +21,12 @@ public class PyroFishingProManager implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||||
public void onPyroFishCatch(PyroFishCatchEvent event) {
|
public void onPyroFishCatch(PyroFishCatchEvent event) {
|
||||||
lastFish = event.getTier();
|
lastFish = event.getTier();
|
||||||
|
time = System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFish() {
|
||||||
|
if (time + 60 < System.currentTimeMillis())
|
||||||
|
return null;
|
||||||
|
return lastFish;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -124,6 +124,7 @@ import net.Zrips.CMILib.Items.CMIItemStack;
|
|||||||
import net.Zrips.CMILib.Items.CMIMC;
|
import net.Zrips.CMILib.Items.CMIMC;
|
||||||
import net.Zrips.CMILib.Items.CMIMaterial;
|
import net.Zrips.CMILib.Items.CMIMaterial;
|
||||||
import net.Zrips.CMILib.Locale.LC;
|
import net.Zrips.CMILib.Locale.LC;
|
||||||
|
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||||
import net.Zrips.CMILib.Version.Version;
|
import net.Zrips.CMILib.Version.Version;
|
||||||
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
import net.Zrips.CMILib.Version.Schedulers.CMIScheduler;
|
||||||
@ -518,6 +519,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerFish(PlayerFishEvent event) {
|
public void onPlayerFish(PlayerFishEvent event) {
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
if (!Jobs.getGCManager().canPerformActionInWorld(player.getWorld()))
|
||||||
@ -549,10 +551,8 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JobsHook.PyroFishingPro.isEnabled()) {
|
if (JobsHook.PyroFishingPro.isEnabled() && PyroFishingProManager.getFish() != null) {
|
||||||
if (PyroFishingProManager.lastFish != null) {
|
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new PyroFishingProInfo(PyroFishingProManager.getFish(), ActionType.PYROFISHINGPRO), event.getCaught());
|
||||||
Jobs.action(Jobs.getPlayerManager().getJobsPlayer(player), new PyroFishingProInfo(PyroFishingProManager.lastFish, ActionType.PYROFISHINGPRO));
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1111,26 +1111,7 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
if (block == null || !Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final Block finalBlock = block;
|
processItemMove(block);
|
||||||
plugin.getBlockOwnerShip(CMIMaterial.get(finalBlock)).ifPresent(os -> {
|
|
||||||
if (os.disable(finalBlock) && Jobs.getGCManager().informOnPaymentDisable) {
|
|
||||||
|
|
||||||
UUID uuid = plugin.getBlockOwnerShip(CMIMaterial.get(finalBlock)).get().getOwnerByLocation(finalBlock.getLocation());
|
|
||||||
Player player = Bukkit.getPlayer(uuid);
|
|
||||||
if (player == null || !player.isOnline())
|
|
||||||
return;
|
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
|
||||||
String lc = CMILocation.toString(finalBlock.getLocation());
|
|
||||||
|
|
||||||
if (!jPlayer.hasBlockOwnerShipInform(lc)) {
|
|
||||||
CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled",
|
|
||||||
"[type]", CMIMaterial.get(finalBlock).getName(),
|
|
||||||
"[location]", LC.Location_Full.getLocale(finalBlock.getLocation())));
|
|
||||||
jPlayer.addBlockOwnerShipInform(lc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
@ -1143,25 +1124,32 @@ public final class JobsPaymentListener implements Listener {
|
|||||||
|
|
||||||
final BrewingStand stand = (BrewingStand) event.getDestination().getHolder();
|
final BrewingStand stand = (BrewingStand) event.getDestination().getHolder();
|
||||||
|
|
||||||
if (Jobs.getGCManager().canPerformActionInWorld(stand.getWorld()))
|
if (!Jobs.getGCManager().canPerformActionInWorld(stand.getWorld()))
|
||||||
plugin.getBlockOwnerShip(CMIMaterial.get(stand.getBlock())).ifPresent(os -> {
|
return;
|
||||||
if (os.disable(stand.getBlock()) && Jobs.getGCManager().informOnPaymentDisable) {
|
|
||||||
|
|
||||||
UUID uuid = plugin.getBlockOwnerShip(CMIMaterial.get(stand.getBlock())).get().getOwnerByLocation(stand.getLocation());
|
processItemMove(stand.getBlock());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processItemMove(Block block) {
|
||||||
|
plugin.getBlockOwnerShip(CMIMaterial.get(block)).ifPresent(os -> {
|
||||||
|
if (!os.disable(block) || !Jobs.getGCManager().informOnPaymentDisable)
|
||||||
|
return;
|
||||||
|
|
||||||
|
UUID uuid = plugin.getBlockOwnerShip(CMIMaterial.get(block)).get().getOwnerByLocation(block.getLocation());
|
||||||
Player player = Bukkit.getPlayer(uuid);
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
if (player == null || !player.isOnline())
|
if (player == null || !player.isOnline())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||||
String lc = CMILocation.toString(stand.getLocation());
|
String lc = CMILocation.toString(block.getLocation());
|
||||||
|
|
||||||
|
if (jPlayer.hasBlockOwnerShipInform(lc))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!jPlayer.hasBlockOwnerShipInform(lc)) {
|
|
||||||
CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled",
|
CMIMessages.sendMessage(player, Jobs.getLanguage().getMessage("general.error.blockDisabled",
|
||||||
"[type]", CMIMaterial.get(stand.getBlock()).getName(),
|
"[type]", CMIMaterial.get(block).getName(),
|
||||||
"[location]", LC.Location_Full.getLocale(stand.getLocation())));
|
"[location]", LC.Location_Full.getLocale(block.getLocation())));
|
||||||
jPlayer.addBlockOwnerShipInform(lc);
|
jPlayer.addBlockOwnerShipInform(lc);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user