mirror of
https://github.com/Zrips/Jobs.git
synced 2024-11-26 12:35:28 +01:00
Add ability to prevent crop resize payment when we places more cactus
This commit is contained in:
parent
b5c1516177
commit
4d173e0623
@ -67,6 +67,7 @@ public class GeneralConfigManager {
|
||||
public boolean disablePaymentIfRiding;
|
||||
protected boolean addXpPlayer;
|
||||
public boolean boostedItemsInOffHand;
|
||||
public boolean preventCropResizePayment;
|
||||
public boolean payItemDurabilityLoss;
|
||||
protected boolean hideJobsWithoutPermission;
|
||||
protected int maxJobs;
|
||||
@ -583,6 +584,10 @@ public class GeneralConfigManager {
|
||||
boostedItemsInOffHand = c.get("enable-boosted-items-in-offhand", true);
|
||||
}
|
||||
|
||||
c.addComment("enable-payment-for-planting-blocks", "Do you want to prevent crop resizing payment when placing more cactus?",
|
||||
"This option is only related to: sugar_cane, cactus, kelp, bamboo");
|
||||
preventCropResizePayment = c.get("prevent-crop-resize-payment", false);
|
||||
|
||||
c.addComment("allow-pay-for-durability-loss", "Allows, when losing maximum durability of item then it does not pay the player until it is repaired.",
|
||||
"E.g. the player wants to enchant a item with enchanting table and the item has durability loss then not paying.");
|
||||
c.addComment("allow-pay-for-durability-loss.Use", "Do not disable this if you don't know what mean this option.");
|
||||
|
@ -37,6 +37,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BrewingStand;
|
||||
import org.bukkit.block.Furnace;
|
||||
import org.bukkit.block.data.Ageable;
|
||||
@ -452,6 +453,14 @@ public class JobsPaymentListener implements Listener {
|
||||
if (Jobs.getGCManager().disablePaymentIfRiding && player.isInsideVehicle())
|
||||
return;
|
||||
|
||||
// Prevent money duplication when placing plant blocks
|
||||
Material placedBlock = event.getBlockPlaced().getRelative(BlockFace.DOWN).getType();
|
||||
if (Jobs.getGCManager().preventCropResizePayment && (placedBlock == CMIMaterial.SUGAR_CANE.getMaterial()
|
||||
|| placedBlock == CMIMaterial.KELP.getMaterial()
|
||||
|| placedBlock == CMIMaterial.CACTUS.getMaterial() || placedBlock == CMIMaterial.BAMBOO.getMaterial())) {
|
||||
return;
|
||||
}
|
||||
|
||||
JobsPlayer jPlayer = Jobs.getPlayerManager().getJobsPlayer(player);
|
||||
if (jPlayer == null)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user