1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 20:16:13 +01:00

New permission node jobs.noownershiptakeover to not take over existing

block ownership
This commit is contained in:
Zrips 2024-06-10 13:13:43 +03:00
parent 1708d3b0a2
commit 5c194bc8ca
5 changed files with 31 additions and 4 deletions

View File

@ -248,6 +248,14 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>D:\MC\Server 1.20.5\plugins\</outputDirectory>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -211,6 +211,7 @@ public class Job {
return totalPlayers; return totalPlayers;
} }
/** /**
* *
* @param change the amount to change * @param change the amount to change

View File

@ -127,6 +127,10 @@ public class BlockOwnerShip {
if (ownerUUID != null && !ownerUUID.equals(player.getUniqueId())) { if (ownerUUID != null && !ownerUUID.equals(player.getUniqueId())) {
if (Jobs.getGCManager().blockOwnershipTakeOver) { if (Jobs.getGCManager().blockOwnershipTakeOver) {
if (Jobs.getPermissionManager().hasPermission(jPlayer, "jobs.noownershiptakeover"))
return ownershipFeedback.invalid;
// Removing ownership to record new player // Removing ownership to record new player
this.remove(ownerUUID, CMILocation.toString(block.getLocation(), ":", true, true)); this.remove(ownerUUID, CMILocation.toString(block.getLocation(), ":", true, true));
block.removeMetadata(metadataName, plugin); block.removeMetadata(metadataName, plugin);

View File

@ -26,8 +26,6 @@ import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import com.gamingmesh.jobs.actions.*;
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
@ -94,6 +92,16 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
import com.bgsoftware.wildstacker.api.enums.StackSplit; import com.bgsoftware.wildstacker.api.enums.StackSplit;
import com.gamingmesh.jobs.ItemBoostManager; import com.gamingmesh.jobs.ItemBoostManager;
import com.gamingmesh.jobs.Jobs; import com.gamingmesh.jobs.Jobs;
import com.gamingmesh.jobs.actions.BlockActionInfo;
import com.gamingmesh.jobs.actions.BlockCollectInfo;
import com.gamingmesh.jobs.actions.CustomKillInfo;
import com.gamingmesh.jobs.actions.EnchantActionInfo;
import com.gamingmesh.jobs.actions.EntityActionInfo;
import com.gamingmesh.jobs.actions.ExploreActionInfo;
import com.gamingmesh.jobs.actions.ItemActionInfo;
import com.gamingmesh.jobs.actions.ItemNameActionInfo;
import com.gamingmesh.jobs.actions.PotionItemActionInfo;
import com.gamingmesh.jobs.actions.PyroFishingProInfo;
import com.gamingmesh.jobs.api.JobsChunkChangeEvent; import com.gamingmesh.jobs.api.JobsChunkChangeEvent;
import com.gamingmesh.jobs.container.ActionType; import com.gamingmesh.jobs.container.ActionType;
import com.gamingmesh.jobs.container.ExploreRespond; import com.gamingmesh.jobs.container.ExploreRespond;
@ -105,6 +113,7 @@ import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip;
import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip.ownershipFeedback; import com.gamingmesh.jobs.container.blockOwnerShip.BlockOwnerShip.ownershipFeedback;
import com.gamingmesh.jobs.hooks.HookManager; import com.gamingmesh.jobs.hooks.HookManager;
import com.gamingmesh.jobs.hooks.JobsHook; import com.gamingmesh.jobs.hooks.JobsHook;
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
import com.gamingmesh.jobs.stuff.Util; import com.gamingmesh.jobs.stuff.Util;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
@ -124,7 +133,6 @@ 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;
@ -1776,7 +1784,8 @@ public final class JobsPaymentListener implements Listener {
boolean isBrewingStand = cmat == CMIMaterial.BREWING_STAND || cmat == CMIMaterial.LEGACY_BREWING_STAND; boolean isBrewingStand = cmat == CMIMaterial.BREWING_STAND || cmat == CMIMaterial.LEGACY_BREWING_STAND;
boolean isFurnace = cmat == CMIMaterial.FURNACE || cmat == CMIMaterial.LEGACY_BURNING_FURNACE; boolean isFurnace = cmat == CMIMaterial.FURNACE || cmat == CMIMaterial.LEGACY_BURNING_FURNACE;
if (isFurnace || cmat == CMIMaterial.SMOKER || cmat == CMIMaterial.BLAST_FURNACE || isBrewingStand) { if ((isFurnace || cmat == CMIMaterial.SMOKER || cmat == CMIMaterial.BLAST_FURNACE || isBrewingStand)) {
BlockOwnerShip blockOwner = plugin.getBlockOwnerShip(cmat).orElse(null); BlockOwnerShip blockOwner = plugin.getBlockOwnerShip(cmat).orElse(null);
if (blockOwner == null) { if (blockOwner == null) {
return; return;
@ -1806,9 +1815,11 @@ public final class JobsPaymentListener implements Listener {
if (report) if (report)
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.noRegistration", "[block]", name)); CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.noRegistration", "[block]", name));
} else if (done == ownershipFeedback.newReg && jPlayer != null && jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) > 0) { } else if (done == ownershipFeedback.newReg && jPlayer != null && jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) > 0) {
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.newRegistration", "[block]", name, CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.newRegistration", "[block]", name,
"[current]", blockOwner.getTotal(jPlayer.getUniqueId()), "[current]", blockOwner.getTotal(jPlayer.getUniqueId()),
"[max]", jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) == 0 ? "-" : jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()))); "[max]", jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) == 0 ? "-" : jPlayer.getMaxOwnerShipAllowed(blockOwner.getType())));
} else if (done == ownershipFeedback.reenabled && jPlayer != null) { } else if (done == ownershipFeedback.reenabled && jPlayer != null) {
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.reenabledBlock")); CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.reenabledBlock"));
} }

View File

@ -238,3 +238,6 @@ permissions:
jobs.hidegtop: jobs.hidegtop:
description: Prevent player to be shown in the global jobs top description: Prevent player to be shown in the global jobs top
default: false default: false
jobs.noownershiptakeover:
description: Will not take over existing block ownership
default: op