Implement new error handler and bug reporting system
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package de.anura.core;
|
||||
|
||||
import de.anura.core.API.Core;
|
||||
import de.anura.core.API.Errors;
|
||||
import de.anura.core.API.Inventories;
|
||||
import de.anura.core.API.Level;
|
||||
import de.anura.core.API.Tools;
|
||||
@@ -31,7 +32,6 @@ import de.anura.core.events.PlayerTeleport;
|
||||
import de.anura.core.events.SignChange;
|
||||
import de.anura.core.events.WeatherChange;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@@ -53,7 +53,7 @@ public class Setup {
|
||||
Core.getMainClass().getConfig().addDefault("no-hunger", false);
|
||||
Core.getMainClass().getConfig().addDefault("no-rain", false);
|
||||
Core.getMainClass().getConfig().addDefault("enable-leaves-decay", true);
|
||||
Core.getMainClass().getConfig().addDefault("server-name", "lobby");
|
||||
Core.getMainClass().getConfig().addDefault("server-name", "none");
|
||||
Core.getMainClass().getConfig().addDefault("allow-stairs-sit", false);
|
||||
Core.getMainClass().getConfig().addDefault("disable-mushroom-spread", false);
|
||||
Core.getMainClass().getConfig().addDefault("on-join-to-spawn", false);
|
||||
@@ -88,17 +88,17 @@ public class Setup {
|
||||
}
|
||||
|
||||
public static void setupClasses() {
|
||||
Core.getMainClass().lang = new LanguageSupport(Core.getMainClass());
|
||||
new Inventories(Core.getMainClass());
|
||||
setupInventories();
|
||||
Core.getMainClass().perms = new Permissions(Core.getMainClass());
|
||||
Core.getMainClass().tools = new Tools();
|
||||
Core.getMainClass().pots = new FlowerPots();
|
||||
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");
|
||||
try {
|
||||
Core.getMainClass().lang = new LanguageSupport(Core.getMainClass());
|
||||
new Inventories(Core.getMainClass());
|
||||
setupInventories();
|
||||
Core.getMainClass().perms = new Permissions(Core.getMainClass());
|
||||
Core.getMainClass().tools = new Tools();
|
||||
Core.getMainClass().pots = new FlowerPots();
|
||||
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");
|
||||
while (rs.next()) {
|
||||
World w = Bukkit.getWorld(rs.getString("world"));
|
||||
if (w == null) {
|
||||
@@ -111,39 +111,39 @@ public class Setup {
|
||||
}
|
||||
l.getBlock().setType(Material.BROWN_MUSHROOM);
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println("Error whilst trying to setup flower pots");
|
||||
Core.getMainClass().features = new Features();
|
||||
Core.getMainClass().features.updateFeaturesAll();
|
||||
} catch (Throwable e) {
|
||||
Errors.reportException(e);
|
||||
}
|
||||
Core.getMainClass().features = new Features();
|
||||
Core.getMainClass().features.updateFeaturesAll();
|
||||
}
|
||||
|
||||
public static void setupTasks() {
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
try {
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player P : Core.getMainClass().golfPower.keySet()) {
|
||||
if (Core.getMainClass().releaseGolf.get(P)) {
|
||||
P.setExp(0);
|
||||
int power = Core.getMainClass().golfPower.get(P);
|
||||
Entity i = Core.getMainClass().golfBall.get(P);
|
||||
if (i != null && i.isValid()) {
|
||||
Vector v = P.getLocation().getDirection();
|
||||
v.multiply(new Vector(power / 10 + 1, 1.2, power / 10 + 1));
|
||||
i.setVelocity(v);
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player P : Core.getMainClass().golfPower.keySet()) {
|
||||
if (Core.getMainClass().releaseGolf.get(P)) {
|
||||
P.setExp(0);
|
||||
int power = Core.getMainClass().golfPower.get(P);
|
||||
Entity i = Core.getMainClass().golfBall.get(P);
|
||||
if (i != null && i.isValid()) {
|
||||
Vector v = P.getLocation().getDirection();
|
||||
v.multiply(new Vector(power / 10 + 1, 1.2, power / 10 + 1));
|
||||
i.setVelocity(v);
|
||||
}
|
||||
Core.getMainClass().golfPower.remove(P);
|
||||
Core.getMainClass().releaseGolf.remove(P);
|
||||
} else {
|
||||
Core.getMainClass().releaseGolf.put(P, true);
|
||||
}
|
||||
Core.getMainClass().golfPower.remove(P);
|
||||
Core.getMainClass().releaseGolf.remove(P);
|
||||
} else {
|
||||
Core.getMainClass().releaseGolf.put(P, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 5, 5);
|
||||
ResultSet rs = sql.querySelect("SELECT world, X, Y, Z FROM coreStairs WHERE server = '" + Core.getMainClass().getConfig().getString("server-name") + "'");
|
||||
try {
|
||||
}, 5, 5);
|
||||
ResultSet rs = sql.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) {
|
||||
@@ -154,30 +154,30 @@ public class Setup {
|
||||
Core.getMainClass().sittableBlocks.add(l.getBlock());
|
||||
}
|
||||
}
|
||||
} catch (SQLException ex) {
|
||||
System.err.println("Error whilst trying to setup stairs");
|
||||
}
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : AnuraCore.getInstance().sittingPlayer.keySet()) {
|
||||
Location loc = AnuraCore.getInstance().sittingPlayer.get(p).getLocation();
|
||||
Arrow a = loc.getWorld().spawnArrow(loc, new Vector(0, 0, 0), 0, 0);
|
||||
a.setPassenger(p);
|
||||
AnuraCore.getInstance().sittingPlayer.get(p).remove();
|
||||
AnuraCore.getInstance().sittingPlayer.put(p, a);
|
||||
@Override
|
||||
public void run() {
|
||||
for (Player p : AnuraCore.getInstance().sittingPlayer.keySet()) {
|
||||
Location loc = AnuraCore.getInstance().sittingPlayer.get(p).getLocation();
|
||||
Arrow a = loc.getWorld().spawnArrow(loc, new Vector(0, 0, 0), 0, 0);
|
||||
a.setPassenger(p);
|
||||
AnuraCore.getInstance().sittingPlayer.get(p).remove();
|
||||
AnuraCore.getInstance().sittingPlayer.put(p, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}, 600, 600);
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AnuraCore.getInstance().signs.updateServerSigns();
|
||||
}
|
||||
}, 20 * 5, 20 * 5);
|
||||
}, 600, 600);
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Core.getMainClass(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
AnuraCore.getInstance().signs.updateServerSigns();
|
||||
}
|
||||
}, 20 * 5, 20 * 5);
|
||||
} catch (Throwable e) {
|
||||
Errors.reportException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setupCommands() {
|
||||
@@ -218,69 +218,73 @@ public class Setup {
|
||||
}
|
||||
|
||||
private static void setupInventories() {
|
||||
Inventories.registerInventory("GAMEMODES", "select_gamemode_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("GAMEMODES", 0, Inventories.buildItems(Material.RED_ROSE, "inv_lobby_tps", ChatColor.DARK_GREEN));
|
||||
Inventories.putIntoInventory("GAMEMODES", 2, Inventories.buildItems(Material.CARROT_STICK, "inv_lobby_minigames", ChatColor.BLUE));
|
||||
Inventories.putIntoInventory("GAMEMODES", 4, Inventories.buildItems(Material.IRON_PICKAXE, "inv_lobby_freebuild", ChatColor.GOLD));
|
||||
try {
|
||||
Inventories.registerInventory("GAMEMODES", "select_gamemode_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("GAMEMODES", 0, Inventories.buildItems(Material.RED_ROSE, "inv_lobby_tps", ChatColor.DARK_GREEN));
|
||||
Inventories.putIntoInventory("GAMEMODES", 2, Inventories.buildItems(Material.CARROT_STICK, "inv_lobby_minigames", ChatColor.BLUE));
|
||||
Inventories.putIntoInventory("GAMEMODES", 4, Inventories.buildItems(Material.IRON_PICKAXE, "inv_lobby_freebuild", ChatColor.GOLD));
|
||||
|
||||
Inventories.registerAction("GAMEMODES", 0, Inventories.Action.OPEN_INV, "LOBBY");
|
||||
Inventories.registerAction("GAMEMODES", 2, Inventories.Action.OPEN_INV, "MINIGAMES");
|
||||
Inventories.registerAction("GAMEMODES", 4, Inventories.Action.SERVER, "freebuild");
|
||||
Inventories.registerAction("GAMEMODES", 0, Inventories.Action.OPEN_INV, "LOBBY");
|
||||
Inventories.registerAction("GAMEMODES", 2, Inventories.Action.OPEN_INV, "MINIGAMES");
|
||||
Inventories.registerAction("GAMEMODES", 4, Inventories.Action.SERVER, "freebuild");
|
||||
|
||||
Inventories.registerInventory("MINIGAMES", "minigames_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("MINIGAMES", 0, Inventories.buildItems(Material.BOW, "inv_lobby_smash", ChatColor.GREEN, ChatColor.BLUE, "smash_description_1", "smash_description_2", "smash_description_3", "smash_description_4", "smash_description_5", "smash_description_6"));
|
||||
Inventories.putIntoInventory("MINIGAMES", 2, Inventories.buildItems(Material.WHEAT, "inv_lobby_farmfight", ChatColor.YELLOW));
|
||||
Inventories.putIntoInventory("MINIGAMES", 4, Inventories.buildItems(Material.FIREWORK, "inv_lobby_rocketmatch", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("MINIGAMES", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
||||
Inventories.registerInventory("MINIGAMES", "minigames_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("MINIGAMES", 0, Inventories.buildItems(Material.BOW, "inv_lobby_smash", ChatColor.GREEN, ChatColor.BLUE, "smash_description_1", "smash_description_2", "smash_description_3", "smash_description_4", "smash_description_5", "smash_description_6"));
|
||||
Inventories.putIntoInventory("MINIGAMES", 2, Inventories.buildItems(Material.WHEAT, "inv_lobby_farmfight", ChatColor.YELLOW));
|
||||
Inventories.putIntoInventory("MINIGAMES", 4, Inventories.buildItems(Material.FIREWORK, "inv_lobby_rocketmatch", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("MINIGAMES", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
||||
|
||||
Inventories.registerAction("MINIGAMES", 0, Inventories.Action.SERVER, "smash");
|
||||
Inventories.registerAction("MINIGAMES", 2, Inventories.Action.SERVER, "farmfight");
|
||||
Inventories.registerAction("MINIGAMES", 4, Inventories.Action.SERVER, "rocketmatch");
|
||||
Inventories.registerAction("MINIGAMES", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
Inventories.registerAction("MINIGAMES", 0, Inventories.Action.SERVER, "smash");
|
||||
Inventories.registerAction("MINIGAMES", 2, Inventories.Action.SERVER, "farmfight");
|
||||
Inventories.registerAction("MINIGAMES", 4, Inventories.Action.SERVER, "rocketmatch");
|
||||
Inventories.registerAction("MINIGAMES", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
|
||||
Inventories.registerInventory("LOBBY", "lobby_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("LOBBY", 0, Inventories.buildItems(Material.SLIME_BALL, "inv_lobby_jump", ChatColor.DARK_GREEN));
|
||||
Inventories.putIntoInventory("LOBBY", 1, Inventories.buildItems(Material.WATER_BUCKET, "inv_lobby_swim", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("LOBBY", 3, Inventories.buildItems(Material.EXP_BOTTLE, "inv_lobby_xpbattle", ChatColor.GREEN));
|
||||
Inventories.putIntoInventory("LOBBY", 4, Inventories.buildItems(Material.POTION, "inv_lobby_pool", ChatColor.BLUE));
|
||||
Inventories.putIntoInventory("LOBBY", 6, Inventories.buildItems(Material.WOOD_DOOR, "tp_to_spawn", ChatColor.GOLD));
|
||||
Inventories.putIntoInventory("LOBBY", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
||||
Inventories.registerInventory("LOBBY", "lobby_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("LOBBY", 0, Inventories.buildItems(Material.SLIME_BALL, "inv_lobby_jump", ChatColor.DARK_GREEN));
|
||||
Inventories.putIntoInventory("LOBBY", 1, Inventories.buildItems(Material.WATER_BUCKET, "inv_lobby_swim", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("LOBBY", 3, Inventories.buildItems(Material.EXP_BOTTLE, "inv_lobby_xpbattle", ChatColor.GREEN));
|
||||
Inventories.putIntoInventory("LOBBY", 4, Inventories.buildItems(Material.POTION, "inv_lobby_pool", ChatColor.BLUE));
|
||||
Inventories.putIntoInventory("LOBBY", 6, Inventories.buildItems(Material.WOOD_DOOR, "tp_to_spawn", ChatColor.GOLD));
|
||||
Inventories.putIntoInventory("LOBBY", 8, Inventories.buildItems(Material.ENDER_PEARL, "inv_lobby_back", ChatColor.YELLOW));
|
||||
|
||||
Inventories.registerAction("LOBBY", 0, Inventories.Action.COMMAND, "jumpinv");
|
||||
Inventories.registerAction("LOBBY", 1, Inventories.Action.TELEPORT, new Location(Bukkit.getWorld("lobby"), -288, 32, -1714));
|
||||
Inventories.registerAction("LOBBY", 3, Inventories.Action.COMMAND, "toggleminigame xpbattle");
|
||||
Inventories.registerAction("LOBBY", 1, Inventories.Action.COMMAND, "toggleminigame pool");
|
||||
Inventories.registerAction("LOBBY", 6, Inventories.Action.COMMAND, "spawn");
|
||||
Inventories.registerAction("LOBBY", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
Inventories.registerAction("LOBBY", 0, Inventories.Action.COMMAND, "jumpinv");
|
||||
Inventories.registerAction("LOBBY", 1, Inventories.Action.TELEPORT, new Location(Bukkit.getWorld("lobby"), -288, 32, -1714));
|
||||
Inventories.registerAction("LOBBY", 3, Inventories.Action.COMMAND, "toggleminigame xpbattle");
|
||||
Inventories.registerAction("LOBBY", 1, Inventories.Action.COMMAND, "toggleminigame pool");
|
||||
Inventories.registerAction("LOBBY", 6, Inventories.Action.COMMAND, "spawn");
|
||||
Inventories.registerAction("LOBBY", 8, Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
|
||||
Inventories.registerInventory("FEATURES", "features_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("FEATURES", 2, Inventories.buildItems(Material.LEATHER_BOOTS, "inv_lobby_double_jump", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("FEATURES", 4, Inventories.buildItems(Material.BOAT, "inv_lobby_boat", ChatColor.DARK_AQUA));
|
||||
Inventories.registerAction("FEATURES", 2, Inventories.Action.COMMAND, "toggledbljump");
|
||||
Inventories.registerAction("FEATURES", 4, Inventories.Action.COMMAND, "toggleboat");
|
||||
Inventories.registerInventory("FEATURES", "features_inv", ChatColor.DARK_BLUE);
|
||||
Inventories.putIntoInventory("FEATURES", 2, Inventories.buildItems(Material.LEATHER_BOOTS, "inv_lobby_double_jump", ChatColor.DARK_AQUA));
|
||||
Inventories.putIntoInventory("FEATURES", 4, Inventories.buildItems(Material.BOAT, "inv_lobby_boat", ChatColor.DARK_AQUA));
|
||||
Inventories.registerAction("FEATURES", 2, Inventories.Action.COMMAND, "toggledbljump");
|
||||
Inventories.registerAction("FEATURES", 4, Inventories.Action.COMMAND, "toggleboat");
|
||||
|
||||
Inventories.registerInventory("LANGUAGE", "Select language", ChatColor.DARK_BLUE);
|
||||
int i = 0;
|
||||
for (String langu : Core.getMainClass().lang.languages.keySet()) {
|
||||
Inventories.putIntoInventory("LANGUAGE", i, Inventories.buildItems(Material.BOOK_AND_QUILL, Core.getMainClass().lang.languages.get(langu), ChatColor.DARK_GREEN, ChatColor.GOLD, "set_lang_to", Core.getMainClass().lang.languages.get(langu)));
|
||||
Inventories.registerAction("LANGUAGE", i, Inventories.Action.LANGUAGE, langu);
|
||||
i++;
|
||||
Inventories.registerInventory("LANGUAGE", "Select language", ChatColor.DARK_BLUE);
|
||||
int i = 0;
|
||||
for (String langu : Core.getMainClass().lang.languages.keySet()) {
|
||||
Inventories.putIntoInventory("LANGUAGE", i, Inventories.buildItems(Material.BOOK_AND_QUILL, Core.getMainClass().lang.languages.get(langu), ChatColor.DARK_GREEN, ChatColor.GOLD, "set_lang_to", Core.getMainClass().lang.languages.get(langu)));
|
||||
Inventories.registerAction("LANGUAGE", i, Inventories.Action.LANGUAGE, langu);
|
||||
i++;
|
||||
}
|
||||
|
||||
Inventories.buildInvItem("COMPASS", Material.COMPASS, "select_game", ChatColor.DARK_AQUA);
|
||||
Inventories.buildInvItem("SIGN", Material.SIGN, "Change language", ChatColor.DARK_GREEN);
|
||||
Inventories.buildInvItem("CHARGE", Material.FIREBALL, "features_item", ChatColor.BLUE);
|
||||
Inventories.buildInvItem("DOOR", Material.WOOD_DOOR, "tp_to_spawn", ChatColor.YELLOW);
|
||||
Inventories.buildInvItem("EYE", Material.EYE_OF_ENDER, "inv_to_lobby", ChatColor.YELLOW);
|
||||
if (Core.getMainClass().getConfig().getString("server-name").equals("lobby")) {
|
||||
Inventories.setItemInPlayerInv("COMPASS", 0);
|
||||
Inventories.setItemInPlayerInv("SIGN", 1);
|
||||
Inventories.setItemInPlayerInv("DOOR", 8);
|
||||
}
|
||||
Inventories.registerItemAction("COMPASS", Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
Inventories.registerItemAction("SIGN", Inventories.Action.OPEN_INV, "LANGUAGE");
|
||||
Inventories.registerItemAction("CHARGE", Inventories.Action.OPEN_INV, "FEATURES");
|
||||
Inventories.registerItemAction("DOOR", Inventories.Action.COMMAND, "spawn");
|
||||
Inventories.registerItemAction("EYE", Inventories.Action.SERVER, "lobby");
|
||||
} catch (Throwable e) {
|
||||
Errors.reportException(e);
|
||||
}
|
||||
|
||||
Inventories.buildInvItem("COMPASS", Material.COMPASS, "select_game", ChatColor.DARK_AQUA);
|
||||
Inventories.buildInvItem("SIGN", Material.SIGN, "Change language", ChatColor.DARK_GREEN);
|
||||
Inventories.buildInvItem("CHARGE", Material.FIREBALL, "features_item", ChatColor.BLUE);
|
||||
Inventories.buildInvItem("DOOR", Material.WOOD_DOOR, "tp_to_spawn", ChatColor.YELLOW);
|
||||
Inventories.buildInvItem("EYE", Material.EYE_OF_ENDER, "inv_to_lobby", ChatColor.YELLOW);
|
||||
if (Core.getMainClass().getConfig().getString("server-name").equals("lobby")) {
|
||||
Inventories.setItemInPlayerInv("COMPASS", 0);
|
||||
Inventories.setItemInPlayerInv("SIGN", 1);
|
||||
Inventories.setItemInPlayerInv("DOOR", 8);
|
||||
}
|
||||
Inventories.registerItemAction("COMPASS", Inventories.Action.OPEN_INV, "GAMEMODES");
|
||||
Inventories.registerItemAction("SIGN", Inventories.Action.OPEN_INV, "LANGUAGE");
|
||||
Inventories.registerItemAction("CHARGE", Inventories.Action.OPEN_INV, "FEATURES");
|
||||
Inventories.registerItemAction("DOOR", Inventories.Action.COMMAND, "spawn");
|
||||
Inventories.registerItemAction("EYE", Inventories.Action.SERVER, "lobby");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user