moved code from other version to repo
This commit is contained in:
37
src/main/java/de/vortexhq/lobby/Manager/PlayerManager.java
Normal file
37
src/main/java/de/vortexhq/lobby/Manager/PlayerManager.java
Normal file
@ -0,0 +1,37 @@
|
||||
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());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user