mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-29 05:55:27 +01:00
Lets include Smoker into smelt event
This commit is contained in:
parent
9cac1806e2
commit
7f4c85a4ad
@ -49,6 +49,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
import org.bukkit.event.block.BlockCookEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.enchantment.EnchantItemEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
@ -394,10 +395,12 @@ public class JobsPaymentListener implements Listener {
|
||||
// check if player is riding
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
if (cmat.equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
if (cmat.equals(CMIMaterial.SMOKER) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
if (cmat.equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeBrewing(block);
|
||||
|
||||
if (!Jobs.getPermissionHandler().hasWorldPermission(player, player.getLocation().getWorld().getName()))
|
||||
@ -1551,10 +1554,14 @@ public class JobsPaymentListener implements Listener {
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
|
||||
if (cmat.equals(CMIMaterial.FURNACE) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
if (cmat.equals(CMIMaterial.SMOKER) && block.hasMetadata(furnaceOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeFurnace(block);
|
||||
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
if (cmat.equals(CMIMaterial.BREWING_STAND) && block.hasMetadata(brewingOwnerMetadata))
|
||||
FurnaceBrewingHandling.removeBrewing(block);
|
||||
|
||||
if (Jobs.getGCManager().useBlockProtection)
|
||||
@ -1577,8 +1584,8 @@ public class JobsPaymentListener implements Listener {
|
||||
Block block = event.getClickedBlock();
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
if (CMIMaterial.get(block).equals(CMIMaterial.FURNACE) || CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE)) {
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
if (cmat.equals(CMIMaterial.FURNACE) || cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) || cmat.equals(CMIMaterial.SMOKER)) {
|
||||
if (!Jobs.getGCManager().isFurnacesReassign())
|
||||
return;
|
||||
|
||||
|
@ -43,32 +43,32 @@ public class FurnaceBrewingHandling {
|
||||
|
||||
try {
|
||||
for (String one : section.getKeys(false)) {
|
||||
String value = section.getString(one);
|
||||
List<String> ls = new ArrayList<>();
|
||||
if (value.contains(";"))
|
||||
ls.addAll(Arrays.asList(value.split(";")));
|
||||
else
|
||||
ls.add(value);
|
||||
UUID uuid = UUID.fromString(one);
|
||||
String value = section.getString(one);
|
||||
List<String> ls = new ArrayList<>();
|
||||
if (value.contains(";"))
|
||||
ls.addAll(Arrays.asList(value.split(";")));
|
||||
else
|
||||
ls.add(value);
|
||||
UUID uuid = UUID.fromString(one);
|
||||
|
||||
if (uuid == null)
|
||||
continue;
|
||||
List<blockLoc> blist = new ArrayList<>();
|
||||
for (String oneL : ls) {
|
||||
blockLoc bl = new blockLoc(oneL);
|
||||
Block block = bl.getBlock();
|
||||
if (block == null)
|
||||
if (uuid == null)
|
||||
continue;
|
||||
List<blockLoc> blist = new ArrayList<>();
|
||||
for (String oneL : ls) {
|
||||
blockLoc bl = new blockLoc(oneL);
|
||||
Block block = bl.getBlock();
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
||||
block.setMetadata(JobsPaymentListener.furnaceOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), one));
|
||||
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
||||
block.setMetadata(JobsPaymentListener.furnaceOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), one));
|
||||
|
||||
blist.add(bl);
|
||||
}
|
||||
if (!blist.isEmpty()) {
|
||||
furnaceMap.put(uuid, blist);
|
||||
totalf += blist.size();
|
||||
}
|
||||
blist.add(bl);
|
||||
}
|
||||
if (!blist.isEmpty()) {
|
||||
furnaceMap.put(uuid, blist);
|
||||
totalf += blist.size();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -83,33 +83,33 @@ public class FurnaceBrewingHandling {
|
||||
|
||||
try {
|
||||
for (String one : section.getKeys(false)) {
|
||||
String value = section.getString(one);
|
||||
List<String> ls = new ArrayList<>();
|
||||
if (value.contains(";"))
|
||||
ls.addAll(Arrays.asList(value.split(";")));
|
||||
else
|
||||
ls.add(value);
|
||||
UUID uuid = UUID.fromString(one);
|
||||
String value = section.getString(one);
|
||||
List<String> ls = new ArrayList<>();
|
||||
if (value.contains(";"))
|
||||
ls.addAll(Arrays.asList(value.split(";")));
|
||||
else
|
||||
ls.add(value);
|
||||
UUID uuid = UUID.fromString(one);
|
||||
|
||||
if (uuid == null)
|
||||
continue;
|
||||
|
||||
List<blockLoc> blist = new ArrayList<>();
|
||||
for (String oneL : ls) {
|
||||
blockLoc bl = new blockLoc(oneL);
|
||||
Block block = bl.getBlock();
|
||||
if (block == null)
|
||||
if (uuid == null)
|
||||
continue;
|
||||
|
||||
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
|
||||
block.setMetadata(JobsPaymentListener.brewingOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), one));
|
||||
List<blockLoc> blist = new ArrayList<>();
|
||||
for (String oneL : ls) {
|
||||
blockLoc bl = new blockLoc(oneL);
|
||||
Block block = bl.getBlock();
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
blist.add(bl);
|
||||
}
|
||||
if (!blist.isEmpty()) {
|
||||
brewingMap.put(uuid, blist);
|
||||
totalb += blist.size();
|
||||
}
|
||||
block.removeMetadata(JobsPaymentListener.brewingOwnerMetadata, Jobs.getInstance());
|
||||
block.setMetadata(JobsPaymentListener.brewingOwnerMetadata, new FixedMetadataValue(Jobs.getInstance(), one));
|
||||
|
||||
blist.add(bl);
|
||||
}
|
||||
if (!blist.isEmpty()) {
|
||||
brewingMap.put(uuid, blist);
|
||||
totalb += blist.size();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
@ -240,8 +240,8 @@ public class FurnaceBrewingHandling {
|
||||
}
|
||||
|
||||
public static ownershipFeedback registerFurnaces(Player player, Block block) {
|
||||
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE))
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
if (!cmat.equals(CMIMaterial.FURNACE) && !cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) && !cmat.equals(CMIMaterial.SMOKER))
|
||||
return ownershipFeedback.invalid;
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
@ -336,8 +336,8 @@ public class FurnaceBrewingHandling {
|
||||
Block block = one.getBlock();
|
||||
if (block == null)
|
||||
continue;
|
||||
|
||||
if (!CMIMaterial.get(block).equals(CMIMaterial.FURNACE) && !CMIMaterial.get(block).equals(CMIMaterial.LEGACY_BURNING_FURNACE))
|
||||
CMIMaterial cmat = CMIMaterial.get(block);
|
||||
if (!cmat.equals(CMIMaterial.FURNACE) && !cmat.equals(CMIMaterial.LEGACY_BURNING_FURNACE) && !cmat.equals(CMIMaterial.SMOKER))
|
||||
continue;
|
||||
block.removeMetadata(JobsPaymentListener.furnaceOwnerMetadata, Jobs.getInstance());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user