mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-25 02:27:42 +01:00
Added GLIDE and SWIM MoveTypes, and made Horses use RIDE
This commit is contained in:
parent
9804c69044
commit
3ea7c9fc08
@ -29,6 +29,8 @@ public enum MoveType {
|
||||
RESPAWN(false, true),
|
||||
EMBARK(true, false),
|
||||
MOVE(true, false),
|
||||
GLIDE(true, false),
|
||||
SWIM(true, false),
|
||||
TELEPORT(true, true),
|
||||
RIDE(true, false),
|
||||
OTHER_NON_CANCELLABLE(false, false),
|
||||
|
@ -28,6 +28,7 @@
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -80,7 +81,15 @@ public void onPlayerMove(PlayerMoveEvent event) {
|
||||
LocalPlayer localPlayer = plugin.wrapPlayer(player);
|
||||
|
||||
Session session = WorldGuard.getInstance().getPlatform().getSessionManager().get(localPlayer);
|
||||
com.sk89q.worldedit.util.Location weLocation = session.testMoveTo(localPlayer, BukkitAdapter.adapt(event.getTo()), MoveType.MOVE);
|
||||
MoveType moveType = MoveType.MOVE;
|
||||
if (event.getPlayer().isGliding()) {
|
||||
moveType = MoveType.GLIDE;
|
||||
} else if (event.getPlayer().isSwimming()) {
|
||||
moveType = MoveType.SWIM;
|
||||
} else if (event.getPlayer().getVehicle() != null && event.getPlayer().getVehicle() instanceof Horse) {
|
||||
moveType = MoveType.RIDE;
|
||||
}
|
||||
com.sk89q.worldedit.util.Location weLocation = session.testMoveTo(localPlayer, BukkitAdapter.adapt(event.getTo()), moveType);
|
||||
|
||||
if (weLocation != null) {
|
||||
final Location override = BukkitAdapter.adapt(weLocation);
|
||||
|
Loading…
Reference in New Issue
Block a user