PermissionWrapper WIP

This commit is contained in:
nossr50
2019-06-18 18:07:06 -07:00
parent 29670cd66f
commit c0685bd1eb
5 changed files with 74 additions and 75 deletions

View File

@ -0,0 +1,32 @@
package com.gmail.nossr50.datatypes.permissions;
import java.util.Objects;
public class PermissionWrapper {
private String permissionAddress;
public PermissionWrapper(String permissionAddress) {
this.permissionAddress = permissionAddress;
}
public String getPermissionAddress() {
return permissionAddress;
}
public void setPermissionAddress(String permissionAddress) {
this.permissionAddress = permissionAddress;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof PermissionWrapper)) return false;
PermissionWrapper that = (PermissionWrapper) o;
return getPermissionAddress().equals(that.getPermissionAddress());
}
@Override
public int hashCode() {
return Objects.hash(getPermissionAddress());
}
}

View File

@ -69,15 +69,15 @@ public class RepairManager extends SkillManager {
}
// Permissions checks on material and item types
if (!Permissions.repairMaterialType(player, repairable.getRepairItemMaterialCategory())) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return;
}
if (!Permissions.repairItemType(player, repairable.getRepairItemType())) {
mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return;
}
// if (!Permissions.repairMaterialType(player, repairable.getRepairItemMaterialCategory())) {
// mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
// return;
// }
//
// if (!Permissions.repairItemType(player, repairable.getRepairItemType())) {
// mcMMO.getNotificationManager().sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
// return;
// }
int skillLevel = getSkillLevel();
int minimumRepairableLevel = repairable.getMinimumLevel();

View File

@ -1,5 +1,6 @@
package com.gmail.nossr50.skills.repair.repairables;
import com.gmail.nossr50.datatypes.permissions.PermissionWrapper;
import com.gmail.nossr50.skills.repair.RepairTransaction;
import com.gmail.nossr50.util.nbt.RawNBT;
import org.bukkit.Material;
@ -13,6 +14,7 @@ public class Repairable {
private int baseXP;
private RawNBT rawNBT;
private int repairCount;
private PermissionWrapper permissionWrapper;
public Repairable(Material itemMaterial, RepairTransaction repairTransaction, int minimumLevel, int repairCount, int baseXP, RawNBT rawNBT) {
this(itemMaterial.getKey().getKey(), repairTransaction, minimumLevel, repairCount, baseXP, false, rawNBT);
@ -34,6 +36,14 @@ public class Repairable {
this.rawNBT = rawNBT;
}
public PermissionWrapper getPermissionWrapper() {
return permissionWrapper;
}
public void setPermissionWrapper(PermissionWrapper permissionWrapper) {
this.permissionWrapper = permissionWrapper;
}
public RawNBT getRawNBT() {
return rawNBT;
}