Skip to content

Commit

Permalink
Merge branch 'GriefPrevention:master' into update
Browse files Browse the repository at this point in the history
  • Loading branch information
SrBedrock authored Apr 16, 2024
2 parents 0167ac5 + bf64601 commit 4d2c589
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 40 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public static synchronized void AddLogEntry(String entry, CustomLogEntryTypes cu
{
GriefPrevention.instance.customLogger.AddEntry(entry, customLogType);
}
if (!excludeFromServerLogs) log.info(entry);
if (!excludeFromServerLogs) Bukkit.getConsoleSender().sendMessage(entry);
}

public static synchronized void AddLogEntry(String entry, CustomLogEntryTypes customLogType)
Expand Down Expand Up @@ -2908,7 +2908,7 @@ public static void sendMessage(@Nullable Player player, @NotNull ChatColor color

if (player == null)
{
Bukkit.getConsoleSender().sendMessage(message);
Bukkit.getConsoleSender().sendMessage(color + message);
GriefPrevention.AddLogEntry(message, CustomLogEntryTypes.Debug, true);
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1545,37 +1545,9 @@ void onPlayerInteract(PlayerInteractEvent event)
}

//don't care about left-clicking on most blocks, this is probably a break action
if (action == Action.LEFT_CLICK_BLOCK && clickedBlock != null)
if (action == Action.LEFT_CLICK_BLOCK && clickedBlock != null && !this.onLeftClickWatchList(clickedBlockType))
{
if (clickedBlock.getY() < clickedBlock.getWorld().getMaxHeight() - 1 || event.getBlockFace() != BlockFace.UP)
{
Block adjacentBlock = clickedBlock.getRelative(event.getBlockFace());
byte lightLevel = adjacentBlock.getLightFromBlocks();
if (lightLevel == 15 && adjacentBlock.getType() == Material.FIRE)
{
if (playerData == null) playerData = this.dataStore.getPlayerData(player.getUniqueId());
Claim claim = this.dataStore.getClaimAt(clickedBlock.getLocation(), false, playerData.lastClaim);
if (claim != null)
{
playerData.lastClaim = claim;

Supplier<String> noBuildReason = claim.checkPermission(player, ClaimPermission.Build, event);
if (noBuildReason != null)
{
event.setCancelled(true);
GriefPrevention.sendMessage(player, TextMode.Err, noBuildReason.get());
player.sendBlockChange(adjacentBlock.getLocation(), adjacentBlock.getType(), adjacentBlock.getData());
return;
}
}
}
}

//exception for blocks on a specific watch list
if (!this.onLeftClickWatchList(clickedBlockType))
{
return;
}
return;
}

//apply rules for containers and crafting blocks
Expand Down Expand Up @@ -2441,15 +2413,9 @@ private boolean isInventoryHolder(Block clickedBlock)

private boolean onLeftClickWatchList(Material material)
{
if (Tag.BUTTONS.isTagged(material)) return true;
switch (material)
{
case OAK_BUTTON:
case SPRUCE_BUTTON:
case BIRCH_BUTTON:
case JUNGLE_BUTTON:
case ACACIA_BUTTON:
case DARK_OAK_BUTTON:
case STONE_BUTTON:
case LEVER:
case REPEATER:
case CAKE:
Expand Down

0 comments on commit 4d2c589

Please sign in to comment.