mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-25 09:59:20 +00:00
3.6.28
This commit is contained in:
@@ -54,6 +54,7 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
||||
this.registerPotionEffectRequirement();
|
||||
this.registerSneakRequirement();
|
||||
this.registerGameModeRequirement();
|
||||
this.registerHandRequirement();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -345,4 +346,21 @@ public class PlayerRequirementManager extends AbstractRequirementManager<Player>
|
||||
};
|
||||
}, "gamemode");
|
||||
}
|
||||
|
||||
private void registerHandRequirement() {
|
||||
registerRequirement((args, actions, advanced) -> {
|
||||
String hand = ((String) args).toLowerCase(Locale.ENGLISH);
|
||||
return context -> {
|
||||
if (context.holder() == null) return true;
|
||||
EquipmentSlot slot = context.arg(ContextKeys.SLOT);
|
||||
if (slot != null) {
|
||||
if (slot.name().toLowerCase(Locale.ENGLISH).equals(hand)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (advanced) ActionManager.trigger(context, actions);
|
||||
return false;
|
||||
};
|
||||
}, "hand");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user