Skip to content

Commit f41e45a

Browse files
committed
Add isSafeZone method to ProtectionManager and possiblity to put flags in ProtectonFlags
1 parent 3debc5e commit f41e45a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/java/io/github/aquerr/eaglefactions/api/entities/ProtectionFlags.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33
import java.util.Set;
44

55
/**
6-
* Helper interface that represents an object that can provide protection flags and get their values.
6+
* Helper interface that represents an object that holds protection flags.
77
*/
88
public interface ProtectionFlags
99
{
10+
/**
11+
* Gets immutable Set containing protection flags.
12+
* @return
13+
*/
1014
Set<ProtectionFlag> getProtectionFlags();
1115

1216
/**
@@ -16,4 +20,10 @@ public interface ProtectionFlags
1620
* @return <tt>true</tt> if flag is set to true, <tt>false</tt> if flag is set to false OR it does not exist.
1721
*/
1822
boolean getValueForFlag(ProtectionFlagType type);
23+
24+
/**
25+
* Inserts or updates existing protection flag
26+
* @param protectionFlag the protection flag to insert
27+
*/
28+
void putFlag(ProtectionFlag protectionFlag);
1929
}

src/main/java/io/github/aquerr/eaglefactions/api/managers/ProtectionManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,11 @@ public interface ProtectionManager
112112
* @return <tt>true</tt> if user can use the item in the given location or <tt>false</tt> if not
113113
*/
114114
ProtectionResult canUseItem(final ServerLocation location, final User user, final ItemStackSnapshot usedItem, final boolean shouldNotify);
115+
116+
/**
117+
* Checks if the given server location is safe zone.
118+
* @param location the server location to check.
119+
* @return <tt>true</tt> if it is safe zone, <tt>false</tt> if not.
120+
*/
121+
boolean isSafeZone(ServerLocation location);
115122
}

0 commit comments

Comments
 (0)