Search in sources :

Example 16 with Profile

use of com.github.games647.craftapi.model.Profile in project ChangeSkin by games647.

the class LoginListener method setDefaultSkin.

private void setDefaultSkin(UserPreference preferences, GameProfile profile) {
    Optional<SkinModel> randomSkin = getRandomSkin();
    if (randomSkin.isPresent()) {
        SkinModel targetSkin = randomSkin.get();
        preferences.setTargetSkin(targetSkin);
        plugin.getApi().applyProperties(profile, targetSkin);
    }
}
Also used : SkinModel(com.github.games647.changeskin.core.model.skin.SkinModel)

Example 17 with Profile

use of com.github.games647.craftapi.model.Profile in project FastLogin by games647.

the class NameCheckTask method startCrackedSession.

@Override
public void startCrackedSession(ProtocolLibLoginSource source, StoredProfile profile, String username) {
    BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
    plugin.putSession(player.getAddress(), loginSession);
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

Example 18 with Profile

use of com.github.games647.craftapi.model.Profile in project FastLogin by games647.

the class ProtocolSupportListener method callFastLoginPreLoginEvent.

@Override
public FastLoginPreLoginEvent callFastLoginPreLoginEvent(String username, ProtocolLoginSource source, StoredProfile profile) {
    BukkitFastLoginPreLoginEvent event = new BukkitFastLoginPreLoginEvent(username, source, profile);
    plugin.getServer().getPluginManager().callEvent(event);
    return event;
}
Also used : BukkitFastLoginPreLoginEvent(com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent)

Example 19 with Profile

use of com.github.games647.craftapi.model.Profile in project FastLogin by games647.

the class ProtocolSupportListener method startCrackedSession.

@Override
public void startCrackedSession(ProtocolLoginSource source, StoredProfile profile, String username) {
    BukkitLoginSession loginSession = new BukkitLoginSession(username, profile);
    plugin.putSession(source.getAddress(), loginSession);
}
Also used : BukkitLoginSession(com.github.games647.fastlogin.bukkit.BukkitLoginSession)

Example 20 with Profile

use of com.github.games647.craftapi.model.Profile in project FastLogin by games647.

the class CrackedCommand method onCrackedOther.

private void onCrackedOther(CommandSender sender, Command command, String[] args) {
    if (!hasOtherPermission(sender, command)) {
        return;
    }
    if (forwardCrackedCommand(sender, args[0])) {
        return;
    }
    // todo: load async
    StoredProfile profile = plugin.getCore().getStorage().loadProfile(args[0]);
    if (profile == null) {
        sender.sendMessage("Error occurred");
        return;
    }
    // existing player is already cracked
    if (profile.isSaved() && !profile.isPremium()) {
        plugin.getCore().sendLocaleMessage("not-premium-other", sender);
    } else {
        plugin.getCore().sendLocaleMessage("remove-premium", sender);
        profile.setPremium(false);
        plugin.getScheduler().runAsync(() -> {
            plugin.getCore().getStorage().save(profile);
            plugin.getServer().getPluginManager().callEvent(new BukkitFastLoginPremiumToggleEvent(profile, PremiumToggleReason.COMMAND_OTHER));
        });
    }
}
Also used : StoredProfile(com.github.games647.fastlogin.core.StoredProfile) BukkitFastLoginPremiumToggleEvent(com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPremiumToggleEvent)

Aggregations

Profile (com.github.games647.craftapi.model.Profile)8 StoredProfile (com.github.games647.fastlogin.core.StoredProfile)7 SkinPropertyTest (com.github.games647.craftapi.model.skin.SkinPropertyTest)5 BukkitLoginSession (com.github.games647.fastlogin.bukkit.BukkitLoginSession)5 Test (org.junit.Test)5 BukkitFastLoginPremiumToggleEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPremiumToggleEvent)4 UUID (java.util.UUID)3 SkinModel (com.github.games647.changeskin.core.model.skin.SkinModel)2 SkinProperty (com.github.games647.craftapi.model.skin.SkinProperty)2 RateLimitException (com.github.games647.craftapi.resolver.RateLimitException)2 BukkitFastLoginPreLoginEvent (com.github.games647.fastlogin.bukkit.event.BukkitFastLoginPreLoginEvent)2 BungeeLoginSession (com.github.games647.fastlogin.bungee.BungeeLoginSession)2 IOException (java.io.IOException)2 ChangeSkinCore (com.github.games647.changeskin.core.ChangeSkinCore)1 SkinStorage (com.github.games647.changeskin.core.SkinStorage)1 GameProfile (com.github.games647.changeskin.core.model.GameProfile)1 UserPreference (com.github.games647.changeskin.core.model.UserPreference)1 Account (com.github.games647.changeskin.core.model.auth.Account)1 TextureType (com.github.games647.changeskin.core.model.skin.TextureType)1 SharedListener (com.github.games647.changeskin.core.shared.SharedListener)1