Check only enabled Permissions for Range

This commit is contained in:
Sn0wStorm
2021-06-14 22:52:52 +02:00
parent b43c647c5f
commit e67ae3a770
4 changed files with 3 additions and 7 deletions
+1 -2
View File
@@ -182,13 +182,12 @@ public class BCauldron {
return false; return false;
} }
// If the Water_Cauldron type exists and the cauldron is on last level
if (LegacyUtil.WATER_CAULDRON != null && cauldron.getLevel() == 1) { if (LegacyUtil.WATER_CAULDRON != null && cauldron.getLevel() == 1) {
// Empty Cauldron // Empty Cauldron
P.p.log("Empty Cauldron");
block.setType(Material.CAULDRON); block.setType(Material.CAULDRON);
bcauldrons.remove(block); bcauldrons.remove(block);
} else { } else {
P.p.log("Setting level to : " + (cauldron.getLevel() - 1));
cauldron.setLevel(cauldron.getLevel() - 1); cauldron.setLevel(cauldron.getLevel() - 1);
// Update the new Level to the Block // Update the new Level to the Block
+1
View File
@@ -220,6 +220,7 @@ public class BDistiller {
if (P.use1_11) { if (P.use1_11) {
// The trick below doesnt work in 1.11, but we dont need it anymore // The trick below doesnt work in 1.11, but we dont need it anymore
// This should only happen with older Brews that have been made with the old Potion Color System // This should only happen with older Brews that have been made with the old Potion Color System
// This causes standard potions to not brew in the brewing stand if put together with Brews, but the bubble animation will play
stand.setBrewingTime(Short.MAX_VALUE); stand.setBrewingTime(Short.MAX_VALUE);
} else { } else {
// Brewing time is sent and stored as short // Brewing time is sent and stored as short
@@ -29,9 +29,6 @@ public class CauldronListener implements Listener {
BlockState newState = event.getNewState(); BlockState newState = event.getNewState();
Material newType = newState.getType(); Material newType = newState.getType();
P.p.log("OldType: " + currentType + " NewType: " + newType);
if (currentType == Material.WATER_CAULDRON) { if (currentType == Material.WATER_CAULDRON) {
if (newType != Material.WATER_CAULDRON) { if (newType != Material.WATER_CAULDRON) {
// Change from water to anything else // Change from water to anything else
@@ -43,8 +40,6 @@ public class CauldronListener implements Listener {
Levelled oldCauldron = ((Levelled) event.getBlock().getBlockData()); Levelled oldCauldron = ((Levelled) event.getBlock().getBlockData());
Levelled newCauldron = ((Levelled) newState.getBlockData()); Levelled newCauldron = ((Levelled) newState.getBlockData());
P.p.log("OldLevel: " + oldCauldron.getLevel() + " Newlevel: " + newCauldron.getLevel());
// Water Level increased somehow, might be Bucket, Bottle, Rain, etc. // Water Level increased somehow, might be Bucket, Bottle, Rain, etc.
if (newCauldron.getLevel() > oldCauldron.getLevel()) { if (newCauldron.getLevel() > oldCauldron.getLevel()) {
BCauldron.remove(event.getBlock()); BCauldron.remove(event.getBlock());
@@ -118,6 +118,7 @@ public class PermissionUtil {
*/ */
public static int getRangedPermission(Permissible player, String subPermission) { public static int getRangedPermission(Permissible player, String subPermission) {
Optional<PermissionAttachmentInfo> found = player.getEffectivePermissions().stream(). Optional<PermissionAttachmentInfo> found = player.getEffectivePermissions().stream().
filter(PermissionAttachmentInfo::getValue). // Only active permissions
filter(x -> x.getPermission().startsWith(subPermission)). filter(x -> x.getPermission().startsWith(subPermission)).
findFirst(); findFirst();