nitpick upstream
This commit is contained in:
parent
4d82df391c
commit
189f044d90
|
|
@ -60,6 +60,7 @@ import org.bukkit.event.block.SignChangeEvent;
|
|||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.world.PortalCreateEvent;
|
||||
import org.bukkit.event.world.StructureGrowEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
|
@ -977,4 +978,44 @@ public class BlockEventHandler implements Listener
|
|||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onNetherPortalCreate(final PortalCreateEvent event)
|
||||
{
|
||||
if (event.getReason() != PortalCreateEvent.CreateReason.NETHER_PAIR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore this event if preventNonPlayerCreatedPortals config option is disabled, and we don't know the entity.
|
||||
if (!(event.getEntity() instanceof Player) && !GriefPrevention.instance.config_claims_preventNonPlayerCreatedPortals)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (BlockState blockState : event.getBlocks())
|
||||
{
|
||||
Claim claim = this.dataStore.getClaimAt(blockState.getLocation(), false, null);
|
||||
if (claim != null)
|
||||
{
|
||||
if (event.getEntity() instanceof Player player)
|
||||
{
|
||||
Supplier<String> noPortalReason = claim.checkPermission(player, ClaimPermission.Build, event);
|
||||
|
||||
if (noPortalReason != null)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
GriefPrevention.sendMessage(player, TextMode.Err, noPortalReason.get());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cancels the event if in a claim, as we can not efficiently retrieve the person/entity who created the portal.
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
public boolean config_claims_lockWoodenDoors; //whether wooden doors should be locked by default (require /accesstrust)
|
||||
public boolean config_claims_lockTrapDoors; //whether trap doors should be locked by default (require /accesstrust)
|
||||
public boolean config_claims_lockFenceGates; //whether fence gates should be locked by default (require /accesstrust)
|
||||
public boolean config_claims_preventNonPlayerCreatedPortals; // whether portals where we cannot determine the creating player should be prevented from creation in claims
|
||||
public boolean config_claims_enderPearlsRequireAccessTrust; //whether teleporting into a claim with a pearl requires access trust
|
||||
public boolean config_claims_raidTriggersRequireBuildTrust; //whether raids are triggered by a player that doesn't have build permission in that claim
|
||||
public int config_claims_maxClaimsPerPlayer; //maximum number of claims per player
|
||||
|
|
@ -513,6 +514,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
this.config_claims_lockWoodenDoors = config.getBoolean("GriefPrevention.Claims.LockWoodenDoors", false);
|
||||
this.config_claims_lockTrapDoors = config.getBoolean("GriefPrevention.Claims.LockTrapDoors", false);
|
||||
this.config_claims_lockFenceGates = config.getBoolean("GriefPrevention.Claims.LockFenceGates", true);
|
||||
this.config_claims_preventNonPlayerCreatedPortals = config.getBoolean("GriefPrevention.Claims.PreventNonPlayerCreatedPortals", false);
|
||||
this.config_claims_enderPearlsRequireAccessTrust = config.getBoolean("GriefPrevention.Claims.EnderPearlsRequireAccessTrust", true);
|
||||
this.config_claims_raidTriggersRequireBuildTrust = config.getBoolean("GriefPrevention.Claims.RaidTriggersRequireBuildTrust", true);
|
||||
this.config_claims_initialBlocks = config.getInt("GriefPrevention.Claims.InitialBlocks", 100);
|
||||
|
|
|
|||
|
|
@ -1105,7 +1105,6 @@ class PlayerEventHandler implements Listener
|
|||
clickedBlockType == Material.STONECUTTER ||
|
||||
clickedBlockType == Material.SWEET_BERRY_BUSH ||
|
||||
clickedBlockType == Material.GLOW_BERRIES ||
|
||||
Tag.CANDLES.isTagged(clickedBlockType) ||
|
||||
Tag.CANDLE_CAKES.isTagged(clickedBlockType)
|
||||
)))
|
||||
{
|
||||
|
|
@ -1234,7 +1233,8 @@ class PlayerEventHandler implements Listener
|
|||
clickedBlockType == Material.DAYLIGHT_DETECTOR ||
|
||||
clickedBlockType == Material.COMPARATOR ||
|
||||
clickedBlockType == Material.REDSTONE_WIRE ||
|
||||
Tag.FLOWER_POTS.isTagged(clickedBlockType)
|
||||
Tag.FLOWER_POTS.isTagged(clickedBlockType) ||
|
||||
Tag.CANDLES.isTagged(clickedBlockType)
|
||||
))
|
||||
{
|
||||
if (playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user