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

Improved baking action doesn't pay enough when items are on another block

- Removed some deprecated methods
This commit is contained in:
montlikadani 2020-03-26 09:12:39 +01:00
parent 83377ddee0
commit 9e006ebe89
2 changed files with 10 additions and 65 deletions

View File

@ -28,12 +28,6 @@ import com.gamingmesh.jobs.Placeholders.NewPlaceholderAPIHook;
import com.gamingmesh.jobs.Placeholders.Placeholder;
import com.gamingmesh.jobs.Placeholders.PlaceholderAPIHook;
import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.hooks.McMMO.McMMOManager;
import com.gamingmesh.jobs.hooks.MyPet.MyPetManager;
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobInterface;
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs2;
import com.gamingmesh.jobs.hooks.MythicMobs.MythicMobs4;
import com.gamingmesh.jobs.hooks.WorldGuard.WorldGuardManager;
import com.gamingmesh.jobs.Signs.SignUtil;
import com.gamingmesh.jobs.api.JobsExpGainEvent;
import com.gamingmesh.jobs.api.JobsPrePaymentEvent;
@ -93,15 +87,6 @@ public class Jobs extends JavaPlugin {
private static PistonProtectionListener PistonProtectionListener = null;
@Deprecated
private static McMMOManager McMMOManager = null;
@Deprecated
private static MythicMobInterface MythicManager = null;
@Deprecated
private static MyPetManager myPetManager = null;
@Deprecated
private static WorldGuardManager worldGuardManager = null;
private static ConfigManager configManager = null;
private static GeneralConfigManager GconfigManager = null;
@ -136,28 +121,12 @@ public class Jobs extends JavaPlugin {
private static PointsData pointsDatabase = null;
@Deprecated
public static McMMOManager getMcMMOManager() {
if (McMMOManager == null)
McMMOManager = new McMMOManager();
return McMMOManager;
}
public static PistonProtectionListener getPistonProtectionListener() {
if (PistonProtectionListener == null)
PistonProtectionListener = new PistonProtectionListener();
return PistonProtectionListener;
}
@Deprecated
public static MyPetManager getMyPetManager() {
if (myPetManager == null && getInstance().getServer().getPluginManager().getPlugin("MyPet") != null) {
myPetManager = new MyPetManager();
}
return myPetManager;
}
private Placeholder Placeholder;
private boolean PlaceholderAPIEnabled = false;
@ -191,32 +160,6 @@ public class Jobs extends JavaPlugin {
return true;
}
@Deprecated
public static WorldGuardManager getWorldGuardManager() {
return worldGuardManager;
}
@Deprecated
public void setMythicManager() {
try {
Class.forName("net.elseland.xikage.MythicMobs.API.MythicMobsAPI");
MythicManager = new MythicMobs2(this);
} catch (ClassNotFoundException e) {
try {
Class.forName("io.lumine.xikage.mythicmobs.api.bukkit.BukkitAPIHelper");
MythicManager = new MythicMobs4(this);
} catch (ClassNotFoundException ex) {
}
}
if (MythicManager != null)
consoleMsg("&e[Jobs] MythicMobs detected.");
}
@Deprecated
public static MythicMobInterface getMythicManager() {
return MythicManager;
}
public static Loging getLoging() {
if (loging == null)
loging = new Loging();
@ -488,7 +431,7 @@ public class Jobs extends JavaPlugin {
}
public static Job getJob(int id) {
return getJobsIds().get(id);
return jobsIds.get(id);
}
public boolean isPlaceholderAPIEnabled() {

View File

@ -3,6 +3,7 @@ package com.gamingmesh.jobs.listeners;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.bukkit.block.Campfire;
import org.bukkit.entity.Player;
@ -20,7 +21,7 @@ import com.gamingmesh.jobs.container.PlayerCamp;
public class JobsPayment14Listener implements Listener {
private Map<Player, PlayerCamp> campPlayers = new HashMap<>();
private final Map<PlayerCamp, Player> campPlayers = new HashMap<>();
@EventHandler(priority = EventPriority.LOW)
public void onCook(BlockCookEvent event) {
@ -36,22 +37,23 @@ public class JobsPayment14Listener implements Listener {
if (!(event.getBlock().getState() instanceof Campfire))
return;
for (Iterator<Map.Entry<Player, PlayerCamp>> it = campPlayers.entrySet().iterator(); it.hasNext();) {
Map.Entry<Player, PlayerCamp> camps = it.next();
for (Iterator<Entry<PlayerCamp, Player>> it = campPlayers.entrySet().iterator(); it.hasNext();) {
Entry<PlayerCamp, Player> camps = it.next();
if (camps == null) {
continue;
}
if (!camps.getValue().getBlock().getLocation().equals(event.getBlock().getLocation())) {
PlayerCamp camp = camps.getKey();
if (!camp.getBlock().getLocation().equals(event.getBlock().getLocation())) {
continue;
}
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(camps.getKey());
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(camps.getValue());
if (jPlayer == null)
return;
Jobs.action(jPlayer, new ItemActionInfo(event.getSource(), ActionType.BAKE));
if (camps.getValue().getItem().equals(event.getSource())) {
if (camp.getItem().equals(event.getSource())) {
it.remove();
}
}
@ -79,6 +81,6 @@ public class JobsPayment14Listener implements Listener {
if (!JobsPaymentListener.payIfCreative(p))
return;
campPlayers.put(p, new PlayerCamp(ev.getItem(), click));
campPlayers.put(new PlayerCamp(ev.getItem(), click), p);
}
}