|
8 | 8 | import me.xginko.aef.modules.AEFModule; |
9 | 9 | import me.xginko.aef.utils.LocationUtil; |
10 | 10 | import me.xginko.aef.utils.WorldUtil; |
| 11 | +import me.xginko.aef.utils.permissions.AEFPermission; |
11 | 12 | import org.bukkit.Chunk; |
12 | 13 | import org.bukkit.Location; |
13 | 14 | import org.bukkit.Material; |
@@ -35,7 +36,9 @@ public class BlockLimit extends AEFModule implements Listener { |
35 | 36 | private Cache<Chunk, Cache<Material, Integer>> chunkMaterialCountCache; |
36 | 37 |
|
37 | 38 | public BlockLimit() { |
38 | | - super("chunk-limits.block-limit", false); |
| 39 | + super("chunk-limits.block-limit", false, |
| 40 | + "Configure per-chunk block limits." + |
| 41 | + "\nBypass permission: " + AEFPermission.BYPASS_CHUNK_LIMITS_BLOCK_LIMIT.node()); |
39 | 42 | this.notifyPlayer = config.getBoolean(configPath + ".notify-player", true, |
40 | 43 | "Send a message to the player when they cant place a block due to chunk limit."); |
41 | 44 | this.materialCountCacheMillis = config.getLong(configPath + ".material-count-cache-millis", 1000, |
@@ -187,6 +190,14 @@ private void onBlockPlace(BlockPlaceEvent event) { |
187 | 190 | return; |
188 | 191 | } |
189 | 192 |
|
| 193 | + if (AnarchyExploitFixes.permissions().permissionValue(event.getPlayer(), AEFPermission.BYPASS_CHUNK_LIMITS_BLOCK_LIMIT.node()).toBoolean()) { |
| 194 | + logger.debug("Ignoring {} for player '{}' because they have bypass permission: {}", |
| 195 | + event.getEventName(), |
| 196 | + event.getPlayer().getName(), |
| 197 | + AEFPermission.BYPASS_CHUNK_LIMITS_BLOCK_LIMIT.node()); |
| 198 | + return; |
| 199 | + } |
| 200 | + |
190 | 201 | int materialCount = getMaterialCountForChunk(event.getBlock().getType(), event.getBlock().getChunk()); |
191 | 202 | int limit = blockLimits.get(event.getBlock().getType()); |
192 | 203 |
|
@@ -224,6 +235,14 @@ private void onPlayerInteract(PlayerInteractEvent event) { |
224 | 235 | return; |
225 | 236 | } |
226 | 237 |
|
| 238 | + if (AnarchyExploitFixes.permissions().permissionValue(event.getPlayer(), AEFPermission.BYPASS_CHUNK_LIMITS_BLOCK_LIMIT.node()).toBoolean()) { |
| 239 | + logger.debug("Ignoring {} for player '{}' because they have bypass permission: {}", |
| 240 | + event.getEventName(), |
| 241 | + event.getPlayer().getName(), |
| 242 | + AEFPermission.BYPASS_CHUNK_LIMITS_BLOCK_LIMIT.node()); |
| 243 | + return; |
| 244 | + } |
| 245 | + |
227 | 246 | Location placeLocation = event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(); |
228 | 247 | int materialCount = getMaterialCountForChunk(event.getMaterial(), placeLocation.getChunk()); |
229 | 248 | int limit = blockLimits.get(event.getMaterial()); |
|
0 commit comments