mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-28 03:17:53 +01:00
Holzhammer.
This commit is contained in:
parent
c79920c3b2
commit
c82e92863d
@ -69,7 +69,7 @@ public class MorePackets extends Check {
|
|||||||
|
|
||||||
if (data.morePacketsSetback == null){
|
if (data.morePacketsSetback == null){
|
||||||
// TODO: Check if other set-back is appropriate or if to set on other events.
|
// TODO: Check if other set-back is appropriate or if to set on other events.
|
||||||
if (data.setBack != null) data.morePacketsSetback = data.setBack.clone();
|
if (data.setBack != null) data.morePacketsSetback = data.getSetBack(to);
|
||||||
else data.morePacketsSetback = from.getLocation();
|
else data.morePacketsSetback = from.getLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,9 @@ public class MovingData extends ACheckData {
|
|||||||
* @param loc
|
* @param loc
|
||||||
*/
|
*/
|
||||||
public void setSetBack(final PlayerLocation loc){
|
public void setSetBack(final PlayerLocation loc){
|
||||||
if (setBack == null) setBack = loc.getLocation();
|
if (setBack == null){
|
||||||
|
setBack = loc.getLocation();
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
setBack.setWorld(loc.getWorld());
|
setBack.setWorld(loc.getWorld());
|
||||||
setBack.setX(loc.getX());
|
setBack.setX(loc.getX());
|
||||||
@ -253,7 +255,9 @@ public class MovingData extends ACheckData {
|
|||||||
* @param loc
|
* @param loc
|
||||||
*/
|
*/
|
||||||
public void setSetBack(final Location loc){
|
public void setSetBack(final Location loc){
|
||||||
if (setBack == null) setBack = loc.clone();
|
if (setBack == null){
|
||||||
|
setBack = new Location(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
setBack.setWorld(loc.getWorld());
|
setBack.setWorld(loc.getWorld());
|
||||||
setBack.setX(loc.getX());
|
setBack.setX(loc.getX());
|
||||||
@ -270,12 +274,11 @@ public class MovingData extends ACheckData {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Location getSetBack(final Location ref){
|
public Location getSetBack(final Location ref){
|
||||||
if (setBack == null) return ref.clone();
|
if (setBack == null){
|
||||||
|
return new Location(ref.getWorld(), ref.getX(), ref.getY(), ref.getZ(), ref.getYaw(), ref.getPitch());
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
final Location loc = setBack.clone();
|
return new Location(setBack.getWorld(), setBack.getX(), setBack.getY(), setBack.getZ(), ref.getYaw(), ref.getPitch());
|
||||||
loc.setYaw(ref.getYaw());
|
|
||||||
loc.setPitch(ref.getPitch());
|
|
||||||
return loc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,10 +290,7 @@ public class MovingData extends ACheckData {
|
|||||||
public Location getSetBack(final PlayerLocation ref) {
|
public Location getSetBack(final PlayerLocation ref) {
|
||||||
if (setBack == null) return ref.getLocation();
|
if (setBack == null) return ref.getLocation();
|
||||||
else{
|
else{
|
||||||
final Location loc = setBack.clone();
|
return new Location(setBack.getWorld(), setBack.getX(), setBack.getY(), setBack.getZ(), ref.getYaw(), ref.getPitch());
|
||||||
loc.setYaw(ref.getYaw());
|
|
||||||
loc.setPitch(ref.getPitch());
|
|
||||||
return loc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ public class MovingListener extends CheckListener{
|
|||||||
noFall.checkDamage(player, data, y);
|
noFall.checkDamage(player, data, y);
|
||||||
}
|
}
|
||||||
// Teleport.
|
// Teleport.
|
||||||
data.teleported = target.clone();
|
data.teleported = new Location(target.getWorld(), target.getX(), target.getY(), target.getZ(), target.getYaw(), target.getPitch());
|
||||||
player.teleport(target, TeleportCause.PLUGIN);// TODO: schedule / other measures ?
|
player.teleport(target, TeleportCause.PLUGIN);// TODO: schedule / other measures ?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -561,7 +561,7 @@ public class MovingListener extends CheckListener{
|
|||||||
// Fix a common mistake that other developers make (cancelling move events is crazy, rather set the target
|
// Fix a common mistake that other developers make (cancelling move events is crazy, rather set the target
|
||||||
// location to the from location).
|
// location to the from location).
|
||||||
event.setCancelled(false);
|
event.setCancelled(false);
|
||||||
event.setTo(event.getFrom().clone());
|
event.setTo(event.getFrom()); // TODO: revise this (old!) strategy, cancelled events just teleport to from, basically.
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -570,6 +570,7 @@ public class MovingListener extends CheckListener{
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = false)
|
@EventHandler(priority=EventPriority.MONITOR, ignoreCancelled = false)
|
||||||
public final void onPlayerMoveMonitor(final PlayerMoveEvent event){
|
public final void onPlayerMoveMonitor(final PlayerMoveEvent event){
|
||||||
|
// TODO: revise: cancelled events.
|
||||||
final long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
if (player.isDead()) return;
|
if (player.isDead()) return;
|
||||||
|
@ -61,7 +61,7 @@ public class Passable extends Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prefer the set-back location from the data.
|
// Prefer the set-back location from the data.
|
||||||
if (data.setBack != null && BlockProperties.isPassable(from.getBlockCache(), data.setBack)) loc = data.setBack.clone();
|
if (data.setBack != null && BlockProperties.isPassable(from.getBlockCache(), data.setBack)) loc = data.getSetBack(to);
|
||||||
|
|
||||||
// TODO: set data.set-back ? or something: still some aji here.
|
// TODO: set data.set-back ? or something: still some aji here.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user