Update Util.java added Ultra mode

I'm not sure, if it works please leave a comment, if you tested the new version and it worked (Ultra-Mode)
This commit is contained in:
Benkralex
2023-08-17 17:37:36 +02:00
committed by GitHub
parent bac258fcda
commit fab56224ec
@@ -9,10 +9,18 @@ import java.time.Instant;
public class Util {
public static boolean canPvP(Player damager, Player victim){
PersistentDataContainer victimPDC=damager.getPersistentDataContainer();
Boolean toggle = victimPDC.get(new NamespacedKey(Pvptoggle.pvptoggle, "pvptoggle"),PersistentDataType.BOOLEAN);
PersistentDataContainer damagerPDC=damager.getPersistentDataContainer();
PersistentDataContainer victimPDC=victim.getPersistentDataContainer();
Boolean toggle = damagerPDC.get(new NamespacedKey(Pvptoggle.pvptoggle, "pvptoggle"),PersistentDataType.BOOLEAN);
if (victimPDC.has(new NamespacedKey(Pvptoggle.pvptoggle, "ultra"),PersistentDataType.BOOLEAN)) {
Boolean ultravictim = victimPDC.get(new NamespacedKey(Pvptoggle.pvptoggle, "ultra"),PersistentDataType.BOOLEAN);
} else {Boolean ultravictim = false;}
if (damagerPDC.has(new NamespacedKey(Pvptoggle.pvptoggle, "ultra"),PersistentDataType.BOOLEAN)) {
Boolean ultradamager = damagerPDC.get(new NamespacedKey(Pvptoggle.pvptoggle, "ultra"),PersistentDataType.BOOLEAN);
} else {Boolean ultradamager = false;}
if(toggle!=null) {
return !toggle || checkPvPData(damager, victim);
return !toggle || checkPvPData(damager, victim) || !ultradamager || !ultravictim;
} else {
return true;
}