- Some minor fixes and improvements
This commit is contained in:
@@ -49,7 +49,7 @@ public class Core {
|
||||
*/
|
||||
public static String getl(String id, String lang) {
|
||||
String val = AnuraCore.getInstance().lang.get(id, lang);
|
||||
if (val == null || val.equals("")) {
|
||||
if (val == null || val.isEmpty()) {
|
||||
val = AnuraCore.getInstance().lang.get(id, "en");
|
||||
}
|
||||
return val;
|
||||
@@ -125,10 +125,13 @@ public class Core {
|
||||
Player p = (Player) P;
|
||||
if (!Core.cachedPlayerLanguage.containsKey(p)) {
|
||||
ResultSet rs = AnuraCore.sql.querySelect("SELECT lang FROM players WHERE uuid = '" + p.getUniqueId().toString() + "'");
|
||||
|
||||
rs.first();
|
||||
Core.cachedPlayerLanguage.put(p, rs.getString("lang"));
|
||||
return rs.getString("lang");
|
||||
if (!rs.next()) {
|
||||
//This is a weird bug
|
||||
Core.cachedPlayerLanguage.put(p, "de");
|
||||
return "de";
|
||||
}
|
||||
Core.cachedPlayerLanguage.put(p, rs.getString("lang"));
|
||||
return rs.getString("lang");
|
||||
|
||||
} else {
|
||||
return Core.cachedPlayerLanguage.get(p);
|
||||
@@ -198,7 +201,7 @@ public class Core {
|
||||
if (md instanceof Stairs) {
|
||||
Stairs s = (Stairs) md;
|
||||
Location loc = getMainClass().sittingBlocks.get(P).getRelative(s.getFacing()).getLocation();
|
||||
Entity a = (Entity) getMainClass().sittingPlayer.get(P);
|
||||
Entity a = getMainClass().sittingPlayer.get(P);
|
||||
P.teleport(loc);
|
||||
a.remove();
|
||||
if (!noRemove) {
|
||||
@@ -219,7 +222,7 @@ public class Core {
|
||||
Errors.reportException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Makes a player stand up
|
||||
* @param P The player to end the sitting of
|
||||
@@ -255,7 +258,7 @@ public class Core {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the level class object
|
||||
* @return The level class object
|
||||
@@ -263,7 +266,7 @@ public class Core {
|
||||
public static Level getLevel() {
|
||||
return getMainClass().level;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Moves a given player to the hub
|
||||
* @param P The player to move to the hub
|
||||
@@ -279,7 +282,7 @@ public class Core {
|
||||
Errors.reportException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current set spawn
|
||||
* @return The spawn for this server
|
||||
@@ -290,13 +293,13 @@ public class Core {
|
||||
World w = Bukkit.getWorld(c.getString("spawn.world"));
|
||||
if (w != null) {
|
||||
loc = new Location(Bukkit.getWorld(c.getString("spawn.world")), c.getDouble("spawn.X"), c.getDouble("spawn.Y"), c.getDouble("spawn.Z"), (float) c.getDouble("spawn.yaw"), (float) c.getDouble("spawn.pitch"));
|
||||
}
|
||||
}
|
||||
if (loc == null) {
|
||||
loc = Bukkit.getWorlds().get(0).getSpawnLocation();
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Teleports a player to the current set serverspawn
|
||||
* Get serverspawn with {@link getServerSpawn()}
|
||||
|
||||
@@ -5,7 +5,6 @@ import de.anura.core.API.Errors;
|
||||
import de.anura.core.API.Inventories;
|
||||
import de.anura.core.API.Level;
|
||||
import de.anura.core.API.Tools;
|
||||
import static de.anura.core.AnuraCore.sql;
|
||||
import de.anura.core.commands.*;
|
||||
import de.anura.core.events.*;
|
||||
import java.sql.ResultSet;
|
||||
@@ -88,7 +87,7 @@ public class Setup {
|
||||
Core.getMainClass().signs = new Signs();
|
||||
Core.getMainClass().level = new Level();
|
||||
RealTime.setup();
|
||||
ResultSet rs = sql.querySelect("SELECT id, X, Y, Z, world, type, waitTime FROM corePots");
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT id, X, Y, Z, world, type, waitTime FROM corePots");
|
||||
while (rs.next()) {
|
||||
World w = Bukkit.getWorld(rs.getString("world"));
|
||||
if (w == null) {
|
||||
@@ -133,7 +132,7 @@ public class Setup {
|
||||
}
|
||||
|
||||
}, 5, 5);
|
||||
ResultSet rs = sql.querySelect("SELECT world, X, Y, Z FROM coreStairs WHERE server = '" + Core.getMainClass().getConfig().getString("server-name") + "'");
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT world, X, Y, Z FROM coreStairs WHERE server = '" + Core.getMainClass().getConfig().getString("server-name") + "'");
|
||||
while (rs.next()) {
|
||||
World w = Bukkit.getWorld(rs.getString("world"));
|
||||
if (w == null) {
|
||||
@@ -144,7 +143,7 @@ public class Setup {
|
||||
Core.getMainClass().sittableBlocks.add(l.getBlock());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
|
||||
@Override
|
||||
@@ -301,7 +300,7 @@ public class Setup {
|
||||
Errors.reportException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void setupXPBattle() {
|
||||
Scoreboard s = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||
if (s.getObjective("xpBattleStart") == null) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashSet;
|
||||
import javax.imageio.ImageIO;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@@ -52,11 +53,13 @@ public class TeamCommands implements CommandExecutor {
|
||||
Core.statusMsg(sender, "wrong_args_count", false);
|
||||
return false;
|
||||
}
|
||||
Block b = P.getTargetBlock(null, 100);
|
||||
HashSet<Material> transparent = new HashSet<>();
|
||||
transparent.add(Material.AIR);
|
||||
Block b = P.getTargetBlock(transparent, 100);
|
||||
if (b.getType().equals(Material.COMMAND)) {
|
||||
String command = "";
|
||||
for (String arg : args) {
|
||||
if (!command.equals("")) {
|
||||
if (!command.isEmpty()) {
|
||||
command += " ";
|
||||
}
|
||||
command += arg;
|
||||
@@ -79,12 +82,14 @@ public class TeamCommands implements CommandExecutor {
|
||||
Core.statusMsg(sender, "wrong_args_count", false);
|
||||
return false;
|
||||
}
|
||||
Block b = P.getTargetBlock(null, 100);
|
||||
HashSet<Material> transparent = new HashSet<>();
|
||||
transparent.add(Material.AIR);
|
||||
Block b = P.getTargetBlock(transparent, 100);
|
||||
if (b.getType().equals(Material.COMMAND)) {
|
||||
CommandBlock cb = (CommandBlock) b.getState();
|
||||
String command = "";
|
||||
for (String arg : args) {
|
||||
if (!command.equals("")) {
|
||||
if (!command.isEmpty()) {
|
||||
command += " ";
|
||||
}
|
||||
command += arg;
|
||||
@@ -136,7 +141,7 @@ public class TeamCommands implements CommandExecutor {
|
||||
return true;
|
||||
}
|
||||
Core.getMySql().queryUpdate("INSERT INTO corePots(X,Y,Z,world,url,name,money,type) VALUES('" + l.getBlockX() + "','" + l.getBlockY() + "','" + l.getBlockZ() + "','" + l.getWorld().getName() + "','http://mc-anura.de','" + args[0] + "','1','0')");
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT id FROM corePots WHERE X = '" + l.getBlockX() + "' AND Y = '" + l.getBlockY() + "' AND Z = '" + l.getBlockZ() + "' AND world = '" + l.getWorld().getName() + "'");
|
||||
ResultSet rs = Core.getMySql().querySelect("SELECT id FROM corePots WHERE X = '" + l.getBlockX() + "' AND Y = '" + l.getBlockY() + "' AND Z = '" + l.getBlockZ() + "' AND world = '" + l.getWorld().getName() + "'");
|
||||
rs.first();
|
||||
Core.getMainClass().flowerPots.put(rs.getInt("id"), new Location(l.getWorld(), l.getBlockX(), l.getBlockY(), l.getBlockZ()));
|
||||
l.getBlock().setType(Material.BROWN_MUSHROOM);
|
||||
@@ -210,7 +215,7 @@ public class TeamCommands implements CommandExecutor {
|
||||
w.setTime(2000);
|
||||
w.setThundering(false);
|
||||
w.setStorm(false);
|
||||
Core.getMainClass().tools.sendStatusMsg(sender, "Sun!", true);
|
||||
Tools.sendStatusMsg(sender, "Sun!", true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user