Search in sources :

Example 6 with PartyHomeImpl

use of com.alessiodp.parties.common.parties.objects.PartyHomeImpl in project Parties by AlessioDP.

the class BukkitPartiesBungeecordListener method handleHomeTeleport.

public void handleHomeTeleport(PartiesPacket packet) {
    PartyPlayerImpl partyPlayer = ((PartiesPlugin) plugin).getPlayerManager().getPlayer(packet.getPlayer());
    if (partyPlayer != null) {
        User user = plugin.getPlayer(packet.getPlayer());
        if (user != null) {
            try {
                String homeSerialized = packet.getText();
                String message = packet.getSecondaryText();
                PartyHomeImpl home = PartyHomeImpl.deserialize(homeSerialized);
                if (home != null) {
                    Location location = new Location(Bukkit.getWorld(home.getWorld()), home.getX(), home.getY(), home.getZ(), home.getYaw(), home.getPitch());
                    BukkitCommandHome.teleportToPartyHome((PartiesPlugin) plugin, partyPlayer, (BukkitUser) user, home, location, message);
                    plugin.getLoggerManager().logDebug(String.format(PartiesConstants.DEBUG_MESSAGING_LISTEN_HOME_TELEPORT, packet.getPlayer().toString(), homeSerialized), true);
                }
            } catch (Exception ex) {
                plugin.getLoggerManager().logError(PartiesConstants.DEBUG_MESSAGING_LISTEN_HOME_TELEPORT_ERROR, ex);
            }
        }
    }
}
Also used : User(com.alessiodp.core.common.user.User) BukkitUser(com.alessiodp.core.bukkit.user.BukkitUser) PartyPlayerImpl(com.alessiodp.parties.common.players.objects.PartyPlayerImpl) PartyHomeImpl(com.alessiodp.parties.common.parties.objects.PartyHomeImpl) Location(org.bukkit.Location)

Aggregations

PartyHomeImpl (com.alessiodp.parties.common.parties.objects.PartyHomeImpl)6 PartyPlayerImpl (com.alessiodp.parties.common.players.objects.PartyPlayerImpl)4 User (com.alessiodp.core.common.user.User)3 PartyImpl (com.alessiodp.parties.common.parties.objects.PartyImpl)3 BukkitUser (com.alessiodp.core.bukkit.user.BukkitUser)2 PartiesPlugin (com.alessiodp.parties.common.PartiesPlugin)2 Location (org.bukkit.Location)2 Test (org.junit.jupiter.api.Test)2 ADPPlugin (com.alessiodp.core.common.ADPPlugin)1 ADPMainCommand (com.alessiodp.core.common.commands.utils.ADPMainCommand)1 CommandData (com.alessiodp.core.common.commands.utils.CommandData)1 CancellableTask (com.alessiodp.core.common.scheduling.CancellableTask)1 CommonUtils (com.alessiodp.core.common.utils.CommonUtils)1 DeleteCause (com.alessiodp.parties.api.enums.DeleteCause)1 JoinCause (com.alessiodp.parties.api.enums.JoinCause)1 LeaveCause (com.alessiodp.parties.api.enums.LeaveCause)1 IPartyGetExperienceEvent (com.alessiodp.parties.api.events.common.party.IPartyGetExperienceEvent)1 IPartyLevelUpEvent (com.alessiodp.parties.api.events.common.party.IPartyLevelUpEvent)1 IPartyPostCreateEvent (com.alessiodp.parties.api.events.common.party.IPartyPostCreateEvent)1 IPartyPostDeleteEvent (com.alessiodp.parties.api.events.common.party.IPartyPostDeleteEvent)1