Some bug fixes
This commit is contained in:
@@ -126,7 +126,7 @@ public class Core {
|
||||
Player p = (Player) P;
|
||||
if (!Core.cachedPlayerLanguage.containsKey(p)) {
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT lang FROM players WHERE uuid = '" + p.getUniqueId().toString() + "'");
|
||||
if (!rs.next()) {
|
||||
if (rs == null || !rs.next()) {
|
||||
//This is a weird bug
|
||||
Core.cachedPlayerLanguage.put(p, "de");
|
||||
return "de";
|
||||
|
||||
@@ -4,12 +4,14 @@ import java.sql.ResultSet;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Errors {
|
||||
|
||||
/**
|
||||
* Reports an exception to the database
|
||||
*
|
||||
* @param exc A Throwable to get the error data from
|
||||
* @param info Some additional info
|
||||
*/
|
||||
@@ -19,6 +21,7 @@ public class Errors {
|
||||
exc.printStackTrace();
|
||||
return;
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(Core.getMainClass(), () -> {
|
||||
try {
|
||||
String message = exc.getLocalizedMessage();
|
||||
String name = exc.getClass().toString();
|
||||
@@ -43,10 +46,12 @@ public class Errors {
|
||||
System.err.println("FATAL ERROR: Error handler generated an exception!! (" + ex.getLocalizedMessage() + ")");
|
||||
ex.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports an exception to the database
|
||||
*
|
||||
* @param exc A Throwable to get the error from
|
||||
*/
|
||||
public static void reportException(Throwable exc) {
|
||||
@@ -55,9 +60,11 @@ public class Errors {
|
||||
|
||||
/**
|
||||
* Method to report a bug
|
||||
*
|
||||
* @param P The reporter
|
||||
* @param msg A message from the reporter
|
||||
* @param data An array of error entries generated by {@link make(String, Object)}
|
||||
* @param data An array of error entries generated by
|
||||
* {@link make(String, Object)}
|
||||
*/
|
||||
public static void bugReport(Player P, String msg, Entry<String, Object>... data) {
|
||||
UUID uuid = P.getUniqueId();
|
||||
@@ -70,6 +77,7 @@ public class Errors {
|
||||
|
||||
/**
|
||||
* Generates an error entry
|
||||
*
|
||||
* @param key The key for this object
|
||||
* @param value Any object to use as value
|
||||
* @return The error entry to give to
|
||||
|
||||
@@ -132,7 +132,7 @@ public class Setup {
|
||||
Data.sittingPlayer.put(p, a);
|
||||
}
|
||||
}, 600, 600);
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(Core.getMainClass(), AnuraCore.signs::updateServerSigns, 20 * 5, 20 * 5);
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), AnuraCore.signs::updateServerSigns, 20 * 5, 20 * 5);
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new VillagerTask(), 20, 20);
|
||||
} catch (Throwable e) {
|
||||
Errors.reportException(e);
|
||||
|
||||
@@ -24,8 +24,7 @@ public class Signs implements PluginMessageListener {
|
||||
return;
|
||||
}
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT DISTINCT value FROM coreWarpSigns WHERE type = 'server' AND server = '" + Core.getMainClass().getConfig().getString("server-name") + "'");
|
||||
rs.last();
|
||||
if (rs.getRow() == 0) {
|
||||
if (rs == null || !rs.first()) {
|
||||
return;
|
||||
}
|
||||
rs.beforeFirst();
|
||||
@@ -105,7 +104,8 @@ public class Signs implements PluginMessageListener {
|
||||
|
||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(message));
|
||||
String subchannel = in.readUTF();
|
||||
if (subchannel.equals("PlayerCount")) {
|
||||
switch (subchannel) {
|
||||
case "PlayerCount":
|
||||
String server = in.readUTF();
|
||||
int playercount = in.readInt();
|
||||
String sqlQ = "SELECT X,Y,Z,world FROM coreWarpSigns WHERE server = '" + Core.getMainClass().getConfig().getString("server-name") + "' AND type = 'server' AND value = '" + server + "'";
|
||||
@@ -113,8 +113,7 @@ public class Signs implements PluginMessageListener {
|
||||
rs.last();
|
||||
if (rs.getRow() == 0) {
|
||||
return;
|
||||
}
|
||||
rs.beforeFirst();
|
||||
} rs.beforeFirst();
|
||||
while (rs.next()) {
|
||||
Boolean remove = false;
|
||||
World w = Bukkit.getWorld(rs.getString("world"));
|
||||
@@ -157,10 +156,11 @@ public class Signs implements PluginMessageListener {
|
||||
}
|
||||
s.update();
|
||||
}
|
||||
}
|
||||
} else if (subchannel.equals("updatePermissions")) {
|
||||
} break;
|
||||
case "updatePermissions":
|
||||
AnuraCore.perms.reload();
|
||||
AnuraCore.perms.updateAllPlayers();
|
||||
break;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
Errors.reportException(e);
|
||||
|
||||
@@ -180,10 +180,15 @@ public class TeamCommands implements CommandExecutor {
|
||||
if (args.length != 1) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
if (Float.parseFloat(args[0]) >= 10 || Float.parseFloat(args[0]) < 0) {
|
||||
Core.statusMsg(P, "flyspeed_wrong_number", false);
|
||||
return true;
|
||||
}
|
||||
} catch (NumberFormatException ex) {
|
||||
Core.statusMsg(P, "flyspeed_wrong_number", false);
|
||||
return true;
|
||||
}
|
||||
P.setFlySpeed(Float.parseFloat(args[0]) / 10);
|
||||
Tools.sendStatusMsg(P, Core.getl("flyspeed_set_1", P) + " " + args[0] + Core.getl("flyspeed_set_2", P), true);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user