Merge pull request #848 from Smart123s/fix/duplicate/forwardccommand

Remove duplicate forwardCrackedCommand()
This commit is contained in:
games647
2022-07-15 08:56:45 +02:00
committed by GitHub

View File

@ -62,25 +62,20 @@ public class CrackedCommand extends ToggleCommand {
return; return;
} }
if (plugin.getBungeeManager().isEnabled()) { // todo: load async if
sendBungeeActivateMessage(sender, sender.getName(), false); StoredProfile profile = plugin.getCore().getStorage().loadProfile(sender.getName());
plugin.getCore().sendLocaleMessage("wait-on-proxy", sender); if (profile.isPremium()) {
} else { plugin.getCore().sendLocaleMessage("remove-premium", sender);
//todo: load async if
StoredProfile profile = plugin.getCore().getStorage().loadProfile(sender.getName());
if (profile.isPremium()) {
plugin.getCore().sendLocaleMessage("remove-premium", sender);
profile.setPremium(false); profile.setPremium(false);
profile.setId(null); profile.setId(null);
plugin.getScheduler().runAsync(() -> { plugin.getScheduler().runAsync(() -> {
plugin.getCore().getStorage().save(profile); plugin.getCore().getStorage().save(profile);
plugin.getServer().getPluginManager().callEvent( plugin.getServer().getPluginManager().callEvent(
new BukkitFastLoginPremiumToggleEvent(profile, PremiumToggleReason.COMMAND_OTHER)); new BukkitFastLoginPremiumToggleEvent(profile, PremiumToggleReason.COMMAND_OTHER));
}); });
} else { } else {
plugin.getCore().sendLocaleMessage("not-premium", sender); plugin.getCore().sendLocaleMessage("not-premium", sender);
}
} }
} }