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:
parent
1708d3b0a2
commit
5c194bc8ca
8
pom.xml
8
pom.xml
@ -248,6 +248,14 @@
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</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>
|
||||
</build>
|
||||
</project>
|
@ -211,6 +211,7 @@ public class Job {
|
||||
|
||||
return totalPlayers;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param change the amount to change
|
||||
|
@ -127,6 +127,10 @@ public class BlockOwnerShip {
|
||||
|
||||
if (ownerUUID != null && !ownerUUID.equals(player.getUniqueId())) {
|
||||
if (Jobs.getGCManager().blockOwnershipTakeOver) {
|
||||
|
||||
if (Jobs.getPermissionManager().hasPermission(jPlayer, "jobs.noownershiptakeover"))
|
||||
return ownershipFeedback.invalid;
|
||||
|
||||
// Removing ownership to record new player
|
||||
this.remove(ownerUUID, CMILocation.toString(block.getLocation(), ":", true, true));
|
||||
block.removeMetadata(metadataName, plugin);
|
||||
|
@ -26,8 +26,6 @@ import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.gamingmesh.jobs.actions.*;
|
||||
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -94,6 +92,16 @@ import org.bukkit.permissions.PermissionAttachmentInfo;
|
||||
import com.bgsoftware.wildstacker.api.enums.StackSplit;
|
||||
import com.gamingmesh.jobs.ItemBoostManager;
|
||||
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.container.ActionType;
|
||||
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.hooks.HookManager;
|
||||
import com.gamingmesh.jobs.hooks.JobsHook;
|
||||
import com.gamingmesh.jobs.hooks.pyroFishingPro.PyroFishingProManager;
|
||||
import com.gamingmesh.jobs.stuff.Util;
|
||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||
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.CMIMaterial;
|
||||
import net.Zrips.CMILib.Locale.LC;
|
||||
import net.Zrips.CMILib.Logs.CMIDebug;
|
||||
import net.Zrips.CMILib.Messages.CMIMessages;
|
||||
import net.Zrips.CMILib.Version.Version;
|
||||
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 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);
|
||||
if (blockOwner == null) {
|
||||
return;
|
||||
@ -1806,9 +1815,11 @@ public final class JobsPaymentListener implements Listener {
|
||||
if (report)
|
||||
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.noRegistration", "[block]", name));
|
||||
} else if (done == ownershipFeedback.newReg && jPlayer != null && jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) > 0) {
|
||||
|
||||
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.newRegistration", "[block]", name,
|
||||
"[current]", blockOwner.getTotal(jPlayer.getUniqueId()),
|
||||
"[max]", jPlayer.getMaxOwnerShipAllowed(blockOwner.getType()) == 0 ? "-" : jPlayer.getMaxOwnerShipAllowed(blockOwner.getType())));
|
||||
|
||||
} else if (done == ownershipFeedback.reenabled && jPlayer != null) {
|
||||
CMIActionBar.send(p, Jobs.getLanguage().getMessage("general.error.reenabledBlock"));
|
||||
}
|
||||
|
@ -238,3 +238,6 @@ permissions:
|
||||
jobs.hidegtop:
|
||||
description: Prevent player to be shown in the global jobs top
|
||||
default: false
|
||||
jobs.noownershiptakeover:
|
||||
description: Will not take over existing block ownership
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user