簡體   English   中英

我無法解析為變量

[英]i cannot be resolved to a variable

我的插件說一個錯誤:

描述 資源路徑位置類型 i 無法解析為變量 CommandMotdEdit.java /MotdChange/src/com/xdisteer/plugin line 76 Java Problem

代碼

  if (args[0].equalsIgnoreCase("remove")) {
      if (sender.hasPermission("motdedit.remove")) {
          if (args.length >= 2) {
            if (check(args[1]))
           {
              try {
                           i = Integer.parseInt(args[1]); //ERROR!!!
              } catch (Exception e) { int i;
                return true; }
                int i;
           if (i > MotdEdit.motdlist.size() - 1) {
                sender.sendMessage("§cMotd with ID '" + i + "§c' does not exist!");
                return true;
              }
              String motd = (String)MotdEdit.motdlist.get(i);
               Functions.removeMotd(sender, args[1], motd, label);
              return true;
             }
try {
                           i = Integer.parseInt(args[1]);
              } catch (Exception e) { int i;
                return true; }
                int i;

錯誤代碼

因為您在聲明之前使用了 i 。

i = Integer.parseInt(args[1]); 你需要在這行代碼之前聲明 i

改變這一行i = Integer.parseInt(args[1]); //ERROR!!! i = Integer.parseInt(args[1]); //ERROR!!!

對此:

Integer i = Integer.parseInt(args[1]); //ERROR!!!

並刪除int i;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM