mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
PermissionsHandler was a stupid idea.
This commit is contained in:
parent
c71f4e438b
commit
9f65e5a9ab
@ -5,19 +5,19 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
|
||||
import com.gmail.nossr50.datatypes.PlayerProfile;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class AcrobaticsManager {
|
||||
private Player player;
|
||||
private PlayerProfile profile;
|
||||
private int skillLevel;
|
||||
private AcrobaticsPermissionsHandler permHandler;
|
||||
private Permissions permissionInstance = Permissions.getInstance();
|
||||
|
||||
public AcrobaticsManager (Player player) {
|
||||
this.player = player;
|
||||
this.profile = Users.getProfile(player);
|
||||
this.skillLevel = profile.getSkillLevel(SkillType.ACROBATICS);
|
||||
this.permHandler = new AcrobaticsPermissionsHandler(player);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -26,7 +26,7 @@ public class AcrobaticsManager {
|
||||
* @param event The event to check
|
||||
*/
|
||||
public void rollCheck(EntityDamageEvent event) {
|
||||
if (!permHandler.hasRollPermissions()) {
|
||||
if (!permissionInstance.roll(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ public class AcrobaticsManager {
|
||||
* @param event The event to check
|
||||
*/
|
||||
public void dodgeCheck(EntityDamageEvent event) {
|
||||
if (!permHandler.canDodge()) {
|
||||
if (!permissionInstance.dodge(player)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,8 +72,4 @@ public class AcrobaticsManager {
|
||||
protected int getSkillLevel() {
|
||||
return skillLevel;
|
||||
}
|
||||
|
||||
protected AcrobaticsPermissionsHandler getPermissionsHandler() {
|
||||
return permHandler;
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
package com.gmail.nossr50.skills.acrobatics;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
|
||||
public class AcrobaticsPermissionsHandler {
|
||||
private Permissions permInstance = Permissions.getInstance();
|
||||
|
||||
private boolean canDodge;
|
||||
private boolean canGracefulRoll;
|
||||
private boolean canRoll;
|
||||
|
||||
protected AcrobaticsPermissionsHandler (Player player) {
|
||||
this.canDodge = permInstance.dodge(player);
|
||||
this.canGracefulRoll = permInstance.gracefulRoll(player);
|
||||
this.canRoll = permInstance.roll(player);
|
||||
}
|
||||
|
||||
protected boolean canDodge() {
|
||||
return canDodge;
|
||||
}
|
||||
|
||||
protected boolean canGracefulRoll() {
|
||||
return canGracefulRoll;
|
||||
}
|
||||
|
||||
protected boolean canRoll() {
|
||||
return canRoll;
|
||||
}
|
||||
|
||||
protected boolean hasRollPermissions() {
|
||||
return (canRoll || canGracefulRoll);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.util.Permissions;
|
||||
import com.gmail.nossr50.util.Skills;
|
||||
|
||||
public class RollEventHandler extends AcrobaticsEventHandler {
|
||||
@ -68,7 +69,7 @@ public class RollEventHandler extends AcrobaticsEventHandler {
|
||||
* Check if this is a graceful roll.
|
||||
*/
|
||||
private void isGracefulRoll() {
|
||||
if (manager.getPermissionsHandler().canGracefulRoll()) {
|
||||
if (Permissions.getInstance().gracefulRoll(player)) {
|
||||
this.isGraceful = player.isSneaking();
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user