mirror of
https://github.com/MassiveCraft/Factions.git
synced 2024-11-27 20:59:16 +01:00
Fixes an ender pearl exploit allowing players to clip through blocks who occupy less than 1 block in width or length
This commit is contained in:
parent
5988e8e5af
commit
0b2e9e340d
@ -7,6 +7,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
import com.massivecraft.factions.Conf;
|
||||
|
||||
@ -38,5 +39,28 @@ public class FactionsExploitListener implements Listener
|
||||
target.setX(target.getBlockX() + 0.5);
|
||||
target.setZ(target.getBlockZ() + 0.5);
|
||||
event.setTo(target);
|
||||
|
||||
// this exploit allows players to clip through blocks who occupy less than 1 block width or length wise
|
||||
Location from = event.getFrom();
|
||||
if(event.getTo().getBlock().getType() == Material.THIN_GLASS || event.getTo().getBlock().getType() == Material.IRON_FENCE){
|
||||
if((from.getX() > target.getX() && (from.getX() - target.getX()) < 0.65) || (target.getX() > from.getX() && (target.getX() - from.getX() < 0.65))){
|
||||
event.setTo(from);
|
||||
return;
|
||||
}
|
||||
if((from.getZ() > target.getZ() && (from.getZ() - target.getZ()) < 0.65) || (target.getZ() > from.getZ() && (target.getZ() - from.getZ() < 0.65))){
|
||||
event.setTo(from);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(event.getTo().getBlock().getType() == Material.FENCE || event.getTo().getBlock().getType() == Material.NETHER_FENCE){
|
||||
if((from.getX() > target.getX() && (from.getX() - target.getX()) < 0.45) || (target.getX() > from.getX() && (target.getX() - from.getX() < 0.45))){
|
||||
event.setTo(from);
|
||||
return;
|
||||
}
|
||||
if((from.getZ() > target.getZ() && (from.getZ() - target.getZ()) < 0.45) || (target.getZ() > from.getZ() && (target.getZ() - from.getZ() < 0.45))){
|
||||
event.setTo(from);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user