-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Ez4p1xEL/master
Add support for NoBuildPlus
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 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
Binary file not shown.
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
43 changes: 43 additions & 0 deletions
43
src/main/java/io/th0rgal/protectionlib/compatibilities/NoBuildPlusCompat.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,43 @@ | ||
package io.th0rgal.protectionlib.compatibilities; | ||
|
||
import io.th0rgal.protectionlib.ProtectionCompatibility; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.Plugin; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
import p1xel.nobuildplus.API.NBPAPI; | ||
import p1xel.nobuildplus.Flags; | ||
import p1xel.nobuildplus.NoBuildPlus; | ||
|
||
public class NoBuildPlusCompat extends ProtectionCompatibility { | ||
|
||
NoBuildPlus plugin = NoBuildPlus.getInstance(); | ||
|
||
NBPAPI api = plugin.getAPI(); | ||
|
||
public NoBuildPlusCompat(JavaPlugin mainPlugin, Plugin plugin) { | ||
super(mainPlugin, plugin); | ||
} | ||
|
||
@Override | ||
public boolean canBuild(Player player, Location target) { | ||
return !api.canExecute(target.getWorld().getName(), Flags.build); | ||
} | ||
|
||
@Override | ||
public boolean canBreak(Player player, Location target) { | ||
return !api.canExecute(target.getWorld().getName(), Flags.destroy); | ||
} | ||
|
||
@Override | ||
public boolean canInteract(Player player, Location target) { | ||
return !api.canExecute(target.getWorld().getName(), Flags.use); | ||
} | ||
|
||
@Override | ||
public boolean canUse(Player player, Location target) { | ||
return !api.canExecute(target.getWorld().getName(), Flags.use); | ||
} | ||
|
||
|
||
} |