mirror of
https://github.com/taoneill/war.git
synced 2024-11-27 04:35:35 +01:00
Removed Permissions from dependencies since everything works just fine with SuperPerms API. Restoring Spout player title color upon leaving warzone.
This commit is contained in:
parent
4d04f39e3b
commit
e53eb7965e
@ -8,7 +8,6 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/craftbukkit"/>
|
||||
<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 combineaccessrules="false" kind="src" path="/Permissions"/>
|
||||
<classpathentry kind="lib" path="C:/dev/war/war/lib/SpoutPluginAPI.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
10
war/pom.xml
10
war/pom.xml
@ -13,6 +13,10 @@
|
||||
<id>spout-repo</id>
|
||||
<url>http://nexus.getspout.org/content/groups/public/</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>sk89q-mvn2</id>
|
||||
<url>http://mvn2.sk89q.com/repo</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<build>
|
||||
<plugins>
|
||||
@ -68,12 +72,6 @@
|
||||
<version>1.8.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.nijikokun.bukkit</groupId>
|
||||
<artifactId>Permissions</artifactId>
|
||||
<version>2.7.4</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
|
@ -18,13 +18,10 @@ import org.bukkit.event.Event;
|
||||
import org.bukkit.event.Event.Priority;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import com.tommytony.war.FlagReturn;
|
||||
import com.tommytony.war.Team;
|
||||
import com.tommytony.war.TeamKind;
|
||||
@ -54,7 +51,6 @@ import com.tommytony.war.utils.PlayerState;
|
||||
* @package bukkit.tommytony.war
|
||||
*/
|
||||
public class War extends JavaPlugin {
|
||||
public static PermissionHandler permissionHandler;
|
||||
public static War war;
|
||||
private static boolean loadedOnce = false;
|
||||
|
||||
@ -121,9 +117,6 @@ public class War extends JavaPlugin {
|
||||
this.desc = this.getDescription();
|
||||
this.logger = this.getServer().getLogger();
|
||||
|
||||
// Permissions
|
||||
this.setupPermissions();
|
||||
|
||||
// Spout server detection
|
||||
try {
|
||||
Class.forName("org.getspout.spoutapi.player.SpoutPlayer");
|
||||
@ -293,20 +286,6 @@ public class War extends JavaPlugin {
|
||||
this.setLoaded(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes Permissions
|
||||
*/
|
||||
public void setupPermissions() {
|
||||
Plugin permissionsPlugin = this.getServer().getPluginManager().getPlugin("Permissions");
|
||||
if (War.permissionHandler == null) {
|
||||
if (permissionsPlugin != null) {
|
||||
War.permissionHandler = ((Permissions) permissionsPlugin).getHandler();
|
||||
} else {
|
||||
this.log("Permissions system not enabled. Defaulting to regular War config.", Level.INFO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see JavaPlugin.onCommand()
|
||||
*/
|
||||
@ -750,16 +729,7 @@ public class War extends JavaPlugin {
|
||||
* @return true if the player may play war
|
||||
*/
|
||||
public boolean canPlayWar(Player player) {
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.player")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// w/o Permissions, everyone can play
|
||||
return player.hasPermission("war.player");
|
||||
}
|
||||
return player.hasPermission("war.player");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -769,17 +739,7 @@ public class War extends JavaPlugin {
|
||||
* @return true if the player may warp
|
||||
*/
|
||||
public boolean canWarp(Player player) {
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.warp")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
} else {
|
||||
// w/o Permissions, everyone can warp
|
||||
return player.hasPermission("war.warp");
|
||||
}
|
||||
return player.hasPermission("war.warp");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -790,16 +750,7 @@ public class War extends JavaPlugin {
|
||||
*/
|
||||
public boolean canBuildOutsideZone(Player player) {
|
||||
if (this.getWarConfig().getBoolean(WarConfig.BUILDINZONESONLY)) {
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.build")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// w/o Permissions, if buildInZonesOnly, no one can build outside the zone except Zonemakers
|
||||
return player.hasPermission("war.build");
|
||||
}
|
||||
return player.hasPermission("war.build");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -813,16 +764,7 @@ public class War extends JavaPlugin {
|
||||
*/
|
||||
public boolean canPvpOutsideZones(Player player) {
|
||||
if (this.getWarConfig().getBoolean(WarConfig.PVPINZONESONLY)) {
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.pvp")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// w/o Permissions, if pvpInZoneOnly, no one can pvp outside the zone
|
||||
return player.hasPermission("war.pvp");
|
||||
}
|
||||
return player.hasPermission("war.pvp");
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
@ -848,17 +790,7 @@ public class War extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.zonemaker")) {
|
||||
// War admins are zonemakers
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// default to op, if no permissions are found
|
||||
return player.hasPermission("war.zonemaker");
|
||||
}
|
||||
return player.hasPermission("war.zonemaker");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -868,16 +800,7 @@ public class War extends JavaPlugin {
|
||||
* @return true if the player is a War admin
|
||||
*/
|
||||
public boolean isWarAdmin(Player player) {
|
||||
if (War.permissionHandler != null) {
|
||||
if (War.permissionHandler.has(player, "war.*") || War.permissionHandler.has(player, "war.admin")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// default to op, if no permissions are found
|
||||
return player.hasPermission("war.admin");
|
||||
}
|
||||
return player.hasPermission("war.admin");
|
||||
}
|
||||
|
||||
public void addWandBearer(Player player, String zoneName) {
|
||||
|
@ -427,9 +427,17 @@ public class Warzone {
|
||||
ItemStack[] contents = inventory.getContents();
|
||||
List<PotionEffect> potionEffects = PotionEffect.getCurrentPotionEffects(player);
|
||||
this.playerStates.put(player.getName(), new PlayerState(player.getGameMode(),
|
||||
contents, inventory.getHelmet(), inventory.getChestplate(), inventory.getLeggings(), inventory.getBoots(),
|
||||
player.getHealth(), player.getExhaustion(), player.getSaturation(),
|
||||
player.getFoodLevel(), potionEffects));
|
||||
contents,
|
||||
inventory.getHelmet(),
|
||||
inventory.getChestplate(),
|
||||
inventory.getLeggings(),
|
||||
inventory.getBoots(),
|
||||
player.getHealth(),
|
||||
player.getExhaustion(),
|
||||
player.getSaturation(),
|
||||
player.getFoodLevel(),
|
||||
potionEffects,
|
||||
SpoutManager.getPlayer(player).getTitle()));
|
||||
}
|
||||
|
||||
public void restorePlayerState(Player player) {
|
||||
@ -443,6 +451,7 @@ public class Warzone {
|
||||
player.setSaturation(originalContents.getSaturation());
|
||||
player.setFoodLevel(originalContents.getFoodLevel());
|
||||
PotionEffect.restorePotionEffects(player, originalContents.getPotionEffects());
|
||||
SpoutManager.getPlayer(player).setTitle(originalContents.getPlayerTitle());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,14 +19,16 @@ public class PlayerState {
|
||||
private final int health;
|
||||
private final GameMode gamemode;
|
||||
private final List<PotionEffect> potionEffects;
|
||||
private final String playerTitle;
|
||||
|
||||
public PlayerState(GameMode gamemode, ItemStack[] contents, ItemStack helmet, ItemStack chest, ItemStack legs, ItemStack feet, int health, float exhaustion, float saturation, int foodLevel, List<PotionEffect> potionEffects) {
|
||||
public PlayerState(GameMode gamemode, ItemStack[] contents, ItemStack helmet, ItemStack chest, ItemStack legs, ItemStack feet, int health, float exhaustion, float saturation, int foodLevel, List<PotionEffect> potionEffects, String playerTitle) {
|
||||
this.gamemode = gamemode;
|
||||
this.health = health;
|
||||
this.exhaustion = exhaustion;
|
||||
this.saturation = saturation;
|
||||
this.foodLevel = foodLevel;
|
||||
this.potionEffects = potionEffects;
|
||||
this.playerTitle = playerTitle;
|
||||
this.setContents(contents);
|
||||
this.setHelmet(helmet);
|
||||
this.setChest(chest);
|
||||
@ -98,4 +100,8 @@ public class PlayerState {
|
||||
return potionEffects;
|
||||
}
|
||||
|
||||
public String getPlayerTitle() {
|
||||
return playerTitle;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user