From 4f7e25038c042a9ab016f4b4d33e2621579df8a1 Mon Sep 17 00:00:00 2001 From: CocoTheOwner Date: Thu, 12 Aug 2021 23:33:08 +0200 Subject: [PATCH] util function --- .../volmit/iris/util/decree/DecreeOrigin.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/volmit/iris/util/decree/DecreeOrigin.java b/src/main/java/com/volmit/iris/util/decree/DecreeOrigin.java index 531399d5b..eae213916 100644 --- a/src/main/java/com/volmit/iris/util/decree/DecreeOrigin.java +++ b/src/main/java/com/volmit/iris/util/decree/DecreeOrigin.java @@ -18,11 +18,26 @@ package com.volmit.iris.util.decree; +import com.volmit.iris.util.plugin.VolmitSender; + public enum DecreeOrigin { PLAYER, CONSOLE, /** * Both the player and the console */ - BOTH + BOTH; + + /** + * Check if the origin is valid for a sender + * @param sender The sender to check + * @return True if valid for origin + */ + public boolean validFor(VolmitSender sender){ + if (sender.isPlayer()){ + return this.equals(PLAYER) || this.equals(BOTH); + } else { + return this.equals(CONSOLE) || this.equals(BOTH); + } + } }