Add cracked whitelist (Fixes #42)

(switch-mode -> switching to online-mode from offlinemode)
This commit is contained in:
games647
2016-09-09 16:40:24 +02:00
parent ad1ab22586
commit 5022c9aa7b
7 changed files with 30 additions and 8 deletions

View File

@ -3,6 +3,12 @@
* Added second attempt login -> cracked login
* Fix ProtocolSupport autoRegister
* Fix update username in FastLogin database after nameChange
* Fix logging exceptions on encryption enabling
* Add missing add-premium-other message
* Fix compatibility with older ProtocolLib versions (for 1.7) because of the missing getMethodAcccessorOrNull method
* Add cracked whitelist (switch-mode -> switching to online-mode from offlinemode)
* Fix correct cracked permission for bukkit
* A try to fix SQLite timestamp parsing
######1.8

View File

@ -77,11 +77,14 @@ public class CrackedCommand implements CommandExecutor {
//todo: load async
final PlayerProfile profile = plugin.getCore().getStorage().loadProfile(args[0]);
if (profile == null) {
sender.sendMessage(plugin.getCore().getMessage("player-unknown"));
sender.sendMessage("Error occured");
return;
}
if (profile.isPremium()) {
//existing player is already cracked
if (profile.getUserId() == -1 && !profile.isPremium()) {
sender.sendMessage(plugin.getCore().getMessage("not-premium-other"));
} else {
sender.sendMessage(plugin.getCore().getMessage("remove-premium"));
profile.setPremium(false);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@ -90,8 +93,6 @@ public class CrackedCommand implements CommandExecutor {
plugin.getCore().getStorage().save(profile);
}
});
} else {
sender.sendMessage(plugin.getCore().getMessage("not-premium-other"));
}
}
}

View File

@ -1,5 +1,6 @@
package com.github.games647.fastlogin.bungee;
import com.github.games647.fastlogin.bungee.FastLoginBungee;
import com.github.games647.fastlogin.core.AuthStorage;
import com.github.games647.fastlogin.core.FastLoginCore;
import com.github.games647.fastlogin.core.importer.ImportPlugin;
@ -13,7 +14,7 @@ public class ImportCommand extends Command {
private final FastLoginBungee plugin;
public ImportCommand(FastLoginBungee plugin) {
super("import-db");
super("import-db", plugin.getDescription().getName().toLowerCase() + ".import");
this.plugin = plugin;
}
@ -79,7 +80,5 @@ public class ImportCommand extends Command {
} else {
sender.sendMessage(ChatColor.DARK_RED + "Failed to import the data. Check out the logs");
}
return;
}
}

View File

@ -58,6 +58,11 @@ public class AsyncPremiumCheck implements Runnable {
} else if (profile.isPremium()) {
requestPremiumLogin(connection, profile, username, true);
} else {
if (plugin.getConfig().getBoolean("switchMode")) {
connection.disconnect(plugin.getCore().getMessage("switch-kick-message"));
return;
}
//Cracked session
plugin.getSession().put(connection, new BungeeLoginSession(username, false, profile));
}

View File

@ -32,7 +32,8 @@ public class AsyncToggleMessage implements Runnable {
private void turnOffPremium() {
PlayerProfile playerProfile = plugin.getCore().getStorage().loadProfile(targetPlayer);
if (!playerProfile.isPremium()) {
//existing player is already cracked
if (playerProfile.getUserId() != -1 && !playerProfile.isPremium()) {
fromPlayer.sendMessage(TextComponent.fromLegacyText(plugin.getCore().getMessage("not-premium")));
return;
}

View File

@ -29,6 +29,13 @@ autoRegister: false
# tries to join again, so the player could join as cracked player.
secondAttemptCracked: false
# New cracked players will be kicked from server. Good if you want switch from offline-mode to online-mode without
# losing players!
#
# Existing cracked and premium players could still join your server. Moreover you could add playernames to a whitelist.
# So that these cracked players could join too although they are new players.
switchMode: false
# If this plugin detected that a player has a premium, it can also set the associated
# uuid from that account. So if the players changes their usernames, they will still have
# the same playerdata (inventory, permissions, ...)

View File

@ -21,6 +21,9 @@
# ========= Shared (BungeeCord and Bukkit) ============
# Switch mode is activated and a new (non-whitelist) cracked player tries to join
switch-kick-message: '&4Only paid minecraft whitelisted accounts are allowed to join this server'
# Player activated premium logins in order to skip offline authentication
add-premium: '&2Added to the list of premium players'