Extremely weird exception?

Discussion in 'Plugin Development' started by xTrollxDudex, Feb 17, 2014.

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

    xTrollxDudex

    Error:
    Code:
    java.lang.NoClassDefFoundError: org/bukkit/projectiles/ProjectileSource
            at com.gmail.woodyc40.battledome.BattleDome.loadListeners(BattleDome.jav
    a:104)
            at com.gmail.woodyc40.battledome.BattleDome.onEnable(BattleDome.java:43)
     
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:217)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader
    .java:457)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage
    r.java:381)
            at org.bukkit.craftbukkit.v1_6_R3.CraftServer.loadPlugin(CraftServer.jav
    a:282)
            at org.bukkit.craftbukkit.v1_6_R3.CraftServer.enablePlugins(CraftServer.
    java:264)
            at net.minecraft.server.v1_6_R3.MinecraftServer.l(MinecraftServer.java:3
    15)
            at net.minecraft.server.v1_6_R3.MinecraftServer.f(MinecraftServer.java:2
    92)
            at net.minecraft.server.v1_6_R3.MinecraftServer.a(MinecraftServer.java:2
    52)
            at net.minecraft.server.v1_6_R3.DedicatedServer.init(DedicatedServer.jav
    a:152)
            at net.minecraft.server.v1_6_R3.MinecraftServer.run(MinecraftServer.java
    :393)
            at net.minecraft.server.v1_6_R3.ThreadServerApplication.run(SourceFile:5
    83)
    Caused by: java.lang.ClassNotFoundException: org.bukkit.projectiles.ProjectileSo
    urce
            at org.bukkit.plugin.java.PluginClassLoader.findClass0(PluginClassLoader
    .java:70)
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.
    java:53)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            ... 13 more
    Code:
    Code:java
    1. package com.gmail.woodyc40.battledome;
    2.  
    3. import com.gmail.woodyc40.battledome.commands.AdminCommand;
    4. import com.gmail.woodyc40.battledome.commands.GameCommand;
    5. import com.gmail.woodyc40.battledome.commands.ModCommand;
    6. import com.gmail.woodyc40.battledome.commands.PlayerCommand;
    7. import com.gmail.woodyc40.battledome.handlers.CommandHandler;
    8. import com.gmail.woodyc40.battledome.handlers.FileHandler;
    9. import com.gmail.woodyc40.battledome.listeners.GameListener;
    10. import com.gmail.woodyc40.battledome.listeners.MoveListener;
    11. import com.gmail.woodyc40.battledome.listeners.SetupListener;
    12. import com.gmail.woodyc40.battledome.runnables.RunnableQueue;
    13. import com.gmail.woodyc40.battledome.util.ArenaList;
    14. import com.gmail.woodyc40.battledome.util.InvTools;
    15. import org.bukkit.Bukkit;
    16. import org.bukkit.configuration.ConfigurationSection;
    17. import org.bukkit.configuration.file.FileConfiguration;
    18. import org.bukkit.configuration.file.YamlConfiguration;
    19. import org.bukkit.inventory.Inventory;
    20. import org.bukkit.inventory.ItemStack;
    21. import org.bukkit.plugin.PluginManager;
    22. import org.bukkit.plugin.java.JavaPlugin;
    23.  
    24. import java.io.File;
    25. import java.io.IOException;
    26. import java.util.Map;
    27. import java.util.Set;
    28.  
    29.  
    30. public class BattleDome extends JavaPlugin {
    31.  
    32. private FileConfiguration data = null;
    33.  
    34. @Override
    35. public void onEnable() {
    36. if (getServer().getPluginManager().getPlugin("TagAPI") == null) {
    37. getLogger().severe("This plugin depends on a plugin not found: TagAPI; Shutting down!");
    38. setEnabled(false);
    39. return;
    40. }
    41.  
    42. loadCommands();
    43. loadListeners();
    44.  
    45. FileHandler fh = new FileHandler(this);
    46. fh.save();
    47.  
    48. this.data = new YamlConfiguration();
    49. try {
    50. startup();
    51. } catch (NullPointerException x) {
    52. getLogger().severe("The deadspawn has not been set. Remeber to set this!");
    53. }
    54.  
    55. BattleManager bm = new BattleManager(this);
    56. bm.loadGames();
    57. }
    58.  
    59. @Override
    60. public void onDisable() {
    61. Bukkit.getScheduler().cancelAllTasks();
    62. Bukkit.getScheduler().cancelTasks(this);
    63.  
    64. FileHandler.getFh().save();
    65.  
    66. for (Arena a : ArenaList.arenas) {
    67. RunnableQueue.cancelAllTasks(a);
    68. }
    69.  
    70. shutdown();
    71. }
    72.  
    73. void loadCommands() {
    74. getCommand("bd").setExecutor(new CommandHandler());
    75.  
    76. CommandHandler.register("join", new PlayerCommand());
    77. CommandHandler.register("leave", new PlayerCommand());
    78. CommandHandler.register("vote", new PlayerCommand());
    79. CommandHandler.register("list", new PlayerCommand());
    80.  
    81. CommandHandler.register("create", new AdminCommand());
    82. CommandHandler.register("remove", new AdminCommand());
    83. CommandHandler.register("lobbyspawn", new AdminCommand());
    84. CommandHandler.register("dmspawn", new AdminCommand());
    85. CommandHandler.register("deadspawn", new AdminCommand());
    86.  
    87. CommandHandler.register("enable", new ModCommand());
    88. CommandHandler.register("disable", new ModCommand());
    89. CommandHandler.register("start", new ModCommand());
    90. CommandHandler.register("stop", new ModCommand());
    91. CommandHandler.register("dm", new ModCommand());
    92.  
    93. CommandHandler.register("surface", new GameCommand());
    94. CommandHandler.register("help", new GameCommand());
    95. CommandHandler.register("spectate", new GameCommand());
    96. CommandHandler.register("spawn", new GameCommand());
    97. CommandHandler.register("tp", new GameCommand());
    98. }
    99.  
    100. void loadListeners() {
    101. PluginManager pm = getServer().getPluginManager();
    102.  
    103. pm.registerEvents(new MoveListener(), this);
    104. pm.registerEvents(new GameListener(this), this);
    105. pm.registerEvents(new SetupListener(), this);
    106. }
    107.  
    108. void shutdown() throws NullPointerException {
    109. FileHandler.getFh().set(FileHandler.getFh().getSpawns(), "Deadspawn", FileHandler.serializeLoc(BattleManager.deadSpawn));
    110.  
    111. //for (Arena a : BattleManager.arenas) {
    112. // new ArenaWrapper(this, a).toFile();
    113. // getLogger().info("Unloaded arena " + a.getId());
    114. //}
    115.  
    116. //save inventory
    117. for (Map.Entry<String, ItemStack[]> e : BattleManager.inv.entrySet()) {
    118. Inventory inv = Bukkit.createInventory(null, 54);
    119. inv.setContents(e.getValue());
    120. data.set("Inventory." + e.getKey(), InvTools.serialize(inv));
    121. }
    122.  
    123. //save armor
    124. for (Map.Entry<String, ItemStack[]> e : BattleManager.armor.entrySet()) {
    125. Inventory inv = Bukkit.createInventory(null, 54);
    126. inv.setContents(e.getValue());
    127. data.set("Armor." + e.getKey(), InvTools.serialize(inv));
    128. }
    129. try {
    130. data.save("plugins/battledome/data.yml");
    131. } catch (IOException e1) {
    132. e1.printStackTrace();
    133. }
    134. }
    135.  
    136. void startup() throws NullPointerException {
    137. if (!getDataFolder().exists()) {
    138. getDataFolder().mkdir();
    139. }
    140.  
    141. if (!new File("plugins/battledome/data.yml").exists()) {
    142. try {
    143. new File(getDataFolder(), "data.yml").createNewFile();
    144. data.load("plugins/battledome/data.yml");
    145. } catch (Exception e) {
    146. e.printStackTrace();
    147. }
    148. }
    149.  
    150. //load inventory
    151. if (data != null) {
    152. BattleManager.deadSpawn = FileHandler.deserializeLoc(FileHandler.getFh().getSpawns().getString("Deadspawn"));
    153.  
    154. if (data.contains("Inventory")) {
    155. ConfigurationSection inventory = getConfig().getConfigurationSection("Inventory");
    156. if (inventory == null) {
    157. inventory = data.createSection("Inventory");
    158. }
    159.  
    160. Set<String> players = inventory.getKeys(false);
    161. for (String player : players) {
    162. BattleManager.inv.put(player, InvTools.deserialize(data.getString("Inventory." + player)).getContents());
    163. }
    164. inventory.set("Inventory", null);
    165.  
    166. //load armor
    167. if (data.contains("Armor")) {
    168. ConfigurationSection armor = getConfig().getConfigurationSection("Armor");
    169. if (armor == null) {
    170. armor = data.createSection("Armor");
    171. }
    172.  
    173. Set<String> player = armor.getKeys(false);
    174. for (String p : player) {
    175. BattleManager.armor.put(p, InvTools.deserialize(data.getString("Armor." + player)).getContents());
    176. }
    177. armor.set("Armor", null);
    178. }
    179. }
    180. }
    181. }
    182. }

    I have looked at the compiled jar with several decompilers and bytecode editors, and there is absolutely nothing that mentions
    "org/bukkit/projectiles/ProjectileSource"

    I am just stumped by this. I reinstalled craftbukkit three times, and it still doesn't work, meaning that it's not the jar that is the problem. I am using version 1.6.4-R0.1-20131015.235042-14.
     
  2. Offline

    MOMOTHEREAL

    Is your server using the same build?
    Also, try reinstalling Bukkit in your Libraries AND in your server.
     
  3. Offline

    baugh70

    To me it looks like a version problem. Server is definitely using 1.6 version, though I am unsure about your build that you are importing.
     
    xTrollxDudex likes this.
  4. Offline

    valon750

    As you're importing things from another plugin, won't you need that plugin in your plugins folder?
     
  5. Offline

    Derpiee

    Found this:
    http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html

    Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.
    The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

    I've never heard of this before. Hm, weird :confused:
     
  6. Offline

    xize

  7. Offline

    xTrollxDudex

    Thanks for the idea, I remember that I am using the latest 1.7.4 Jar in my pom. I'll see if I can debug that.
     
  8. Offline

    RawCode

    Derpiee you missed main part of oracle documentation...
    JVM NCDF error thrown at class construction stage if cinit or init failed.

    i will request source of class that allocated on 104th line (or somewhere close).
     
  9. Offline

    xTrollxDudex

    Code:java
    1. package com.gmail.woodyc40.battledome.listeners;
    2.  
    3. import com.gmail.woodyc40.battledome.Arena;
    4. import com.gmail.woodyc40.battledome.BattleManager;
    5. import com.gmail.woodyc40.battledome.handlers.ErrorHandler;
    6. import org.bukkit.Bukkit;
    7. import org.bukkit.ChatColor;
    8. import org.bukkit.Material;
    9. import org.bukkit.block.Sign;
    10. import org.bukkit.entity.Arrow;
    11. import org.bukkit.entity.Entity;
    12. import org.bukkit.entity.Player;
    13. import org.bukkit.event.EventHandler;
    14. import org.bukkit.event.Listener;
    15. import org.bukkit.event.block.*;
    16. import org.bukkit.event.entity.*;
    17. import org.bukkit.event.inventory.InventoryClickEvent;
    18. import org.bukkit.event.inventory.InventoryDragEvent;
    19. import org.bukkit.event.player.*;
    20. import org.bukkit.inventory.ItemStack;
    21. import org.bukkit.inventory.PlayerInventory;
    22. import org.bukkit.metadata.FixedMetadataValue;
    23. import org.bukkit.plugin.Plugin;
    24. import org.bukkit.util.Vector;
    25. import org.kitteh.tag.PlayerReceiveNameTagEvent;
    26.  
    27. public class GameListener implements Listener {
    28.  
    29. Plugin p;
    30. public GameListener(Plugin p) {
    31. this.p = p;
    32. }
    33.  
    34. @EventHandler
    35. public void onTarget(EntityTargetEvent e) {
    36. if (e.getTarget() instanceof Player && BattleManager.getBM().isSpectator((Player) e.getTarget())) {
    37. e.setCancelled(true);
    38. }
    39. }
    40.  
    41. @EventHandler
    42. public void onNameChange(PlayerReceiveNameTagEvent e) {
    43. if (BattleManager.getBM().arenas.isInGame(e.getNamedPlayer())) {
    44. e.setTag(BattleManager.getBM().getTeamColor(e.getNamedPlayer()) + e.getNamedPlayer().getName());
    45. }
    46. }
    47.  
    48. @EventHandler
    49. public void onChat(AsyncPlayerChatEvent e) {
    50. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    51. e.setCancelled(true);
    52. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "Chat is disabled for spectators.");
    53. }
    54. }
    55.  
    56. @EventHandler
    57. public void onClick(InventoryClickEvent e) {
    58. if (e.getInventory() instanceof PlayerInventory && e.getRawSlot() == 5) {
    59. e.setCancelled(true);
    60. ((Player) e.getView().getPlayer()).sendMessage(ErrorHandler.getEh().error + "You can't take this off your head!");
    61. }
    62. }
    63.  
    64. @EventHandler
    65. public void onDrag(InventoryDragEvent e) {
    66. if (!(e.getInventory() instanceof PlayerInventory)) {
    67. return;
    68. }
    69. for (int i : e.getRawSlots()) {
    70. if (i == 5) {
    71. e.setCancelled(true);
    72. ((Player) e.getView().getPlayer()).sendMessage(ErrorHandler.getEh().error + "You can't take this off your head!");
    73. }
    74. }
    75. }
    76.  
    77. @EventHandler
    78. public void onCommand(PlayerCommandPreprocessEvent e) {
    79. if (BattleManager.getBM().isCreating(e.getPlayer())) {
    80. return;
    81. }
    82.  
    83. if (BattleManager.getBM().arenas.isPlayer(e.getPlayer()) && !e.getMessage().contains("bd")) {
    84. e.setCancelled(true);
    85. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "You may only use BattleDome commands in game!");
    86. }
    87. }
    88.  
    89. @EventHandler
    90. public void onLeave(PlayerQuitEvent e) {
    91. Arena a = BattleManager.getBM().arenas.getPlayerArena(e.getPlayer());
    92.  
    93. if (a == null) {
    94. return;
    95. } else {
    96. BattleManager.getBM().removePlayer(e.getPlayer());
    97. if (BattleManager.getBM().arenas.getPlayerArena(e.getPlayer()).alivered.size() == 0 || BattleManager.getBM().arenas.getPlayerArena(e.getPlayer()).alivered.size() == 0) {
    98. BattleManager.getBM().arenas.getPlayerArena(e.getPlayer()).end();
    99. }
    100. }
    101. }
    102.  
    103. @EventHandler
    104. public void onSignClick(PlayerInteractEvent e) {
    105. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    106. e.setCancelled(true);
    107. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "You can't do that naughty!");
    108. return;
    109. }
    110.  
    111. if (e.getClickedBlock() != null && (e.getClickedBlock().getType().equals(Material.SIGN) || e.getClickedBlock().getType().equals(Material.SIGN_POST) || e.getClickedBlock().getType().equals(Material.WALL_SIGN))) {
    112. Sign s = (Sign) e.getClickedBlock().getState();
    113. int i = 0;
    114. try {
    115. i = Integer.parseInt(s.getLine(1));
    116. } catch (NumberFormatException ex) {
    117. e.setCancelled(true);
    118. }
    119. Arena a = BattleManager.getBM().arenas.getArena(i);
    120. if (a != null) {
    121. if (a.isJoinable())
    122. BattleManager.getBM().addPlayer(e.getPlayer(), i);
    123. else {
    124. if (a.getState().equals(Arena.Game.BUILD) || a.getState().equals(Arena.Game.DEATHMATCH) || a.getState().equals(Arena.Game.FIGHT))
    125. a.setSpectator(e.getPlayer());
    126. else if (a.getState().equals(Arena.Game.DISABLED) || a.getState().equals(Arena.Game.NOT_JOINABLE) || a.getState().equals(Arena.Game.UNKNOWN) || a.getState().equals(Arena.Game.STARTING) || a.getState().equals(Arena.Game.ENDGAME))
    127. e.setCancelled(true);
    128. }
    129. }
    130. }
    131. }
    132.  
    133. public void onDeath(PlayerDeathEvent e) {
    134. if (BattleManager.getBM().arenas.isInGame(e.getEntity())) {
    135. BattleManager.getBM().removePlayer(e.getEntity());
    136. BattleManager.getBM().arenas.getPlayerArena(e.getEntity()).setSpectator(e.getEntity());
    137. }
    138. }
    139.  
    140. // If a spectator wants to block an arrow...
    141. @EventHandler
    142. public void onPlayerHurtPlayer(EntityDamageEvent event) {
    143. Entity entityDamaged = event.getEntity();
    144. Entity entityDamager = null;
    145. if (event instanceof EntityDamageByEntityEvent) {
    146. entityDamager = ((EntityDamageByEntityEvent) event).getDamager();
    147. }
    148.  
    149. if (entityDamager != null) {
    150. if (entityDamager instanceof Arrow) {
    151. if (entityDamaged instanceof Player
    152. && ((Arrow) entityDamager).getShooter() instanceof Player) {
    153. Arrow arrow = (Arrow) entityDamager;
    154. Vector velocity = arrow.getVelocity();
    155. Player damaged = (Player) entityDamaged;
    156. Player shooter = (Player) arrow.getShooter();
    157. if (BattleManager.getBM().isSpectator(damaged)) {
    158. damaged.teleport(entityDamaged.getLocation().add(0, 5, 0));
    159. damaged.setFlying(true);
    160. Arrow newArrow = arrow.getWorld().spawn(arrow.getLocation(), Arrow.class);
    161. newArrow.setShooter(shooter);
    162. newArrow.setVelocity(velocity);
    163. newArrow.setBounce(false);
    164. event.setCancelled(true);
    165. arrow.remove();
    166.  
    167. return;
    168. }
    169. }
    170. }
    171. }
    172.  
    173. if (entityDamager != null && entityDamager instanceof Player && entityDamaged instanceof Player) {
    174. if (BattleManager.getBM().arenas.isOnTeam((Player) entityDamaged, (Player) entityDamager)) {
    175. ((Player) entityDamager).sendMessage(BattleManager.getBM().bd + "Don't kill your teammate!");
    176. event.setCancelled(true);
    177. } else {
    178. if (((Player) entityDamaged).getHealth() < 0.5) {
    179. if (BattleManager.getBM().arenas.getPlayerArena((Player) event.getEntity()).alivered.size() == 0 || BattleManager.getBM().arenas.getPlayerArena((Player) event.getEntity()).alivered.size() == 0) {
    180. BattleManager.getBM().arenas.getPlayerArena((Player) event.getEntity()).end();
    181. }
    182. event.setCancelled(true);
    183.  
    184. for (ItemStack i : ((Player) entityDamaged).getInventory().getContents()) {
    185. entityDamaged.getWorld().dropItem(entityDamaged.getLocation(), i);
    186. }
    187. for (ItemStack i : ((Player) entityDamaged).getInventory().getArmorContents()) {
    188. entityDamaged.getWorld().dropItem(entityDamaged.getLocation(), i);
    189. }
    190.  
    191. Arena a = BattleManager.getBM().arenas.getPlayerArena((Player) event.getEntity());
    192. a.setSpectator((Player) event.getEntity());
    193. }
    194. }
    195. }
    196.  
    197. if (entityDamager != null && entityDamager instanceof Player && BattleManager.getBM().isSpectator((Player) entityDamager)) {
    198. event.setCancelled(true);
    199. ((Player) entityDamager).sendMessage(ErrorHandler.getEh().error + "You can't do that naughty!");
    200. return;
    201. }
    202.  
    203. if (entityDamaged instanceof Player) {
    204. if (BattleManager.getBM().arenas.isInGame((Player) entityDamaged) && (!BattleManager.getBM().arenas.getPlayerArena((Player) entityDamaged).getState().equals(Arena.Game.FIGHT) || BattleManager.getBM().arenas.getPlayerArena((Player) entityDamaged).getState().equals(Arena.Game.LOBBY))) {
    205. event.setCancelled(true);
    206. }
    207. }
    208. }
    209.  
    210. @EventHandler
    211. public void onPickup(PlayerPickupItemEvent e) {
    212. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    213. e.setCancelled(true);
    214. }
    215. }
    216.  
    217. @EventHandler
    218. public void onBreak(BlockBreakEvent e) {
    219. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    220. e.setCancelled(true);
    221. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "You can't do that naughty!");
    222. return;
    223. }
    224.  
    225. Player p = e.getPlayer();
    226. Arena a = BattleManager.getBM().arenas.getPlayerArena(p);
    227.  
    228. if (BattleManager.getBM().arenas.isPlayer(e.getPlayer()) && a.getState().equals(Arena.Game.LOBBY)) {
    229. e.setCancelled(true);
    230. return;
    231. }
    232.  
    233. if (BattleManager.getBM().arenas.isInGame(e.getPlayer()) && e.getBlock().getType().equals(Material.GLASS)) {
    234. e.setCancelled(true);
    235. p.sendMessage(BattleManager.getBM().bd + "HEY! Stay within the dome!");
    236. return;
    237. }
    238.  
    239. if(BattleManager.getBM().arenas.isInGame(e.getPlayer()) && e.getBlock().getType().equals(Material.OBSIDIAN) && e.getBlock().hasMetadata(BattleManager.getBM().getTeamColor(e.getPlayer()))) {
    240. if(e.getBlock().getMetadata(BattleManager.getBM().getTeamColor(e.getPlayer())).equals(new FixedMetadataValue(this.p, BattleManager.getBM().getTeamColor(e.getPlayer())))) {
    241. return;
    242. }
    243. p.sendMessage(BattleManager.getBM().bd + "You have broken the obsidian.");
    244. }
    245.  
    246. if (!BattleManager.getBM().arenas.isInGame(p) || !ErrorHandler.getEh().validateArena(a.getId(), true, p)) {
    247. return;
    248. } else {
    249. a.getRollbackHandle().add(e.getBlock());
    250. }
    251. }
    252.  
    253. @EventHandler
    254. public void onPlace(BlockPlaceEvent e) {
    255. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    256. e.setCancelled(true);
    257. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "You can't do that naughty!");
    258. return;
    259. }
    260.  
    261. Player p = e.getPlayer();
    262. Arena a = BattleManager.getBM().arenas.getPlayerArena(p);
    263.  
    264. if ((!(BattleManager.getBM().arenas.isInGame(p))) || (ErrorHandler.getEh().validateArena(a.getId(), true, p)))
    265. return;
    266.  
    267. if(e.getBlock().getType().equals(Material.OBSIDIAN)) {
    268. e.getBlock().setMetadata(BattleManager.getBM().getTeamColor(e.getPlayer()), new FixedMetadataValue(this.p, BattleManager.getBM().getTeamColor(e.getPlayer())));
    269. }
    270.  
    271. if (e.getBlock().getType().equals(Material.GLASS)) {
    272. e.setCancelled(true);
    273. p.sendMessage(BattleManager.getBM().bd + "HEY! This block is not allowed to be placed!");
    274. return;
    275. }
    276.  
    277. a.getRollbackHandle().add(e.getBlockReplacedState().getBlock());
    278. }
    279.  
    280. @EventHandler
    281. public void onBurn(BlockBurnEvent e) {
    282. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    283.  
    284. if (a == null) {
    285. return;
    286. } else {
    287. a.getRollbackHandle().add(e.getBlock());
    288. }
    289. }
    290.  
    291. @EventHandler
    292. public void onFade(BlockFadeEvent e) {
    293. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    294.  
    295. if (a == null) {
    296. return;
    297. } else {
    298. a.getRollbackHandle().add(e.getBlock());
    299. }
    300. }
    301.  
    302. @EventHandler
    303. public void onForm(BlockFormEvent e) {
    304. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    305.  
    306. if (a == null) {
    307. return;
    308. } else {
    309. a.getRollbackHandle().add(e.getBlock());
    310. }
    311. }
    312.  
    313. /*
    314.   @EventHandler
    315.   public void onFlow(BlockFromToEvent e){
    316.   if (!e.getBlock().isLiquid()) return;
    317.   Arena a = BattleManager.getBM().getBlockArena(e.getBlock());
    318.   BlockState from = e.getBlock().getState();
    319.   BlockState to = e.getToBlock().getState();
    320.  
    321.   if(a == null){
    322.   return;
    323.   }
    324.  
    325. if(from.getType() == Material.STATIONARY_WATER || from.getType() == Material.WATER){
    326.   //a.getRollbackHandle().add(e.getToBlock());
    327. } else if(from.getType() == Material.STATIONARY_LAVA || from.getType() == Material.LAVA){
    328. a.getRollbackHandle().add(e.getToBlock());
    329. }
    330.  
    331.   if(from.getType() == Material.STATIONARY_WATER || from.getType() == Material.WATER){
    332.   //a.getRollbackHandle().add(e.getBlock());
    333.   }
    334.  
    335.   if(from.getType() == Material.STATIONARY_LAVA || from.getType() == Material.LAVA){
    336.   //a.getRollbackHandle().add(e.getBlock());
    337.   }
    338.  
    339.   if( from.getType().equals(Material.STATIONARY_LAVA) && to.getType().equals(Material.STATIONARY_WATER) ) {
    340.   Block newTo = e.getToBlock();
    341.   newTo.setType(Material.STONE);
    342.   //a.getRollbackHandle().add(newTo);
    343.   }
    344.  
    345. // If moving to air
    346.   Block b = e.getToBlock();
    347.   if(b.getType().equals(Material.AIR)){
    348.  
    349. // formed sat/lava = cobble
    350. // formed stationary_water = stone
    351.  
    352. // Are we moving from a water block
    353. Material fromM = e.getBlock().getType();
    354. if(fromM.equals(Material.WATER) || fromM.equals(Material.STATIONARY_WATER)){
    355. // Check all sides
    356. for(BlockFace face : BlockFace.values()){
    357. Block r = b.getRelative(face, 1);
    358. // If the side is lava, cobble shall form.
    359. // Note: if stationary_lava, stone will form. Seems to always be captured above.
    360. if(r.getType().equals(Material.LAVA) || r.getType().equals(Material.STATIONARY_LAVA)){
    361. r.setType(Material.COBBLESTONE);
    362. //a.getRollbackHandle().add(r);
    363. }
    364.  
    365.   }
    366.   }
    367.  
    368.  
    369. // Water flowing into lava forms obsidian or cobble
    370.   if ( from.getType().equals(Material.STATIONARY_WATER) && to.getType().equals(Material.STATIONARY_LAVA) ) {
    371.   BlockState lower = e.getToBlock().getRelative(BlockFace.DOWN).getState();
    372.   // Obsidian can form below
    373.   if( lower.getType().equals(Material.OBSIDIAN) ){
    374.   //a.getRollbackHandle().add(lower.getBlock());
    375.   }
    376.   }
    377.   }
    378.   }*/
    379.  
    380. @EventHandler
    381. public void onDecay(LeavesDecayEvent e) {
    382. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    383.  
    384. if (a == null) {
    385. return;
    386. } else {
    387. a.getRollbackHandle().add(e.getBlock());
    388. }
    389. }
    390.  
    391. @EventHandler
    392. public void onEntityForm(EntityChangeBlockEvent e) {
    393. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    394.  
    395. if (a == null) {
    396. return;
    397. } else {
    398. a.getRollbackHandle().add(e.getBlock());
    399. }
    400. }
    401.  
    402. @EventHandler
    403. public void onIgnite(BlockIgniteEvent e) {
    404. if (BattleManager.getBM().isSpectator(e.getPlayer())) {
    405. e.setCancelled(true);
    406. e.getPlayer().sendMessage(ErrorHandler.getEh().error + "You can't do that naughty!");
    407. return;
    408. }
    409.  
    410. //TODO Remove the fire instead of the block
    411. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    412.  
    413. if (a == null) {
    414. return;
    415. } else {
    416. a.getRollbackHandle().add(e.getBlock());
    417. }
    418. }
    419.  
    420. @EventHandler
    421. public void onPhysics(BlockPhysicsEvent e) {
    422. //TODO
    423. }
    424.  
    425. /*
    426.   public void onPistonExtend(BlockPistonExtendEvent e){
    427.  
    428. Block noPlayer = e.getBlock().getRelative( e.getDirection() ).getRelative( e.getDirection() ).getRelative(BlockFace.DOWN);
    429. for(Player pl : Bukkit.getOnlinePlayers()){
    430. Location loc = pl.getLocation();
    431. if( loc.getBlockX() == noPlayer.getX() && loc.getBlockY() == noPlayer.getY() && loc.getBlockZ() == noPlayer.getZ() ){
    432. pl.sendMessage(BattleManager.getBM().bd + "Server admins have been notified of a possible X-Ray from you");
    433.   notify(pl);
    434. break;
    435. }
    436. }
    437. List<Block> blocks = e.getBlocks();
    438. if(!blocks.isEmpty()){
    439. for( Block block : blocks){
    440.  
    441. if(block.getType().equals(Material.AIR)) continue;
    442.  
    443. // Pistons move blocks to the block next to them. If nothing is there it shows as air.
    444. // We should record the from coords, to coords, and block replaced, as well as the block moved.
    445. Prism.actionsRecorder.addToQueue( ActionFactory.create("block-shift", block, block.getRelative(event.getDirection()).getLocation(), "Piston") );
    446. }
    447. }
    448. }
    449.  
    450.  
    451. @EventHandler
    452. public void onPistonRetract(BlockPistonRetractEvent event){
    453. if(!event.isSticky()) return;
    454. Block block = event.getBlock();
    455. if(block.getType().equals(Material.AIR)) return;
    456. Prism.actionsRecorder.addToQueue( ActionFactory.create("block-shift", event.getRetractLocation().getBlock(), block.getRelative(event.getDirection()).getLocation(), "Piston") );
    457. } */
    458.  
    459. @EventHandler
    460. public void onSpread(BlockSpreadEvent e) {
    461. Arena a = BattleManager.getBM().arenas.getBlockArena(e.getBlock());
    462.  
    463. if (a == null) {
    464. return;
    465. } else {
    466. a.getRollbackHandle().add(e.getBlock());
    467. }
    468. }
    469.  
    470. public void notify(Player p) {
    471. for (Player pl : Bukkit.getOnlinePlayers()) {
    472. if (pl.isOp()) {
    473. pl.sendMessage(ErrorHandler.getEh().error + ChatColor.GREEN + p.getName() + ChatColor.DARK_PURPLE + " has been suspected of X-Raying! This does not mean he is, but has a strong possibility.");
    474. }
    475. }
    476. }
    477. }

    I know its horrible, but this was code back then.

    baugh70
    I know that I can edit my other post, but that will mess up the formatting.

    Apparently, it still won't work :(

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  10. Offline

    xize

    xTrollxDudex
    are you 100% sure theres no direct call like Entity entity = something.getShooter() without a cast?
    ProjectileSource interface is getting from the getShooter() method however I think the interface is or removed or nullified for some reason in one of the latest updates however casts still seems to work, I had the the same type stacktrace that the ProjectileSource cannot be found but when I casted for example LivingEntity it whas gone.
     
  11. Offline

    xTrollxDudex

    xize
    Line 152 and 153, bith have getShooter, but they are casted? Which cast? The shooter?
     
  12. Offline

    xize

    xTrollxDudex
    hmm this makes me confused the only thing I could think of is that getShooter() returns null unless there should be a difference between the way its casted which I actually doubt.

    try changing the cast in the if check to:
    && (Arrow) entitydamager.getShooter() instanceof Player) {

    but when I look to https://github.com/Bukkit/Bukkit/blob/master/src/main/java/org/bukkit/entity/Projectile.java I see thats it actually called in the imports so even when using a cast I don't think it change.
     
  13. Offline

    xTrollxDudex

    xize
    Doesn't work D:

    Bump.
     
  14. Offline

    Cirno

    The thing that I don't get is why this error is even happening in the first place; you have no calls to ProjectileSource (at least, I can't tell when skimming), and the fact that Java is executed line-by-line. (e.g you won't get NullPointerException until it actually runs that line). Try compiling against CraftBukkit/Bukkit (whichever you aren't compiling against)?
     
  15. Offline

    RawCode

    i found issue but looks like my post removed (or not added):

    Code compiled vs 172 wont run on 162 due different classchain of interfaces.
    also i posted source code of ProjectileSource with hurge list of other classes involved
     
Thread Status:
Not open for further replies.

Share This Page