Merge pull request #220 from TFPatches/development

Shouldn't of squashed this.
This commit is contained in:
Seth 2020-07-10 01:04:41 -07:00 committed by GitHub
commit 06d40927b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.bukkit.ChatColor;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -49,6 +50,10 @@ public class Command_donator extends FreedomCommand
plugin.pl.save(data); plugin.pl.save(data);
} }
if (mode)
{
FUtil.bcastMsg(ChatColor.AQUA + name + ChatColor.GREEN + " has donated to the server!");
}
Player player = getPlayer(name); Player player = getPlayer(name);
if (player != null) if (player != null)
@ -72,6 +77,7 @@ public class Command_donator extends FreedomCommand
try try
{ {
FUtil.postRequestToEndpoint(url, "POST", headers, payload);
String result = FUtil.postRequestToEndpoint(url, "POST", headers, payload); String result = FUtil.postRequestToEndpoint(url, "POST", headers, payload);
msg(result); msg(result);
} }

View File

@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.player.PlayerData;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.shop.ShopItem; import me.totalfreedom.totalfreedommod.shop.ShopItem;
@ -18,7 +19,7 @@ public class Command_manageshop extends FreedomCommand
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
if (!FUtil.isExecutive(sender.getName())) if (!ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
{ {
return noPerms(); return noPerms();
} }

View File

@ -0,0 +1,18 @@
package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
@CommandParameters(description = "Check your personal data", usage = "/<command>")
public class Command_myinfo extends FreedomCommand
{
@Override
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
msg(plugin.pl.getData(playerSender).toString());
return true;
}
}

View File

@ -1,6 +1,7 @@
package me.totalfreedom.totalfreedommod.discord; package me.totalfreedom.totalfreedommod.discord;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.admin.Admin;
import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.player.PlayerData;
import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent; import net.dv8tion.jda.api.events.message.priv.PrivateMessageReceivedEvent;
import net.dv8tion.jda.api.hooks.ListenerAdapter; import net.dv8tion.jda.api.hooks.ListenerAdapter;
@ -23,6 +24,11 @@ public class PrivateMessageListener extends ListenerAdapter
player.setDiscordID(event.getMessage().getAuthor().getId()); player.setDiscordID(event.getMessage().getAuthor().getId());
player.setVerification(true); player.setVerification(true);
Admin admin = TotalFreedomMod.plugin().al.getEntryByName(name);
if (admin != null)
{
Discord.syncRoles(admin, player.getDiscordID());
}
TotalFreedomMod.plugin().pl.save(player); TotalFreedomMod.plugin().pl.save(player);
Discord.LINK_CODES.remove(code); Discord.LINK_CODES.remove(code);
} }

View File

@ -14,6 +14,7 @@ import me.totalfreedom.totalfreedommod.shop.ShopItem;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import me.totalfreedom.totalfreedommod.util.FUtil; import me.totalfreedom.totalfreedommod.util.FUtil;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class PlayerData public class PlayerData
@ -61,6 +62,7 @@ public class PlayerData
discordID = resultSet.getString("discord_id"); discordID = resultSet.getString("discord_id");
backupCodes.clear(); backupCodes.clear();
backupCodes.addAll(FUtil.stringToList(resultSet.getString("backup_codes"))); backupCodes.addAll(FUtil.stringToList(resultSet.getString("backup_codes")));
donator = resultSet.getBoolean("donator");
masterBuilder = resultSet.getBoolean("master_builder"); masterBuilder = resultSet.getBoolean("master_builder");
verification = resultSet.getBoolean("verification"); verification = resultSet.getBoolean("verification");
rideMode = resultSet.getString("ride_mode"); rideMode = resultSet.getString("ride_mode");
@ -95,10 +97,13 @@ public class PlayerData
output.append("Player: ").append(name).append("\n") output.append("Player: ").append(name).append("\n")
.append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n") .append("- IPs: ").append(StringUtils.join(ips, ", ")).append("\n")
.append("- Discord ID: ").append(discordID).append("\n") .append("- Discord ID: ").append(discordID).append("\n")
.append("- Donator: ").append(donator).append("\n")
.append("- Master Builder: ").append(masterBuilder).append("\n") .append("- Master Builder: ").append(masterBuilder).append("\n")
.append("- Has Verification: ").append(verification).append("\n") .append("- Has Verification: ").append(verification).append("\n")
.append("- Coins: ").append(coins).append("\n") .append("- Coins: ").append(coins).append("\n")
.append("- Total Votes: ").append(totalVotes).append("\n") .append("- Total Votes: ").append(totalVotes).append("\n")
.append("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n")
.append("- Ride Mode: ").append(rideMode).append("\n")
.append("- Tag: ").append(tag).append("\n") .append("- Tag: ").append(tag).append("\n")
.append("- Ride Mode: ").append(rideMode) .append("- Ride Mode: ").append(rideMode)
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n"); .append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n");
@ -229,6 +234,7 @@ public class PlayerData
put("tag", tag); put("tag", tag);
put("discord_id", discordID); put("discord_id", discordID);
put("backup_codes", FUtil.listToString(backupCodes)); put("backup_codes", FUtil.listToString(backupCodes));
put("donator", donator);
put("donator", masterBuilder); put("donator", masterBuilder);
put("master_builder", masterBuilder); put("master_builder", masterBuilder);
put("verification", verification); put("verification", verification);