mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Removal of premium
This commit is contained in:
parent
1357ac7e09
commit
aac791d768
@ -1,80 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SENIOR_CONSOLE, source = SourceType.ONLY_CONSOLE)
|
||||
@CommandParameters(description = "Adds or removes donators", usage = "/<command> <mode> <name> <ip> <package> [forum_user]")
|
||||
public class Command_donator extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (!FUtil.isFromHostConsole(sender.getName()) && !ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
|
||||
{
|
||||
return noPerms();
|
||||
}
|
||||
|
||||
Boolean mode = args[0].equals("add");
|
||||
String name = args[1];
|
||||
String ip = args[2];
|
||||
String pkg = args[3];
|
||||
String forum_id = null;
|
||||
|
||||
if (args.length > 4)
|
||||
{
|
||||
forum_id = args[4];
|
||||
}
|
||||
|
||||
PlayerData player = plugin.pl.getData(name);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
player = plugin.pl.getDataByIp(ip);
|
||||
}
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.setDonator(mode);
|
||||
plugin.pl.save(player);
|
||||
}
|
||||
|
||||
if (forum_id != null && !forum_id.equals("0"))
|
||||
{
|
||||
String baseurl = ConfigEntry.DONATION_PROBOARDS_URL.getString();
|
||||
String group_id = ConfigEntry.DONATION_GROUP_ID.getString();
|
||||
String session_id = ConfigEntry.DONATION_SESSION_ID.getString();
|
||||
String csrf_token = ConfigEntry.DONATION_CSRF_TOKEN.getString();
|
||||
if (baseurl == null || group_id == null || session_id == null || csrf_token == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
String url = baseurl + "/user/group_members/" + (mode ? "adding" : "remove");
|
||||
List<String> headers = Arrays.asList("Cookie:session_id=" + session_id, "X-Requested-With:XMLHttpRequest");
|
||||
String payload = "group_id=" + group_id + "&user_ids[]=" + forum_id + "&csrf_token=" + csrf_token;
|
||||
|
||||
try
|
||||
{
|
||||
String result = FUtil.postRequestToEndpoint(url, "POST", headers, payload);
|
||||
msg(result);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
FLog.severe(e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -32,8 +32,6 @@ public class PlayerData
|
||||
private String discordID = null;
|
||||
private final List<String> backupCodes = Lists.newArrayList();
|
||||
@Setter
|
||||
private Boolean donator = false;
|
||||
@Setter
|
||||
private Boolean masterBuilder = false;
|
||||
@Setter
|
||||
private Boolean verification = false;
|
||||
@ -61,7 +59,6 @@ public class PlayerData
|
||||
discordID = resultSet.getString("discord_id");
|
||||
backupCodes.clear();
|
||||
backupCodes.addAll(FUtil.stringToList(resultSet.getString("backup_codes")));
|
||||
donator = resultSet.getBoolean("donator");
|
||||
masterBuilder = resultSet.getBoolean("master_builder");
|
||||
verification = resultSet.getBoolean("verification");
|
||||
rideMode = resultSet.getString("ride_mode");
|
||||
@ -96,7 +93,6 @@ public class PlayerData
|
||||
output.append("Player: ").append(name).append("\n")
|
||||
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
|
||||
.append("- Discord ID: ").append(discordID).append("\n")
|
||||
.append("- Donator: ").append(donator).append("\n")
|
||||
.append("- Master Builder: ").append(masterBuilder).append("\n")
|
||||
.append("- Has Verification: ").append(verification).append("\n")
|
||||
.append("- Coins: ").append(coins).append("\n")
|
||||
@ -182,11 +178,6 @@ public class PlayerData
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isDonator()
|
||||
{
|
||||
return donator;
|
||||
}
|
||||
|
||||
public void giveItem(ShopItem item)
|
||||
{
|
||||
items.add(item.getDataName());
|
||||
@ -231,7 +222,6 @@ public class PlayerData
|
||||
put("tag", tag);
|
||||
put("discord_id", discordID);
|
||||
put("backup_codes", FUtil.listToString(backupCodes));
|
||||
put("donator", donator);
|
||||
put("master_builder", masterBuilder);
|
||||
put("verification", verification);
|
||||
put("ride_mode", rideMode);
|
||||
|
@ -77,12 +77,6 @@ public class RankManager extends FreedomService
|
||||
return Title.MASTER_BUILDER;
|
||||
}
|
||||
|
||||
PlayerData playerData = plugin.pl.getData(player);
|
||||
if (!plugin.al.isAdmin(player) && playerData.isDonator())
|
||||
{
|
||||
return Title.DONATOR;
|
||||
}
|
||||
|
||||
return getRank(player);
|
||||
}
|
||||
|
||||
@ -179,7 +173,7 @@ public class RankManager extends FreedomService
|
||||
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
PlayerData data = plugin.pl.getData(player);
|
||||
Displayable display = getDisplay(player);
|
||||
if (plugin.al.isAdmin(player) || data.isMasterBuilder() || data.isDonator() || FUtil.isDeveloper(player.getName()))
|
||||
if (plugin.al.isAdmin(player) || data.isMasterBuilder() || FUtil.isDeveloper(player.getName()))
|
||||
{
|
||||
String displayName = display.getColor() + player.getName();
|
||||
player.setPlayerListName(displayName);
|
||||
@ -247,7 +241,7 @@ public class RankManager extends FreedomService
|
||||
}
|
||||
|
||||
// Set display
|
||||
if (isAdmin || FUtil.DEVELOPERS.contains(player.getName()) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).isDonator())
|
||||
if (isAdmin || FUtil.DEVELOPERS.contains(player.getName()) || plugin.pl.getData(player).isMasterBuilder())
|
||||
{
|
||||
final Displayable display = getDisplay(player);
|
||||
|
||||
|
@ -6,7 +6,6 @@ import net.md_5.bungee.api.ChatColor;
|
||||
public enum Title implements Displayable
|
||||
{
|
||||
|
||||
DONATOR("a", "Premium Member", ChatColor.of("#ff5600"), org.bukkit.ChatColor.LIGHT_PURPLE, "Premium", true),
|
||||
MASTER_BUILDER("a", "Master Builder", ChatColor.DARK_AQUA, org.bukkit.ChatColor.DARK_AQUA, "MB", true),
|
||||
VERIFIED_ADMIN("a", "Verified Admin", ChatColor.LIGHT_PURPLE, org.bukkit.ChatColor.LIGHT_PURPLE, "VA", false),
|
||||
ASSISTANT_EXECUTIVE("an", "Assistant Executive", ChatColor.RED, org.bukkit.ChatColor.RED, "Asst Exec", true),
|
||||
|
@ -95,7 +95,7 @@ public class SQLite extends FreedomService
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.createStatement().execute("CREATE TABLE `players` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `backup_codes` VARCHAR, `donator` BOOLEAN NOT NULL, `master_builder` BOOLEAN NOT NULL,`verification` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT NOT NULL, `items` VARCHAR, `total_votes` INT NOT NULL);");
|
||||
connection.createStatement().execute("CREATE TABLE `players` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `notes` VARCHAR, `tag` VARCHAR, `discord_id` VARCHAR, `backup_codes` VARCHAR, `master_builder` BOOLEAN NOT NULL,`verification` BOOLEAN NOT NULL, `ride_mode` VARCHAR NOT NULL, `coins` INT NOT NULL, `items` VARCHAR, `total_votes` INT NOT NULL);");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -269,20 +269,19 @@ public class SQLite extends FreedomService
|
||||
{
|
||||
try
|
||||
{
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
statement.setString(1, player.getName());
|
||||
statement.setString(2, FUtil.listToString(player.getIps()));
|
||||
statement.setString(3, FUtil.listToString(player.getNotes()));
|
||||
statement.setString(4, player.getTag());
|
||||
statement.setString(5, player.getDiscordID());
|
||||
statement.setString(6, FUtil.listToString(player.getBackupCodes()));
|
||||
statement.setBoolean(7, player.isDonator());
|
||||
statement.setBoolean(8, player.isMasterBuilder());
|
||||
statement.setBoolean(9, player.hasVerification());
|
||||
statement.setString(10, player.getRideMode());
|
||||
statement.setInt(11, player.getCoins());
|
||||
statement.setString(12, FUtil.listToString(player.getItems()));
|
||||
statement.setInt(13, player.getTotalVotes());
|
||||
statement.setBoolean(7, player.isMasterBuilder());
|
||||
statement.setBoolean(8, player.hasVerification());
|
||||
statement.setString(9, player.getRideMode());
|
||||
statement.setInt(10, player.getCoins());
|
||||
statement.setString(11, FUtil.listToString(player.getItems()));
|
||||
statement.setInt(12, player.getTotalVotes());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
Loading…
Reference in New Issue
Block a user