Lookup the records by username and get the UUID ourself.

This commit is contained in:
graywolf336 2014-04-30 13:18:56 -05:00
parent a7798c9d62
commit f1dadaaae0
3 changed files with 10 additions and 5 deletions

View File

@ -2,6 +2,8 @@
==== ====
This plugins adds Jail to your Minecraft server. Admins can define several jails and then jail/unjail people or jail them on time basis. Plugin also offers wide variety of protections, so players won't escape out of your jail. This plugins adds Jail to your Minecraft server. Admins can define several jails and then jail/unjail people or jail them on time basis. Plugin also offers wide variety of protections, so players won't escape out of your jail.
**All mysql queries and actions are done sync, meaning if the connection to the mysql server is slow/down this will probably end up blocking the server. This has plans to be changed, as we don't want to slow down anyone's servers.**
[![Build Status](http://ci.graywolf336.com/job/Jail/badge/icon)](http://ci.graywolf336.com/job/Jail/) [![Build Status](http://ci.graywolf336.com/job/Jail/badge/icon)](http://ci.graywolf336.com/job/Jail/)
Beta 2 Changes Beta 2 Changes

View File

@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
@ -1122,10 +1123,12 @@ public class JailIO {
/** /**
* Gets all the record entries for the given player. * Gets all the record entries for the given player.
* *
* @param uuid of the prisoner to get. * @param username the of the prisoner's records to get.
* @return A List of strings containing the record entries. * @return A List of strings containing the record entries.
* @deprecated This calls getOfflinePlayer which is a blocking call from Bukkit
*/ */
public List<String> getRecordEntries(String uuid) { public List<String> getRecordEntries(String username) {
UUID uuid = pl.getServer().getOfflinePlayer(username).getUniqueId();
List<String> entries = new ArrayList<String>(); List<String> entries = new ArrayList<String>();
switch(storage) { switch(storage) {
@ -1134,7 +1137,7 @@ public class JailIO {
case 2: case 2:
try { try {
PreparedStatement ps = con.prepareStatement("SELECT * FROM " + prefix + "records where uuid = ?"); PreparedStatement ps = con.prepareStatement("SELECT * FROM " + prefix + "records where uuid = ?");
ps.setString(1, uuid); ps.setString(1, uuid.toString());
ResultSet set = ps.executeQuery(); ResultSet set = ps.executeQuery();
while(set.next()) { while(set.next()) {
@ -1153,7 +1156,7 @@ public class JailIO {
default: default:
if(records == null) records = YamlConfiguration.loadConfiguration(new File(pl.getDataFolder(), "records.yml")); if(records == null) records = YamlConfiguration.loadConfiguration(new File(pl.getDataFolder(), "records.yml"));
entries = records.getStringList(uuid); entries = records.getStringList(uuid.toString());
break; break;
} }

View File

@ -15,7 +15,7 @@ import com.graywolf336.jail.enums.LangString;
needsPlayer = false, needsPlayer = false,
pattern = "reload|r", pattern = "reload|r",
permission = "jail.command.jailrecord", permission = "jail.command.jailrecord",
usage = "/jail record" usage = "/jail record <username> <display>"
) )
public class JailRecordCommand implements Command { public class JailRecordCommand implements Command {
public boolean execute(JailManager jm, CommandSender sender, String... args) { public boolean execute(JailManager jm, CommandSender sender, String... args) {