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