Skip to content

Commit

Permalink
Merge branch 'master' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock committed Mar 29, 2024
2 parents 655fb99 + e85054b commit 9c21348
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 794 deletions.
17 changes: 0 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>essx-repo</id>
<url>https://ci.ender.zone/plugin/repository/everything/</url>
</repository>
</repositories>

<build>
Expand Down Expand Up @@ -149,19 +145,6 @@
<version>1.20.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Vault dependency -->
<dependency>
<groupId>net.milkbowl.vault</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Annotations for nullity and other behaviors -->
<dependency>
<groupId>org.jetbrains</groupId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,13 @@ public void onBlockPlace(BlockPlaceEvent placeEvent)
{
playerData.lastClaim = claim;

//warn about TNT not destroying claimed blocks
if (block.getType() == Material.TNT && !claim.areExplosivesAllowed && playerData.sendClaimExplosionMessages)
//warn about TNT not destroying claimed blocks (10 minute cooldown)
Long now = null;
if (block.getType() == Material.TNT && !claim.areExplosivesAllowed && (playerData.explosivesWarningTimestamp == null || (now = System.currentTimeMillis()) - playerData.explosivesWarningTimestamp > 600000))
{
if (now == null) now = System.currentTimeMillis();
playerData.explosivesWarningTimestamp = now;

GriefPrevention.sendMessage(player, TextMode.Warn, Messages.NoTNTDamageClaims);
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.ClaimExplosivesAdvertisement);
}
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/me/ryanhamshire/GriefPrevention/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1351,16 +1351,6 @@ protected void loadMessages()
this.addDefault(defaults, Messages.NoPermissionTrust, "You don't have {0}'s permission to manage permissions here.", "0: claim owner's name");
this.addDefault(defaults, Messages.ClearPermissionsOneClaim, "Cleared permissions in this claim. To set permission for ALL your claims, stand outside them.", null);
this.addDefault(defaults, Messages.UntrustIndividualSingleClaim, "Revoked {0}'s access to this claim. To set permissions for a ALL your claims, stand outside them.", "0: untrusted player");
this.addDefault(defaults, Messages.OnlySellBlocks, "Claim blocks may only be sold, not purchased.", null);
this.addDefault(defaults, Messages.BlockPurchaseCost, "Each claim block costs {0}. Your balance is {1}.", "0: cost of one block; 1: player's account balance");
this.addDefault(defaults, Messages.ClaimBlockLimit, "You've reached your claim block limit. You can't purchase more.", null);
this.addDefault(defaults, Messages.InsufficientFunds, "You don't have enough money. You need {0}, but you only have {1}.", "0: total cost; 1: player's account balance");
this.addDefault(defaults, Messages.MaxBonusReached, "Can't purchase {0} more claim blocks. The server has a limit of {1} bonus claim blocks.", "0: block count; 1: bonus claims limit");
this.addDefault(defaults, Messages.PurchaseConfirmation, "Withdrew {0} from your account. You now have {1} available claim blocks.", "0: total cost; 1: remaining blocks");
this.addDefault(defaults, Messages.OnlyPurchaseBlocks, "Claim blocks may only be purchased, not sold.", null);
this.addDefault(defaults, Messages.BlockSaleValue, "Each claim block is worth {0}. You have {1} available for sale.", "0: block value; 1: available blocks");
this.addDefault(defaults, Messages.NotEnoughBlocksForSale, "You don't have that many claim blocks available for sale.", null);
this.addDefault(defaults, Messages.BlockSaleConfirmation, "Deposited {0} in your account. You now have {1} available claim blocks.", "0: amount deposited; 1: remaining blocks");
this.addDefault(defaults, Messages.AdminClaimsMode, "Administrative claims mode active. Any claims created will be free and editable by other administrators.", null);
this.addDefault(defaults, Messages.BasicClaimsMode, "Returned to basic claim creation mode.", null);
this.addDefault(defaults, Messages.SubdivisionMode, "Subdivision mode. Use your shovel to create subdivisions in your existing claims. Use /basicclaims to exit.", null);
Expand Down Expand Up @@ -1464,7 +1454,6 @@ protected void loadMessages()
this.addDefault(defaults, Messages.TrappedWontWorkHere, "Sorry, unable to find a safe location to teleport you to. Contact an admin.", null);
this.addDefault(defaults, Messages.CommandBannedInPvP, "You can't use that command while in PvP combat.", null);
this.addDefault(defaults, Messages.UnclaimCleanupWarning, "The land you've unclaimed may be changed by other players or cleaned up by administrators. If you've built something there you want to keep, you should reclaim it.", null);
this.addDefault(defaults, Messages.BuySellNotConfigured, "Sorry, buying and selling claim blocks is disabled.", null);
this.addDefault(defaults, Messages.NoTeleportPvPCombat, "You can't teleport while fighting another player.", null);
this.addDefault(defaults, Messages.NoTNTDamageAboveSeaLevel, "Warning: TNT will not destroy blocks above sea level.", null);
this.addDefault(defaults, Messages.NoTNTDamageClaims, "Warning: TNT will not destroy claimed blocks.", null);
Expand Down
139 changes: 0 additions & 139 deletions src/main/java/me/ryanhamshire/GriefPrevention/EconomyHandler.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.EntityInteractEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.event.entity.ExpBottleEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingBreakEvent;
Expand Down Expand Up @@ -110,6 +109,11 @@ else if (!GriefPrevention.instance.config_claims_ravagersBreakBlocks && event.ge
{
event.setCancelled(true);
}
//sand cannon fix - when the falling block doesn't fall straight down, take additional anti-grief steps
else if (event.getEntity() instanceof FallingBlock fallingBlock)
{
handleFallingBlockChangeBlock(event, fallingBlock);
}
// All other handling depends on claims being enabled.
else if (GriefPrevention.instance.config_claims_worldModes.get(event.getBlock().getWorld()) == ClaimsMode.Disabled)
{
Expand Down Expand Up @@ -168,12 +172,6 @@ else if (event.getEntity() instanceof Vehicle && !event.getEntity().getPassenger
}
}
}

//sand cannon fix - when the falling block doesn't fall straight down, take additional anti-grief steps
else if (event.getEntity() instanceof FallingBlock fallingBlock)
{
handleFallingBlockChangeBlock(event, fallingBlock);
}
}

private void handleFallingBlockChangeBlock(EntityChangeBlockEvent event, FallingBlock fallingBlock)
Expand All @@ -196,11 +194,12 @@ private void handleFallingBlockChangeBlock(EntityChangeBlockEvent event, Falling

List<MetadataValue> values = fallingBlock.getMetadata("GP_FALLINGBLOCK");
//if we're not sure where this entity came from (maybe another plugin didn't follow the standard?), allow the block to form
//Or if entity fell through an end portal, allow it to form, as the event is erroneously fired twice in this scenario.
if (values.isEmpty() || !(values.get(0).value() instanceof Location originalLocation)) return;

// If it fell straight down, allow.
if (originalLocation.getBlockX() == blockLocation.getBlockX() && originalLocation.getBlockZ() == blockLocation.getBlockZ())
if (Objects.equals(originalLocation.getWorld(), block.getWorld())
&& originalLocation.getBlockX() == blockLocation.getBlockX()
&& originalLocation.getBlockZ() == blockLocation.getBlockZ())
{
return;
}
Expand Down Expand Up @@ -337,16 +336,6 @@ static boolean isBlockSourceInClaim(@Nullable ProjectileSource projectileSource,
GriefPrevention.instance.dataStore.getClaimAt(blockProjectileSource.getBlock().getLocation(), false, claim) == claim;
}

//Used by "sand cannon" fix to ignore fallingblocks that fell through End Portals
//This is largely due to a CB issue with the above event
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onFallingBlockEnterPortal(EntityPortalEnterEvent event)
{
if (event.getEntityType() != EntityType.FALLING_BLOCK)
return;
event.getEntity().removeMetadata("GP_FALLINGBLOCK", instance);
}

//don't allow zombies to break down doors
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onZombieBreakDoor(EntityBreakDoorEvent event)
Expand Down
Loading

0 comments on commit 9c21348

Please sign in to comment.