Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.ulfric.plots.plot;
- import com.ulfric.lib.api.math.strategy.MathStrategy;
- public class AllowancePriority {
- public AllowancePriority(boolean overrideEqualTo)
- {
- this.strategy = overrideEqualTo ? MathStrategy.GREATER_THAN_OR_EQUAL : MathStrategy.GREATER_THAN;
- }
- private MathStrategy strategy;
- private boolean allowed;
- public boolean isAllowed()
- {
- return this.allowed;
- }
- public boolean isNotAllowed()
- {
- return !this.allowed;
- }
- private int lastAllowance;
- public void setAllowed(boolean allow, int priority)
- {
- if (!this.strategy.matches(this.lastAllowance, priority)) return;
- this.lastAllowance = priority;
- this.allowed = allow;
- }
- public void forceSetAllowed(boolean allow)
- {
- this.allowed = allow;
- }
- public void forceSetAllowed(boolean allow, int priority)
- {
- this.forceSetAllowed(allow);
- this.lastAllowance = priority;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement