mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 12:35:28 +01:00
Fix for issue with smoker and blast furnace not removing ownership on
hopper fillups when you have PreventHopperFillUps set to true
This commit is contained in:
parent
79d3511b67
commit
4d0ed50e2b
@ -110,7 +110,7 @@ public class JobsCommands implements CommandExecutor {
|
||||
return args.length <= 1 ? new String[0] : Arrays.copyOfRange(args, 1, args.length);
|
||||
}
|
||||
|
||||
private boolean hasCommandPermission(CommandSender sender, String cmd) {
|
||||
private static boolean hasCommandPermission(CommandSender sender, String cmd) {
|
||||
return sender.hasPermission("jobs.command." + cmd);
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ public class bonus implements Cmd {
|
||||
return true;
|
||||
}
|
||||
|
||||
private void printBoost(CommandSender sender, Boost boost, BoostOf type) {
|
||||
private static void printBoost(CommandSender sender, Boost boost, BoostOf type) {
|
||||
String prefix = ChatColor.GOLD + "*";
|
||||
if (type != BoostOf.NearSpawner && type != BoostOf.PetPay)
|
||||
prefix = "";
|
||||
|
@ -29,7 +29,12 @@ import com.gamingmesh.jobs.container.*;
|
||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling;
|
||||
import com.gamingmesh.jobs.stuff.FurnaceBrewingHandling.ownershipFeedback;
|
||||
import com.google.common.base.Objects;
|
||||
import org.bukkit.*;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Furnace;
|
||||
@ -37,7 +42,16 @@ import org.bukkit.block.data.Ageable;
|
||||
import org.bukkit.block.data.Levelled;
|
||||
import org.bukkit.block.data.type.Beehive;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.entity.Damageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
@ -49,7 +63,12 @@ import org.bukkit.event.entity.*;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
|
||||
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.inventory.*;
|
||||
import org.bukkit.event.inventory.BrewEvent;
|
||||
import org.bukkit.event.inventory.CraftItemEvent;
|
||||
import org.bukkit.event.inventory.FurnaceSmeltEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.inventory.InventoryType.SlotType;
|
||||
import org.bukkit.event.player.PlayerFishEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
@ -919,17 +938,38 @@ public class JobsPaymentListener implements Listener {
|
||||
try {
|
||||
if (!plugin.isEnabled())
|
||||
return;
|
||||
if (event.getDestination().getType() != InventoryType.FURNACE)
|
||||
return;
|
||||
|
||||
if (!Jobs.getGCManager().PreventHopperFillUps)
|
||||
return;
|
||||
|
||||
String type = event.getDestination().getType().toString();
|
||||
if (!type.equalsIgnoreCase("FURNACE") && !type.equalsIgnoreCase("SMOKER") && !type.equalsIgnoreCase("BLAST_FURNACE"))
|
||||
return;
|
||||
|
||||
if (event.getItem() == null || event.getItem().getType() == Material.AIR)
|
||||
return;
|
||||
Furnace furnace = (Furnace) event.getDestination().getHolder();
|
||||
//disabling plugin in world
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(furnace.getWorld()))
|
||||
Block block = null;
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
case "furnace":
|
||||
block = ((Furnace) event.getDestination().getHolder()).getBlock();
|
||||
break;
|
||||
case "smoker":
|
||||
// This should be done in this way to have backwards compatibility
|
||||
block = ((org.bukkit.block.Smoker) event.getDestination().getHolder()).getBlock();
|
||||
break;
|
||||
case "blast_furnace":
|
||||
// This should be done in this way to have backwards compatibility
|
||||
block = ((org.bukkit.block.BlastFurnace) event.getDestination().getHolder()).getBlock();
|
||||
break;
|
||||
}
|
||||
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
//disabling plugin in world
|
||||
if (!Jobs.getGCManager().canPerformActionInWorld(block.getWorld()))
|
||||
return;
|
||||
Block block = furnace.getBlock();
|
||||
|
||||
if (block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
|
Loading…
Reference in New Issue
Block a user