xAuth 2.6 compatibility

This commit is contained in:
Gabriele C 2015-06-17 18:32:41 +02:00
parent 8a33b65538
commit 17e81aada3
2 changed files with 9 additions and 6 deletions

View File

@ -11,7 +11,7 @@ import java.util.List;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import de.luricos.bukkit.xAuth.xAuth; import de.luricos.bukkit.xAuth.xAuth;
import de.luricos.bukkit.xAuth.database.Table; import de.luricos.bukkit.xAuth.database.DatabaseTables;
import de.luricos.bukkit.xAuth.utils.xAuthLog; import de.luricos.bukkit.xAuth.utils.xAuthLog;
import fr.xephi.authme.AuthMe; import fr.xephi.authme.AuthMe;
import fr.xephi.authme.cache.auth.PlayerAuth; import fr.xephi.authme.cache.auth.PlayerAuth;
@ -66,7 +66,7 @@ public class newxAuthToFlat {
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
String sql = String.format("SELECT `playername` FROM `%s` WHERE `id` = ?", xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT)); String sql = String.format("SELECT `playername` FROM `%s` WHERE `id` = ?", xAuth.getPlugin().getDatabaseController().getTable(DatabaseTables.ACCOUNT));
ps = conn.prepareStatement(sql); ps = conn.prepareStatement(sql);
ps.setInt(1, id); ps.setInt(1, id);
rs = ps.executeQuery(); rs = ps.executeQuery();
@ -88,7 +88,7 @@ public class newxAuthToFlat {
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
String sql = String.format("SELECT * FROM `%s`", xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT)); String sql = String.format("SELECT * FROM `%s`", xAuth.getPlugin().getDatabaseController().getTable(DatabaseTables.ACCOUNT));
ps = conn.prepareStatement(sql); ps = conn.prepareStatement(sql);
rs = ps.executeQuery(); rs = ps.executeQuery();
while (rs.next()) { while (rs.next()) {
@ -109,7 +109,7 @@ public class newxAuthToFlat {
PreparedStatement ps = null; PreparedStatement ps = null;
ResultSet rs = null; ResultSet rs = null;
try { try {
String sql = String.format("SELECT `password`, `pwtype` FROM `%s` WHERE `id` = ?", xAuth.getPlugin().getDatabaseController().getTable(Table.ACCOUNT)); String sql = String.format("SELECT `password`, `pwtype` FROM `%s` WHERE `id` = ?", xAuth.getPlugin().getDatabaseController().getTable(DatabaseTables.ACCOUNT));
ps = conn.prepareStatement(sql); ps = conn.prepareStatement(sql);
ps.setInt(1, accountId); ps.setInt(1, accountId);
rs = ps.executeQuery(); rs = ps.executeQuery();

View File

@ -300,16 +300,19 @@ public class SharedFileInputStream extends BufferedInputStream
private int read1(byte[] b, int off, int len) throws IOException { private int read1(byte[] b, int off, int len) throws IOException {
int avail = count - pos; int avail = count - pos;
if (avail <= 0) { if (avail <= 0) {
/*
if (false) { if (false) {
/* If the requested length is at least as large as the buffer, and /* If the requested length is at least as large as the buffer, and
if there is no mark/reset activity, do not bother to copy the if there is no mark/reset activity, do not bother to copy the
bytes into the local buffer. In this way buffered streams will bytes into the local buffer. In this way buffered streams will
cascade harmlessly. */ cascade harmlessly. */ /*
if (len >= buf.length && markpos < 0) { if (len >= buf.length && markpos < 0) {
// XXX - seek, update bufpos - how? // XXX - seek, update bufpos - how?
return in.read(b, off, len); return in.read(b, off, len);
} }
} }*/
fill(); fill();
avail = count - pos; avail = count - pos;
if (avail <= 0) return -1; if (avail <= 0) return -1;