Plugin crashes server with no proper error message

Discussion in 'Plugin Development' started by Fedmand, Jan 26, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    Fedmand

    I made this cool minigame plugin and everytime more than 2 people play it crashes the whole server and leaves nothing but this message:
    "26.01 13:50:58 [Server] INFO [13:50:58 INFO]: Trying to import queue-1390765221534-97.sql ..."

    The minigame involves:
    • Flaming arrows (being removed as soon as they hit)
    • Jetpacks
    • Spawn locations
    • Respawning
    • Scoreboard points
    • Xp bar
    • Minigame stuff (arrays and hashmaps etc)
    Don't know what else to say really :( Do you guys have any idea what the problem could be?
     
  2. Offline

    werter318

    We need code in order to help you.
     
  3. Offline

    Monkey_Swag

    Show us your entire code (ik it can be a pain) and we miggt be able to help.
     
  4. Offline

    Fedmand

    My source (part1):
    Sorry about messy code I'm still a noob ;D
    Show Spoiler

    Main Class:
    Show Spoiler

    Code:java
    1. package hi.fedmand;
    2.  
    3. import java.util.ArrayList;
    4. import java.util.HashMap;
    5.  
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Location;
    9. import org.bukkit.Material;
    10. import org.bukkit.Sound;
    11. import org.bukkit.World;
    12. import org.bukkit.command.Command;
    13. import org.bukkit.command.CommandSender;
    14. import org.bukkit.entity.Player;
    15. import org.bukkit.event.Listener;
    16. import org.bukkit.inventory.ItemStack;
    17. import org.bukkit.inventory.meta.ItemMeta;
    18. import org.bukkit.plugin.java.JavaPlugin;
    19. import org.bukkit.scoreboard.DisplaySlot;
    20. import org.bukkit.scoreboard.Objective;
    21. import org.bukkit.scoreboard.Score;
    22. import org.bukkit.scoreboard.Scoreboard;
    23. import org.bukkit.scoreboard.ScoreboardManager;
    24.  
    25. public class Main extends JavaPlugin implements Listener {
    26.  
    27. public static HashMap<Player, Float> fuel = new HashMap<Player, Float>();
    28. public static HashMap<Player, Integer> kills = new HashMap<Player, Integer>();
    29. public static HashMap<Player, Integer> score = new HashMap<Player, Integer>();
    30. static ArrayList<Player> warn = new ArrayList<Player>();
    31. static ArrayList<Player> infinite = new ArrayList<Player>();
    32. static ArrayList<Player> superman = new ArrayList<Player>();
    33. static ArrayList<Player> powershot = new ArrayList<Player>();
    34. static ArrayList<Player> tripleshot = new ArrayList<Player>();
    35. static ArrayList<Player> died = new ArrayList<Player>();
    36. static ArrayList<Player> resistance = new ArrayList<Player>();
    37. final static ArrayList<Player> invinsibility = new ArrayList<Player>();
    38. static String prefix = (ChatColor.GRAY + "[" + ChatColor.GOLD + "Jetpacks"
    39. + ChatColor.GRAY + "] ");
    40. static HashMap<Player, Location> playerSpawns = new HashMap<Player, Location>();
    41. static ArrayList<Location> spawns = new ArrayList<Location>();
    42.  
    43. static boolean running = false;
    44. static boolean safetime = false;
    45. static boolean countdown = false;
    46. static ArrayList<Player> waiters = new ArrayList<Player>();
    47. static ArrayList<Player> players0 = new ArrayList<Player>();
    48. static ArrayList<Player> joiners = new ArrayList<Player>();
    49.  
    50. static int seconds = -1;
    51.  
    52. static ItemStack flint = new ItemStack(Material.FLINT_AND_STEEL, 1);
    53. ItemMeta flintMeta = flint.getItemMeta();
    54. static ItemStack jetpack = new ItemStack(Material.CHAINMAIL_CHESTPLATE, 1);
    55. ItemMeta jetMeta = jetpack.getItemMeta();
    56.  
    57. static ScoreboardManager manager;
    58. static Scoreboard board;
    59. static Objective o;
    60. static Score s;
    61. static String firstTo20 = ("" + ChatColor.GOLD + ChatColor.BOLD + "First to 20 kills win!");
    62.  
    63. static World world1;
    64. static World world;
    65. static Location lobby;
    66. static Location spectate;
    67. static Location spawn1;
    68. static Location spawn2;
    69. static Location spawn3;
    70. static Location spawn4;
    71. static Location spawn5;
    72. static Location spawn6;
    73. static Location spawn7;
    74. static Location spawn8;
    75. static Location spawn9;
    76. static Location spawn10;
    77.  
    78. /*
    79.   * World world1 = Bukkit.getWorld(getConfig().getString("hubWorld")); World
    80.   * world = Bukkit.getWorld(getConfig().getString("arenasWorld")); Location
    81.   * lobby = new Location(world, getConfig().getDouble("lobbyx"),
    82.   * getConfig().getDouble("lobbyy"), getConfig().getDouble("lobbyz"));
    83.   * Location spectate = new Location(world, getConfig().getDouble(
    84.   * "16:1spectatex"), getConfig().getDouble("16:1spectatey"),
    85.   * getConfig().getDouble("16:1spectatez")); Location spawn1 = new
    86.   * Location(world, getConfig().getDouble("16:1spawn1x"),
    87.   * getConfig().getDouble("16:1spawn1y"), getConfig().getDouble(
    88.   * "16:1spawn1z")); Location spawn2 = new Location(world,
    89.   * getConfig().getDouble("16:1spawn2x"),
    90.   * getConfig().getDouble("16:1spawn2y"), getConfig().getDouble(
    91.   * "16:1spawn2z")); Location spawn3 = new Location(world,
    92.   * getConfig().getDouble("16:1spawn3x"),
    93.   * getConfig().getDouble("16:1spawn3y"), getConfig().getDouble(
    94.   * "16:1spawn3z")); Location spawn4 = new Location(world,
    95.   * getConfig().getDouble("16:1spawn4x"),
    96.   * getConfig().getDouble("16:1spawn4y"), getConfig().getDouble(
    97.   * "16:1spawn4z")); Location spawn5 = new Location(world,
    98.   * getConfig().getDouble("16:1spawn5x"),
    99.   * getConfig().getDouble("16:1spawn5y"), getConfig().getDouble(
    100.   * "16:1spawn5z")); Location spawn6 = new Location(world,
    101.   * getConfig().getDouble("16:1spawn6x"),
    102.   * getConfig().getDouble("16:1spawn6y"), getConfig().getDouble(
    103.   * "16:1spawn6z")); Location spawn7 = new Location(world,
    104.   * getConfig().getDouble("16:1spawn7x"),
    105.   * getConfig().getDouble("16:1spawn7y"), getConfig().getDouble(
    106.   * "16:1spawn7z")); Location spawn8 = new Location(world,
    107.   * getConfig().getDouble("16:1spawn8x"),
    108.   * getConfig().getDouble("16:1spawn8y"), getConfig().getDouble(
    109.   * "16:1spawn8z")); Location spawn9 = new Location(world,
    110.   * getConfig().getDouble("16:1spawn9x"),
    111.   * getConfig().getDouble("16:1spawn9y"), getConfig().getDouble(
    112.   * "16:1spawn9z")); Location spawn10 = new Location(world, getConfig()
    113.   * .getDouble("16:1spawn10x"), getConfig().getDouble("16:1spawn10y"),
    114.   * getConfig().getDouble("16:1spawn10z"));
    115.   */
    116.  
    117. public void onEnable() {
    118. this.getServer().getPluginManager().registerEvents(this, this);
    119. getConfig().options().copyDefaults(true);
    120. getServer().getPluginManager().registerEvents(new Listeners(), this);
    121. getServer().getPluginManager().registerEvents(new Flying(), this);
    122. getServer().getPluginManager().registerEvents(new Management(), this);
    123. getServer().getPluginManager().registerEvents(new Killstreaks(), this);
    124. world1 = Bukkit.getWorld("build");
    125. world = Bukkit.getWorld("Jetpack");
    126. lobby = new Location(world, -1305.5, 18, 1090.5);
    127. spectate = new Location(world, -1460.5, 69, 1146.5);
    128. spawn1 = new Location(world, -1451.5, 34, 1101.5);
    129. spawn2 = new Location(world, -1454.5, 77, 1147.5);
    130. spawn3 = new Location(world, -1466.5, 65, 1132.5);
    131. spawn4 = new Location(world, -1477.5, 56, 1147.5);
    132. spawn5 = new Location(world, -1469.5, 49, 1170.5);
    133. spawn6 = new Location(world, -1442.5, 46, 1123.5);
    134. spawn7 = new Location(world, -1436.5, 44, 1142.5);
    135. spawn8 = new Location(world, -1436.5, 62, 1128.5);
    136. spawn9 = new Location(world, -1472.5, 48, 1110.5);
    137.  
    138. spawn10 = new Location(world, -1440.5, 62, 1099.5);
    139. spawns.add(spawn1);
    140. spawns.add(spawn2);
    141. spawns.add(spawn3);
    142. spawns.add(spawn4);
    143. spawns.add(spawn5);
    144. spawns.add(spawn6);
    145. spawns.add(spawn7);
    146. spawns.add(spawn8);
    147. spawns.add(spawn9);
    148. spawns.add(spawn10);
    149. manager = Bukkit.getScoreboardManager();
    150. board = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
    151. o = board.registerNewObjective("Starting In:", "dummy");
    152. o.setDisplayName("" + ChatColor.WHITE + ChatColor.BOLD + "Welcome to "
    153. + ChatColor.GOLD + ChatColor.BOLD + "Jetpacks!");
    154. o.setDisplaySlot(DisplaySlot.SIDEBAR);
    155. s = o.getScore(Bukkit.getServer().getOfflinePlayer(
    156. ChatColor.GREEN + "Starting in:"));
    157. for (Player player : Bukkit.getOnlinePlayers()) {
    158. fuel.put(player, (float) 1);
    159. kills.put(player, 0);
    160. }
    161. Bukkit.getServer().getScheduler()
    162. .scheduleSyncRepeatingTask(this, new Runnable() {
    163. public void run() {
    164. if (seconds == 60) {
    165. for (Player players : waiters) {
    166. players.sendMessage(ChatColor.GREEN
    167. + "Game starting in 60 seconds!");
    168. }
    169. } else if (seconds == 30) {
    170. for (Player players : waiters) {
    171. players.sendMessage(ChatColor.GREEN
    172. + "Game starting in 30 seconds!");
    173. }
    174. } else if (seconds == 15) {
    175. for (Player players : waiters) {
    176. players.sendMessage(ChatColor.GREEN
    177. + "Game starting in 15 seconds!");
    178. }
    179. } else if (seconds == 10) {
    180. for (Player players : waiters) {
    181. players.sendMessage(ChatColor.GREEN
    182. + "Game starting in 10 seconds!");
    183. }
    184. } else if (seconds <= 5 && Main.seconds > 0) {
    185. for (Player players : waiters) {
    186. players.sendMessage(ChatColor.GREEN
    187. + "Game starting in " + seconds
    188. + " seconds!");
    189. }
    190. for (Player players : waiters) {
    191. players.playSound(players.getLocation(),
    192. Sound.CLICK, 10, 10);
    193. }
    194. } else if (seconds == 0) {
    195. for (Player players : waiters) {
    196. players.sendMessage("" + ChatColor.GRAY
    197. + ChatColor.BOLD
    198. + "The game has begun.");
    199. }
    200. safetime = true;
    201. running = true;
    202. countdown = false;
    203. o.setDisplayName(firstTo20);
    204. board.resetScores(Bukkit
    205. .getOfflinePlayer(ChatColor.GREEN
    206. + "Starting in:"));
    207. for (Player players : waiters) {
    208. players.setScoreboard(board);
    209. players0.add(players);
    210. players.playSound(players.getLocation(),
    211. Sound.LEVEL_UP, 10, 10);
    212. players.setLevel(0);
    213. players.setExp(1);
    214. Location loc = spawns.get(0);
    215. playerSpawns.put(players, loc);
    216. players.teleport(loc);
    217. players.getInventory().clear();
    218. spawns.remove(loc);
    219. spawns.add(loc);
    220. players.sendMessage(prefix
    221. + ChatColor.YELLOW
    222. + "You will be able to move and shoot in 10 seconds!");
    223. s = o.getScore(players);
    224. s.setScore(1);
    225. s.setScore(0);
    226. }
    227. new Thread() {
    228. @Override
    229. public void run() {
    230. try {
    231. Thread.sleep(5000);
    232. for (Player players : waiters) {
    233. players.sendMessage(prefix
    234. + ChatColor.YELLOW
    235. + ChatColor.BOLD + "5");
    236. }
    237. Thread.sleep(1000);
    238. for (Player players : waiters) {
    239. players.sendMessage(prefix
    240. + ChatColor.YELLOW
    241. + ChatColor.BOLD + "4");
    242. }
    243. Thread.sleep(1000);
    244. for (Player players : waiters) {
    245. players.sendMessage(prefix
    246. + ChatColor.YELLOW
    247. + ChatColor.BOLD + "3");
    248. }
    249. Thread.sleep(1000);
    250. for (Player players : waiters) {
    251. players.sendMessage(prefix
    252. + ChatColor.YELLOW
    253. + ChatColor.BOLD + "2");
    254. }
    255. Thread.sleep(1000);
    256. for (Player players : waiters) {
    257. players.sendMessage(prefix
    258. + ChatColor.YELLOW
    259. + ChatColor.BOLD + "1");
    260. }
    261. Thread.sleep(1000);
    262. flintMeta.setDisplayName(""
    263. + ChatColor.GRAY
    264. + ChatColor.BOLD
    265. + "Jetpack Controller");
    266. ArrayList<String> lore = new ArrayList<String>();
    267. lore.add(ChatColor.DARK_AQUA
    268. + "RIGHT-CLICK "
    269. + ChatColor.DARK_PURPLE
    270. + "to shoot fire");
    271. lore.add(ChatColor.GREEN
    272. + "LEFT-CLICK "
    273. + ChatColor.DARK_PURPLE
    274. + "to use your jetpack");
    275. flintMeta.setLore(lore);
    276. flint.setItemMeta(flintMeta);
    277. jetMeta.setDisplayName(""
    278. + ChatColor.GOLD
    279. + ChatColor.BOLD + "Jetpack");
    280. jetpack.setItemMeta(jetMeta);
    281. for (Player players : waiters) {
    282. players.sendMessage(prefix
    283. + ChatColor.GREEN
    284. + ChatColor.BOLD
    285. + "THE GAME HAS STARTED!");
    286. }
    287. for (Player players : players0) {
    288. score.put(players, 0);
    289. players.getInventory().addItem(
    290. flint);
    291. players.getInventory()
    292. .setChestplate(jetpack);
    293. }
    294. safetime = false;
    295. } catch (InterruptedException ex) {
    296. }
    297. }
    298. }.start();
    299. }
    300. if (seconds <= 60 && seconds >= 1) {
    301. for (Player players : waiters) {
    302. players.setLevel(seconds);
    303. s.setScore(seconds);
    304. }
    305. }
    306. if (seconds == -100) {
    307. seconds = -1;
    308. }
    309. seconds--;
    310. if (!waiters.isEmpty()) {
    311. for (Player players : waiters) {
    312. players.setHealth(20);
    313. players.setExhaustion(0);
    314. }
    315. }
    316. }
    317. }, 0, 20);
    318. saveConfig();
    319. }
    320.  
    321. public boolean onCommand(CommandSender sender, Command command,
    322. String label, String[] args) {
    323. final Player player = (Player) sender;
    324. if (args.length == 0) {
    325. if (label.equalsIgnoreCase("jetpacks")) {
    326. player.sendMessage(Main.prefix + ChatColor.AQUA
    327. + "That aint how you use those fancy commands.");
    328. player.sendMessage(Main.prefix + ChatColor.GREEN
    329. + "/jetpacks join - to join the game");
    330. player.sendMessage(Main.prefix + ChatColor.GREEN
    331. + "/jetpacks leave - to leave the game");
    332. }
    333. } else if (args.length == 1) {
    334. if (label.equalsIgnoreCase("jetpacks")) {
    335. if (args[0].equalsIgnoreCase("join")) {
    336. Main.joiners.add(player);
    337. player.teleport(world1.getSpawnLocation());
    338. player.teleport(world.getSpawnLocation());
    339. new Thread() {
    340. @Override
    341. public void run() {
    342. try {
    343. Thread.sleep(10000);
    344. Main.joiners.remove(player);
    345. } catch (InterruptedException ex) {
    346. }
    347. }
    348. }.start();
    349. } else if (args[0].equalsIgnoreCase("leave")) {
    350. if (player.getWorld() == world
    351. && Main.waiters.contains(player)) {
    352. player.teleport(world1.getSpawnLocation());
    353. player.sendMessage(Main.prefix + ChatColor.GRAY
    354. + "You have left the game.");
    355. Main.joiners.remove(player);
    356. } else {
    357. player.sendMessage(prefix + ChatColor.RED
    358. + "You are not in a game.");
    359. }
    360. }
    361. } else {
    362. player.sendMessage(Main.prefix + ChatColor.AQUA
    363. + "That aint how you use those fancy commands.");
    364. player.sendMessage(Main.prefix + ChatColor.GREEN
    365. + "/jetpacks join - to join the game");
    366. player.sendMessage(Main.prefix + ChatColor.GREEN
    367. + "/jetpacks leave - to leave the game");
    368. }
    369. } else {
    370. if (label.equalsIgnoreCase("jetpacks")) {
    371. player.sendMessage(Main.prefix + ChatColor.AQUA
    372. + "That aint how you use those fancy commands.");
    373. player.sendMessage(Main.prefix + ChatColor.GREEN
    374. + "/jetpacks join - to join the game");
    375. player.sendMessage(Main.prefix + ChatColor.GREEN
    376. + "/jetpacks leave - to leave the game");
    377. }
    378. }
    379. return false;
    380.  
    381. }
    382.  
    383. }
    384.  

    Class "Flying and Flamethrower"
    Show Spoiler

    Code:java
    1. package hi.fedmand;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.Effect;
    5. import org.bukkit.Material;
    6. import org.bukkit.Sound;
    7. import org.bukkit.World;
    8. import org.bukkit.entity.Arrow;
    9. import org.bukkit.entity.Player;
    10. import org.bukkit.event.EventHandler;
    11. import org.bukkit.event.Listener;
    12. import org.bukkit.event.block.Action;
    13. import org.bukkit.event.player.PlayerInteractEvent;
    14. import org.bukkit.util.Vector;
    15.  
    16. public class Flying implements Listener {
    17.  
    18. @EventHandler
    19. void Interract(final PlayerInteractEvent event) {
    20. final Player player = event.getPlayer();
    21. if (Main.waiters.contains(player)
    22. && player.getItemInHand().getType()
    23. .equals(Material.FLINT_AND_STEEL)) {
    24. if (event.getClickedBlock() != null
    25. && event.getClickedBlock().getType()
    26. .equals(Material.COAL_BLOCK)
    27. && event.getClickedBlock().getRelative(0, 1, 0).getType()
    28. .equals(Material.REDSTONE_TORCH_ON)) {
    29. if (Main.fuel.get(player) < 0.61) {
    30. event.getClickedBlock().getRelative(0, 1, 0)
    31. .setType(Material.AIR);
    32. event.getClickedBlock().setType(Material.AIR);
    33. event.getPlayer().setExp((float) 1);
    34. Main.fuel.put(event.getPlayer(), (float) 1);
    35. player.sendMessage(Main.prefix + ChatColor.GREEN
    36. + "You fuel tank has been refilled!");
    37. player.playSound(player.getLocation(), Sound.CLICK, 1, -10);
    38. Main.warn.remove(player);
    39. new Thread() {
    40. @Override
    41. public void run() {
    42. try {
    43. Thread.sleep(20000);
    44. event.getClickedBlock().setType(
    45. Material.COAL_BLOCK);
    46. event.getClickedBlock().getRelative(0, 1, 0)
    47. .setType(Material.REDSTONE_TORCH_ON);
    48. } catch (InterruptedException ex) {
    49. }
    50. }
    51. }.start();
    52. } else {
    53. player.sendMessage(Main.prefix + ChatColor.DARK_GREEN
    54. + "You still have plenty of fuel!");
    55. player.playSound(player.getLocation(), Sound.ANVIL_BREAK,
    56. 1, -10);
    57. }
    58. } else if (event.getAction().equals(Action.RIGHT_CLICK_AIR)
    59. | event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
    60. if (Main.fuel.get(player) > 0) {
    61. Arrow f = player.launchProjectile(Arrow.class);
    62. player.playSound(player.getLocation(),
    63. Sound.FIREWORK_LAUNCH, 1, -10);
    64. if (Main.powershot.contains(player)) {
    65. f.setVelocity(player.getLocation().getDirection()
    66. .multiply(7.5));
    67. } else {
    68. f.setVelocity(player.getLocation().getDirection()
    69. .multiply(5));
    70. }
    71. f.setFireTicks(1000);
    72. f.setShooter(player);
    73. if (Main.tripleshot.contains(player)) {
    74. new Thread() {
    75. @Override
    76. public void run() {
    77. try {
    78. Thread.sleep(400);
    79. Arrow f = player
    80. .launchProjectile(Arrow.class);
    81. player.playSound(player.getLocation(),
    82. Sound.FIREWORK_LAUNCH, 1, -10);
    83. if (Main.powershot.contains(player)) {
    84. f.setVelocity(player.getLocation()
    85. .getDirection().multiply(7.5));
    86. } else {
    87. f.setVelocity(player.getLocation()
    88. .getDirection().multiply(5));
    89. }
    90. f.setFireTicks(1000);
    91. f.setShooter(player);
    92. Thread.sleep(400);
    93. Arrow f0 = player
    94. .launchProjectile(Arrow.class);
    95. player.playSound(player.getLocation(),
    96. Sound.FIREWORK_LAUNCH, 1, -10);
    97. if (Main.powershot.contains(player)) {
    98. f0.setVelocity(player.getLocation()
    99. .getDirection().multiply(7.5));
    100. } else {
    101. f0.setVelocity(player.getLocation()
    102. .getDirection().multiply(5));
    103. }
    104. f0.setFireTicks(1000);
    105. f0.setShooter(player);
    106. } catch (InterruptedException ex) {
    107. }
    108. }
    109. }.start();
    110. }
    111. if (!Main.infinite.contains(player)) {
    112. Main.fuel.put(player,
    113. (float) (Main.fuel.get(player) - 0.01));
    114. player.setExp(Main.fuel.get(player));
    115. }
    116. if (Main.fuel.get(player) < 0.26
    117. && !Main.warn.contains(player)) {
    118. Main.warn.add(player);
    119. player.sendMessage(ChatColor.DARK_GRAY + "["
    120. + ChatColor.DARK_RED + "WARNING"
    121. + ChatColor.DARK_GRAY + "]" + ChatColor.RED
    122. + " You are low on fuel!");
    123. player.playSound(player.getLocation(),
    124. Sound.GHAST_SCREAM2, 5, -10);
    125. }
    126. } else {
    127. World world = player.getWorld();
    128. world.playEffect(player.getLocation(), Effect.SMOKE, 10);
    129. player.playSound(player.getLocation(), Sound.BAT_HURT, 1,
    130. -10);
    131. }
    132. } else if (event.getAction().equals(Action.LEFT_CLICK_BLOCK)
    133. | event.getAction().equals(Action.LEFT_CLICK_AIR)) {
    134. if (Main.fuel.get(player) > 0) {
    135. World world = player.getWorld();
    136. world.playEffect(player.getLocation(),
    137. Effect.MOBSPAWNER_FLAMES, 5);
    138. world.playEffect(player.getLocation(), Effect.SMOKE, 10);
    139. player.playSound(player.getLocation(), Sound.FIRE_IGNITE,
    140. 10, 10);
    141. Vector v;
    142. if (Main.superman.contains(player)) {
    143. v = player.getLocation().getDirection().multiply(1)
    144. .setY(1.5);
    145. } else {
    146. v = player.getLocation().getDirection().multiply(1)
    147. .setY(1);
    148. }
    149. player.setVelocity(v);
    150. if (!Main.infinite.contains(player)) {
    151. Main.fuel.put(player,
    152. (float) (Main.fuel.get(player) - 0.05));
    153. player.setExp(Main.fuel.get(player));
    154. }
    155. if (Main.fuel.get(player) < 0.26
    156. && !Main.warn.contains(player)) {
    157. Main.warn.add(player);
    158. player.sendMessage(ChatColor.DARK_GRAY + "["
    159. + ChatColor.DARK_RED + "WARNING"
    160. + ChatColor.DARK_GRAY + "]" + ChatColor.RED
    161. + " You are low on fuel!");
    162. player.playSound(player.getLocation(),
    163. Sound.GHAST_SCREAM2, 5, -10);
    164. }
    165. } else {
    166. World world = player.getWorld();
    167. world.playEffect(player.getLocation(), Effect.SMOKE, 10);
    168. player.playSound(player.getLocation(), Sound.BAT_HURT, 1,
    169. -10);
    170. }
    171. }
    172. event.setCancelled(true);
    173. }
    174. }
    175. }
    176.  
     
  5. Offline

    xize

    Fedmand

    never use Thread.sleep() in your Flying and Flamethrower class most events aren't in a seperated thread, this will freezes your server you could better use a scheduler instead.
     
  6. Offline

    Fedmand

    Sound interesting actually :eek: I always had a feeking the timings were the problem actually since the crashes started ever since I added those... Thanks alot, I'll try that tommorow!
     
Thread Status:
Not open for further replies.

Share This Page