@TidalRyan Listen to the PlayerMoveEvent, and instead of cancelling it, use the ".setTo()" direction, putting in a location with a random direction.
How? importorg.bukkit.Bukkit;import org.bukkit.entity.Player;import org.bukkit.event.EventHandler;import org.bukkit.event.EventPriority;import org.bukkit.event.Listener;import org.bukkit.event.player.PlayerMoveEvent;import org.bukkit.util.Vector; public class playerMove implements Listener { public playerMove(){ Bukkit.getPluginManager().registerEvents(this, Spellbook.getInstance());} @EventHandler(priority = EventPriority.MONITOR) public void playerMoveE(PlayerMoveEvent event) { Player player = event.getPlayer(); //Inverts it, but how do I make it random. player.setVelocity(new Vector(player.getVelocity().getX() * - 1, player.getVelocity().getY(), player.getVelocity().getZ() * - 1 )); } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
@AlvinB The problem with that, is that the movement is truly random. This means there is a possibility that the player try to move, but the player will return back to the same spot. Since move event can be called multiple times a second, that means the player can change direction multiple times per second. If you want them to have slightly random movement, create a vector which will represent an X and Z movement for a player for one second. Do this by using a Repeating task, and change the XZ value every time it runs. Every time they move, set their velocity equal to the XZ value. This will mean the player will move in a random direction, but it will be semi-constant.