2016-04-03 50 views
0
public void run() { 
    if(spleggEnabled == 3){ 
     if(player.isBlocking()){ 
      player.sendMessage(ChatColor.GREEN + "Projected Splegg!"); 
      WitherSkull head = (WitherSkull) ((ProjectileSource) player).launchProjectile(WitherSkull.class); 
      BlockIterator iterator = new BlockIterator(event.getEntity().getWorld(), event.getEntity().getLocation().toVector(), event.getEntity().getVelocity().normalize(), 0.0D, 4); 
     } 
     if(player.isDead()){ 
        spleggEnabled = 0; 
     } 

的錯誤是每個event.getEntity(),且誤差event cannot be resolvedBukkit錯誤:事件不能得到解決

任何想法?

+0

此代碼是什麼?它有什麼方法? – bcsb1001

+0

@ bcsb1001編輯後顯示完整的代碼 –

+0

那麼'run()'方法似乎不在'Listener'中,那麼你期望'event'是什麼?它是一些領域?它甚至在什麼階層? – bcsb1001

回答

1

它看起來像是event未定義。

如果您不確定event.getEntity()是什麼,請嘗試在代碼中將其替換爲headplayer

如果你知道它是什麼和它做什麼,讓您的聽衆訪問的event(在課堂上把它定義爲public static Event event並設置它在你的聽衆。)

顯然你從網上偷了一些代碼,而無需一個線索就是它做了什麼。下一次,閱讀整個論壇/博客/維基文章,而不是盲目複製。

相關問題