mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-07 11:10:05 +01:00
Log in survivalfly, if the player is wearing elytra, but no end rod.
This commit is contained in:
parent
ff12a15c97
commit
56f217c9f2
@ -22,6 +22,7 @@ import fr.neatmonster.nocheatplus.checks.moving.magic.MagicLiquid;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.LiftOffEnvelope;
|
||||
import fr.neatmonster.nocheatplus.checks.moving.model.MoveData;
|
||||
import fr.neatmonster.nocheatplus.checks.workaround.WRPT;
|
||||
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
|
||||
import fr.neatmonster.nocheatplus.compat.BridgeEnchant;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockChangeTracker;
|
||||
import fr.neatmonster.nocheatplus.compat.blocks.BlockChangeTracker.Direction;
|
||||
@ -2205,6 +2206,9 @@ public class SurvivalFly extends Check {
|
||||
// Exception: does not take into account latency.
|
||||
tags.add("lowfoodsprint");
|
||||
}
|
||||
if (Bridge1_9.isWearingElytra(player)) {
|
||||
tags.add("elytra_off");
|
||||
}
|
||||
if (!tags.isEmpty()) {
|
||||
builder.append("\n" + " tags: " + StringUtil.join(tags, "+"));
|
||||
}
|
||||
|
@ -58,20 +58,20 @@ public class Bridge1_9 {
|
||||
* @return
|
||||
*/
|
||||
public static boolean isReadyForElytra(final Player player) {
|
||||
// TODO: Off-hand testing needs to be supported, pass an instance for access.
|
||||
// TODO: Generic jet-pack / potion support (triggers + model configs).
|
||||
if (END_ROD == null || ELYTRA == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack stack = player.getInventory().getChestplate();
|
||||
if (stack == null || stack.getType() != ELYTRA) {
|
||||
return false;
|
||||
}
|
||||
if (!hasItemInAnyHand(player, END_ROD)) {
|
||||
return false;
|
||||
}
|
||||
// Possible to use elytra.
|
||||
return true;
|
||||
return END_ROD != null && ELYTRA != null && isWearingElytra(player) && hasItemInAnyHand(player, END_ROD);
|
||||
}
|
||||
|
||||
/**
|
||||
* Just test if the player has elytra equipped in the chest plate slot. The
|
||||
* player may or may not be holding an end rod in either hand.
|
||||
*
|
||||
* @param player
|
||||
* @return
|
||||
*/
|
||||
public static boolean isWearingElytra(final Player player) {
|
||||
final ItemStack stack = player.getInventory().getChestplate();
|
||||
return stack != null && stack.getType() == ELYTRA;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user