2016-07-24 1 views
0

ShopGUI + Pluginを購入または販売するプレイヤーが使用するとエラーが発生します。これはコンソールでエラーになります。プラグインShopGUI +: https://www.spigotmc.org/resources/shopgui.6515/エラーコンソール:http://pastebin.com/Q1Hjssfm助けてください。ありがとう!限り、あなたが提供NullPointerExceptionが行くようにコンソールでnullのスパムを修正するにはどうすればよいですか?

class: package com.andrewyunt.townygui.listeners; 
import com.andrewyunt.townygui.Menu; 
import com.andrewyunt.townygui.TownyGUI; 
import com.andrewyunt.townygui.utilities.CommandBuilder; 
import com.gmail.filoghost.hiddenstring.HiddenStringUtils; 
import org.bukkit.command.CommandSender; 
import org.bukkit.entity.Player; 
import org.bukkit.event.EventHandler; 
import org.bukkit.event.Listener; 
import org.bukkit.event.inventory.InventoryClickEvent; 
import org.bukkit.inventory.ItemStack; 
import org.bukkit.inventory.meta.ItemMeta; 
import java.util.List; 
import java.util.Set; 

public class InventoryListener implements Listener { 

@EventHandler 
public void onInventoryClick(InventoryClickEvent sukien) { 

    ItemStack item = sukien.getCurrentItem(); 

    Player player = (Player) sukien.getWhoClicked(); 

    if(!(sukien.getInventory().getHolder() == null)) 
     return; 

    if(item == null || !item.hasItemMeta()) 
     return; 

    ItemMeta meta = item.getItemMeta(); 
    List<String> lore = meta.getLore(); 

    if(!HiddenStringUtils.hasHiddenString(lore.get(0))) 
     return; 

    String action = HiddenStringUtils.extractHiddenString(lore.get(0)); 

    boolean command; 

    command = action.startsWith("/"); 

    if(!command) 
     new Menu(player, action); 
    else { 
     player.closeInventory(); 

     Set<String> arguments; 
     try { 
      arguments = TownyGUI.plugin.commandConfig.getConfig().getConfigurationSection("commands."+ action + ".arguments").getKeys(false); 
     } catch(NullPointerException e) { 
      action = action.replace("/", ""); 
      TownyGUI.plugin.server.dispatchCommand(player, action); 
      sukien.setCancelled(true); 
      return; 
     } 

     new CommandBuilder(arguments, action).beginConversation((CommandSender) player); 
    } 

    sukien.setCancelled(true); 
} } 

答えて

0

、これがエラーの原因である行:

String action = HiddenStringUtils.extractHiddenString(lore.get(0)); 

あなたはそれがNullPointerExceptionが、その結果、なぜチェックすることができるはずです。

あなたが取得したイベントエラーは、コードを修正するとすぐに解決されると思います。

あなたが提供した最初のリンクはログインしていないと機能しません。

+0

ありがとうございます!直した! –

関連する問題