Files
SteevsLobbyPlugin/src/main/java/de/vortexhq/lobby/Manager/PlayerManager.java

38 lines
1.1 KiB
Java

package de.vortexhq.lobby.Manager;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class PlayerManager {
private LobbyManager lobbyManager;
public PlayerManager(LobbyManager lobbyManager) {
this.lobbyManager = lobbyManager;
}
/**
* teleports a player to a location
* @param player the wanted player
* @param loc the wanted location
*/
public void teleportPlayer(Player player, Location loc) {
player.teleport(loc);
}
/**
* Moves a player from a server to another
* @param dest the destination
* @param target the player to send
*/
public void moveFromServer(String dest, Player target) {
ByteArrayDataOutput aOut = ByteStreams.newDataOutput();
aOut.writeUTF("Connect");
aOut.writeUTF(dest);
target.sendPluginMessage(this.lobbyManager.getLobby(), "BungeeCord", aOut.toByteArray());
}
}