mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 12:46:11 +01:00
Merge branch 'perms' into perf
This commit is contained in:
commit
ab576e09da
@ -8,6 +8,6 @@
|
|||||||
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/mockito-all-1.8.5.jar"/>
|
<classpathentry kind="lib" path="C:/dev/war/war/lib/mockito-all-1.8.5.jar"/>
|
||||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/EssentialsGroupBridge.jar"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/Permissions"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
@ -45,5 +45,12 @@
|
|||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.nijikokun.bukkit</groupId>
|
||||||
|
<artifactId>Permissions</artifactId>
|
||||||
|
<version>2.7.4</version>
|
||||||
|
<type>jar</type>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
|||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.nijiko.permissions.PermissionHandler;
|
||||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||||
import com.tommytony.war.Monument;
|
import com.tommytony.war.Monument;
|
||||||
import com.tommytony.war.Team;
|
import com.tommytony.war.Team;
|
||||||
@ -46,7 +47,7 @@ import com.tommytony.war.utils.InventoryStash;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class War extends JavaPlugin {
|
public class War extends JavaPlugin {
|
||||||
public static Permissions Permissions = null;
|
public static PermissionHandler permissionHandler;
|
||||||
|
|
||||||
public War(){
|
public War(){
|
||||||
super();
|
super();
|
||||||
@ -1384,12 +1385,12 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlayWar(Player player) {
|
public boolean canPlayWar(Player player) {
|
||||||
if(Permissions != null
|
if(War.permissionHandler != null
|
||||||
&& (Permissions.Security.permission(player, "war.player")
|
&& (War.permissionHandler.has(player, "war.player")
|
||||||
|| Permissions.Security.permission(player, "War.player"))) {
|
|| War.permissionHandler.has(player, "War.player"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(Permissions == null) {
|
if(War.permissionHandler == null) {
|
||||||
// w/o Permissions, everyone can play
|
// w/o Permissions, everyone can play
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1397,12 +1398,12 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean canWarp(Player player) {
|
public boolean canWarp(Player player) {
|
||||||
if(Permissions != null
|
if(War.permissionHandler != null
|
||||||
&& (Permissions.Security.permission(player, "war.warp")
|
&& (War.permissionHandler.has(player, "war.warp")
|
||||||
|| Permissions.Security.permission(player, "War.warp"))) {
|
|| War.permissionHandler.has(player, "War.warp"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(Permissions == null) {
|
if(War.permissionHandler == null) {
|
||||||
// w/o Permissions, everyone can warp
|
// w/o Permissions, everyone can warp
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1411,9 +1412,9 @@ public class War extends JavaPlugin {
|
|||||||
|
|
||||||
public boolean canBuildOutsideZone(Player player) {
|
public boolean canBuildOutsideZone(Player player) {
|
||||||
if(isBuildInZonesOnly()) {
|
if(isBuildInZonesOnly()) {
|
||||||
if(Permissions != null
|
if(War.permissionHandler != null
|
||||||
&& (Permissions.Security.permission(player, "war.build")
|
&& (War.permissionHandler.has(player, "war.build")
|
||||||
|| Permissions.Security.permission(player, "War.build"))) {
|
|| War.permissionHandler.has(player, "War.build"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// w/o Permissions, if buildInZonesOnly, no one can build outside the zone
|
// w/o Permissions, if buildInZonesOnly, no one can build outside the zone
|
||||||
@ -1433,9 +1434,9 @@ public class War extends JavaPlugin {
|
|||||||
for(String zoneMaker : zoneMakerNames) {
|
for(String zoneMaker : zoneMakerNames) {
|
||||||
if(zoneMaker.equals(player.getName())) return true;
|
if(zoneMaker.equals(player.getName())) return true;
|
||||||
}
|
}
|
||||||
if(Permissions != null
|
if(War.permissionHandler != null
|
||||||
&& (Permissions.Security.permission(player, "war.*")
|
&& (War.permissionHandler.has(player, "war.*")
|
||||||
|| Permissions.Security.permission(player, "War.*"))) {
|
|| War.permissionHandler.has(player, "War.*"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1527,10 +1528,10 @@ public class War extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setupPermissions() {
|
public void setupPermissions() {
|
||||||
Plugin test = this.getServer().getPluginManager().getPlugin("Permissions");
|
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||||
if(Permissions == null) {
|
if(this.permissionHandler == null) {
|
||||||
if(test != null) {
|
if(permissionsPlugin != null) {
|
||||||
Permissions = (Permissions)test;
|
this.permissionHandler = ((Permissions) permissionsPlugin).getHandler();
|
||||||
} else {
|
} else {
|
||||||
logInfo("Permissions system not enabled. Defaulting to regular War config.");
|
logInfo("Permissions system not enabled. Defaulting to regular War config.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user