Added autoRegister for BungeeCord

This commit is contained in:
games647
2016-04-27 18:00:25 +02:00
parent 36974450ce
commit b697dc6655
8 changed files with 200 additions and 64 deletions
@@ -22,11 +22,6 @@ public class CrackedCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (plugin.getStorage() == null) {
sender.sendMessage(ChatColor.DARK_RED + "This command is disabled on the backend server");
return true;
}
if (args.length == 0) {
if (!(sender instanceof Player)) {
//console or command block
@@ -37,22 +32,25 @@ public class CrackedCommand implements CommandExecutor {
final Player player = (Player) sender;
// UUID uuid = player.getUniqueId();
//todo: load async if it's not in the cache anymore
final PlayerProfile profile = plugin.getStorage().getProfile(player.getName(), true);
if (profile.isPremium()) {
sender.sendMessage(ChatColor.DARK_GREEN + "Removed from the list of premium players");
profile.setPremium(false);
profile.setUuid(null);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getStorage().save(profile);
}
});
if (plugin.isBungeeCord()) {
notifiyBungeeCord((Player) sender);
sender.sendMessage(ChatColor.YELLOW + "Sending request...");
} else {
sender.sendMessage(ChatColor.DARK_RED + "You are not in the premium list");
//todo: load async if it's not in the cache anymore
final PlayerProfile profile = plugin.getStorage().getProfile(player.getName(), true);
if (profile.isPremium()) {
sender.sendMessage(ChatColor.DARK_GREEN + "Removed from the list of premium players");
profile.setPremium(false);
profile.setUuid(null);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getStorage().save(profile);
}
});
} else {
sender.sendMessage(ChatColor.DARK_RED + "You are not in the premium list");
}
}
return true;
@@ -27,11 +27,6 @@ public class PremiumCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (plugin.getStorage() == null) {
sender.sendMessage(ChatColor.DARK_RED + "This command is disabled on the backend server");
return true;
}
if (args.length == 0) {
if (!(sender instanceof Player)) {
//console or command block
@@ -42,23 +37,28 @@ public class PremiumCommand implements CommandExecutor {
Player player = (Player) sender;
// UUID uuid = player.getUniqueId();
// //todo: load async if it's not in the cache anymore
final PlayerProfile profile = plugin.getStorage().getProfile(player.getName(), true);
if (profile.isPremium()) {
sender.sendMessage(ChatColor.DARK_RED + "You are already on the premium list");
if (plugin.isBungeeCord()) {
notifiyBungeeCord(player);
sender.sendMessage(ChatColor.YELLOW + "Sending request...");
} else {
//todo: resolve uuid
profile.setPremium(true);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getStorage().save(profile);
}
});
sender.sendMessage(ChatColor.DARK_GREEN + "Added to the list of premium players");
// //todo: load async if it's not in the cache anymore
final PlayerProfile profile = plugin.getStorage().getProfile(player.getName(), true);
if (profile.isPremium()) {
sender.sendMessage(ChatColor.DARK_RED + "You are already on the premium list");
} else {
//todo: resolve uuid
profile.setPremium(true);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
@Override
public void run() {
plugin.getStorage().save(profile);
}
});
sender.sendMessage(ChatColor.DARK_GREEN + "Added to the list of premium players");
}
}
notifiyBungeeCord((Player) sender);
return true;
} else {
sender.sendMessage(ChatColor.DARK_RED + "NOT IMPLEMENTED YET");
+1 -1
View File
@@ -53,7 +53,7 @@ premiumUuid: false
# players like cracked player, you have to use other plugins.
#
# If you want to use skins for your cracked player, you need an additional plugin like
# ChangeSkin, SKinRestoer, ...
# ChangeSkin, SkinRestoer, ...
forwardSkin: true
# Database configuration