Hot fixes

This commit is contained in:
Seth 2020-07-09 22:43:10 -07:00
parent 4a297a237c
commit 98f4af7fab
No known key found for this signature in database
GPG Key ID: A7BAB4E14F089CF3
4 changed files with 38 additions and 5 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,11 @@ 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,8 +78,7 @@ public class Command_donator extends FreedomCommand
try try
{ {
String result = FUtil.postRequestToEndpoint(url, "POST", headers, payload); FUtil.postRequestToEndpoint(url, "POST", headers, payload);
msg(result);
} }
catch (IOException e) catch (IOException e)
{ {

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,12 @@ 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,12 +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(tag).append("\n") .append("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n")
.append("- Ride Mode: ").append(rideMode) .append("- Ride Mode: ").append(rideMode).append("\n")
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n"); .append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n");
return output.toString(); return output.toString();
@ -229,7 +232,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", masterBuilder); put("donator", donator);
put("master_builder", masterBuilder); put("master_builder", masterBuilder);
put("verification", verification); put("verification", verification);
put("ride_mode", rideMode); put("ride_mode", rideMode);