-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
412 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/main/java/com/moulberry/axiom/integration/BoxWithBoolean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.moulberry.axiom.integration; | ||
|
||
public record BoxWithBoolean(Box box, boolean value) { | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/moulberry/axiom/integration/Integration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.moulberry.axiom.integration; | ||
|
||
import com.moulberry.axiom.integration.plotsquared.PlotSquaredIntegration; | ||
import com.moulberry.axiom.integration.worldguard.WorldGuardIntegration; | ||
import org.bukkit.World; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.entity.Player; | ||
|
||
public class Integration { | ||
|
||
// todo: test if all this is working for both plotsqured, worldguard, plotsquared+worldguard | ||
|
||
public static boolean canBreakBlock(Player player, Block block) { | ||
return PlotSquaredIntegration.canBreakBlock(player, block) && WorldGuardIntegration.canBreakBlock(player, block.getLocation()); | ||
} | ||
|
||
public static boolean canPlaceBlock(Player player, org.bukkit.Location loc) { | ||
return PlotSquaredIntegration.canPlaceBlock(player, loc) && WorldGuardIntegration.canPlaceBlock(player, loc); | ||
} | ||
|
||
public static SectionPermissionChecker checkSection(Player player, World world, int cx, int cy, int cz) { | ||
SectionPermissionChecker plotSquared = PlotSquaredIntegration.checkSection(player, world, cz, cy, cz); | ||
SectionPermissionChecker worldGuard = WorldGuardIntegration.checkSection(player, world, cz, cy, cz); | ||
|
||
return SectionPermissionChecker.combine(plotSquared, worldGuard); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/com/moulberry/axiom/integration/worldguard/WorldGuardIntegration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.moulberry.axiom.integration.worldguard; | ||
|
||
import com.moulberry.axiom.integration.SectionPermissionChecker; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.World; | ||
import org.bukkit.entity.Player; | ||
|
||
public class WorldGuardIntegration { | ||
|
||
public static boolean canBreakBlock(Player player, org.bukkit.Location loc) { | ||
if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) { | ||
return true; | ||
} | ||
return WorldGuardIntegrationImpl.canBreakBlock(player, loc); | ||
} | ||
|
||
public static boolean canPlaceBlock(Player player, org.bukkit.Location loc) { | ||
if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) { | ||
return true; | ||
} | ||
return WorldGuardIntegrationImpl.canPlaceBlock(player, loc); | ||
} | ||
|
||
public static SectionPermissionChecker checkSection(Player player, World world, int cx, int cy, int cz) { | ||
if (!Bukkit.getPluginManager().isPluginEnabled("WorldGuard")) { | ||
return SectionPermissionChecker.ALL_ALLOWED; | ||
} | ||
return WorldGuardIntegrationImpl.checkSection(player, world, cx, cy, cz); | ||
} | ||
|
||
} |
Oops, something went wrong.