Random element from a list java

import java.util.ArrayList; import java.util.List; import java.util.Random; class TestJava { public static void main(String[] args) { List subjects = new ArrayList(); subjects.add(“Java”); subjects.add(“C”); subjects.add(“C++”); subjects.add(“MySQL”); subjects.add(“Oracle”); Random randomizer = new Random(); String randomListElement = subjects.get(randomizer.nextInt(subjects.size())); System.out.println(“Random List Element: ” +randomListElement); } } Output: Random List Element: MySQL

Send action bar spigot

player.spigot().sendMessage( ChatMessageType.ACTION_BAR, new TextComponent(“Your Message for Action Bar”));

Sleep in java

Option 1: Thread.sleep(4000); Option 2: import java.util.concurrent.TimeUnit TimeUnit.SECONDS.sleep(2);

Java get mouse position on screen

double mouseXPoistion = MouseInfo.getPointerInfo().getLocation().getX(); double mouseYPosition = MouseInfo.getPointerInfo().getLocation().getY();