add passenger condition
This commit is contained in:
1 parent
e3d81e7c0c
commit
8cfd098be9
3 files changed
+67
-3
No files matched your search
@@ -2,21 +2,22 @@
|
||||
conditional-text:
|
||||
actionbar:
|
||||
priority_1:
|
||||
text: '%np_background_other_actionbar%'
|
||||
text: '%np_background_other_actionbar%' # hides the money hud when a player rides something or dives in water
|
||||
conditions:
|
||||
'||':
|
||||
is-passenger: true
|
||||
'!=':
|
||||
value1: '%player_remaining_air%'
|
||||
value2: "300"
|
||||
'!gamemode': survival
|
||||
priority_2:
|
||||
text: '%np_static_money_hud%%np_offset_-179%%np_static_other_actionbar%'
|
||||
text: '%np_static_money_hud%%np_offset_-179%%np_static_other_actionbar%' # displays the money hud + other plugin's actionbar message
|
||||
conditions:
|
||||
'!equals':
|
||||
value1: '%np_actionbar%'
|
||||
value2: ""
|
||||
priority_3:
|
||||
text: '%np_static_money_hud%'
|
||||
text: '%np_static_money_hud%' # displays the money hud only
|
||||
weather:
|
||||
priority_1:
|
||||
text: 'Sunny'
|
||||
|
||||
+8
@@ -52,6 +52,14 @@ public class BukkitRequirementManager extends AbstractRequirementManager {
|
||||
this.registerGameMode();
|
||||
this.registerBedrock();
|
||||
this.registerDisguise();
|
||||
this.registerPassenger();
|
||||
}
|
||||
|
||||
private void registerPassenger() {
|
||||
this.registerRequirement((args, interval) -> {
|
||||
boolean is = (boolean) args;
|
||||
return new PassengerRequirement(interval, is);
|
||||
}, "is-passenger");
|
||||
}
|
||||
|
||||
private void registerDisguise() {
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (C) <2024> <XiaoMoMi>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.momirealms.customnameplates.bukkit.requirement.builtin;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import net.momirealms.customnameplates.api.CNPlayer;
|
||||
import net.momirealms.customnameplates.backend.requirement.AbstractRequirement;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class PassengerRequirement extends AbstractRequirement {
|
||||
|
||||
private final boolean is;
|
||||
|
||||
public PassengerRequirement(int refreshInterval, boolean is) {
|
||||
super(refreshInterval);
|
||||
this.is = is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSatisfied(CNPlayer p1, CNPlayer p2) {
|
||||
return ((Player) p1.player()).isInsideVehicle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String type() {
|
||||
return "is-passenger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PassengerRequirement that)) return false;
|
||||
return is == that.is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(is);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user