|
11 | 11 | import com.feed_the_beast.ftbutilities.data.ClaimedChunks; |
12 | 12 | import org.jetbrains.annotations.NotNull; |
13 | 13 |
|
| 14 | +import java.util.UUID; |
| 15 | + |
14 | 16 | public class FTBChunksUtil { |
15 | 17 |
|
| 18 | + /** |
| 19 | + * Check if a {@link BlockPos} is modifiable by a player abiding by FTB chunk rules, if this block is in a claimed |
| 20 | + * chunk. <br/> |
| 21 | + * Will always return {@code true} if |
| 22 | + * <a href="https://www.curseforge.com/minecraft/mc-mods/ftb-utilities-forge">FTBUtilities</a> isn't present or the |
| 23 | + * {@link BlockPos} isn't in a claimed chunk. |
| 24 | + */ |
16 | 25 | public static boolean isBlockModifiableByPlayer(@NotNull World world, @NotNull BlockPos blockPos, |
17 | 26 | @NotNull EntityPlayer player) { |
| 27 | + return isBlockModifiableByPlayer(world, blockPos, player.getUniqueID()); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * Check if a {@link BlockPos} is modifiable by a player abiding by FTB chunk rules, if this block is in a claimed |
| 32 | + * chunk. <br/> |
| 33 | + * Will always return {@code true} if |
| 34 | + * <a href="https://www.curseforge.com/minecraft/mc-mods/ftb-utilities-forge">FTBUtilities</a> isn't present or the |
| 35 | + * {@link BlockPos} isn't in a claimed chunk. |
| 36 | + */ |
| 37 | + public static boolean isBlockModifiableByPlayer(@NotNull World world, @NotNull BlockPos blockPos, |
| 38 | + @NotNull UUID playerID) { |
18 | 39 | if (!Mods.FTB_UTILITIES.isModLoaded()) return true; |
19 | 40 |
|
20 | 41 | ClaimedChunks instance = ClaimedChunks.instance; |
21 | 42 | ClaimedChunk claimedChunk = instance.getChunk(new ChunkDimPos(blockPos, world.provider.getDimension())); |
22 | 43 | if (claimedChunk != null) { |
23 | | - ForgePlayer forgePlayer = instance.universe.getPlayer(player.getUniqueID()); |
| 44 | + ForgePlayer forgePlayer = instance.universe.getPlayer(playerID); |
24 | 45 | EnumTeamStatus status = claimedChunk.getData().getEditBlocksStatus(); |
25 | 46 | return !claimedChunk.getTeam().hasStatus(forgePlayer, status); |
26 | 47 | } |
|
0 commit comments