-
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.
* support Residence * fix README * delete gradle proxy * delete gradle proxy and cancel formatting * chore: bump version --------- Co-authored-by: Boy <[email protected]>
- Loading branch information
1 parent
970204a
commit 95eb066
Showing
5 changed files
with
74 additions
and
3 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
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 |
---|---|---|
@@ -1 +1 @@ | ||
pluginVersion=1.6.0 | ||
pluginVersion=1.6.1 |
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
65 changes: 65 additions & 0 deletions
65
src/main/java/io/th0rgal/protectionlib/compatibilities/ResidenceCompat.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,65 @@ | ||
package io.th0rgal.protectionlib.compatibilities; | ||
|
||
import com.bekvon.bukkit.residence.Residence; | ||
import com.bekvon.bukkit.residence.containers.Flags; | ||
import com.bekvon.bukkit.residence.protection.ClaimedResidence; | ||
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; | ||
|
||
public class ResidenceCompat extends ProtectionCompatibility { | ||
|
||
Residence plugin = Residence.getInstance(); | ||
|
||
public ResidenceCompat(JavaPlugin mainPlugin, Plugin plugin) { | ||
super(mainPlugin, plugin); | ||
} | ||
|
||
private boolean canDo(Player player, Location target, Flags flag) { | ||
ClaimedResidence res = plugin.getResidenceManager().getByLoc(target); | ||
return res == null || res.getPermissions().playerHas(player, flag, false); | ||
} | ||
|
||
/** | ||
* @param player Player looking to place a block | ||
* @param target Place where the player seeks to place a block | ||
* @return true if he can put the block | ||
*/ | ||
@Override | ||
public boolean canBuild(Player player, Location target) { | ||
return canDo(player, target, Flags.build); | ||
} | ||
|
||
/** | ||
* @param player Player looking to break a block | ||
* @param target Place where the player seeks to break a block | ||
* @return true if he can break the block | ||
*/ | ||
@Override | ||
public boolean canBreak(Player player, Location target) { | ||
return canDo(player, target, Flags.destroy); | ||
} | ||
|
||
/** | ||
* @param player Player looking to interact with a block | ||
* @param target Place where the player seeks to interact with a block | ||
* @return true if he can interact with the block | ||
*/ | ||
@Override | ||
public boolean canInteract(Player player, Location target) { | ||
// No single interact flag, so just check if player is on their own island | ||
return canDo(player, target, Flags.use); | ||
} | ||
|
||
/** | ||
* @param player Player looking to use an item | ||
* @param target Place where the player seeks to use an item at a location | ||
* @return true if he can use the item at the location | ||
*/ | ||
public boolean canUse(Player player, Location target) { | ||
// No single use flag, so just check if player is on their own island | ||
return canDo(player, target, Flags.use); | ||
} | ||
} |