なぜこれが常にreturnステートメントが欠落していると言ってコンパイルされるのかわかりません。誰かが私を助けてくれるなら、それは素晴らしいことです!私は数時間試しましたが、なぜこのコードがコンパイルされないのかわかりません。私はJavaが得意というわけではありませんが、このコードは私には完璧に見えます。
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import net.xotiksys.api.ActiveScript;
import net.xotiksys.api.Manifest;
import net.xotiksys.api.methods.input.Mouse;
import net.xotiksys.api.methods.recognition.ColorRecognition;
import net.xotiksys.api.painting.Paintable;
import net.xotiksys.api.util.Time;
@Manifest(author = "iwrestledabearonce", description = "Auto Miner with bank support", name = "MiningBot", version = 1.0)
public class MiningBot extends ActiveScript implements Paintable {
private int Mined;
private Color ITEM = new Color(0, 0, 0);
private static final Color addy = new Color(74, 93, 74);
private static final Rectangle magicTab = new Rectangle(629, 170, 28, 30);
private static final Rectangle inv = new Rectangle(551, 206, 185, 255);
private static final Rectangle GFrame = new Rectangle(2, 3, 517, 339);
private static final long START_TIME = System.currentTimeMillis();
private Point ROCK = null;
private Point rockToMine = null;
private String Status = "Starting Auto Miner by iwrestledabearonce - Version 1.0 - Please be patient...";
private String TempColor = "";
@Override
public int script() {
Time.sleep(700);
if (ROCK != null) {
startMining(); //by iwrestledabearonce
}
else
return 700;
}
public void startMining() {
do {
ROCK = ColorRecognition.getPoint(addy, 2, inv);
rockToMine = ColorRecognition.getPoint(ITEM, 2, inv);
if (ROCK != null) {
Mouse.click(ROCK, 0, 0, true);
Time.sleep(700);
Mined++;
Status = "Mining Ore...";
stopScript();
} while (ROCKS != null && validate());
}
public void paint(final Graphics g) {
g.setColor(Color.ORANGE);
int ycoord = 349;
g.drawString("Status: " + Status, 15, ycoord += 10);
g.drawString("Rock's Mined: " + Mined, 15, ycoord += 20);
g.drawString("Run Time: "+ Time.format(System.currentTimeMillis() - START_TIME),15, ycoord += 30);
}
}
上記の新しいコードにより、以下のエラーが発生します。
Scripts\MiningBot.java:52: error: while expected
}
^
Scripts\MiningBot.java:56: error: illegal start of expression
public void paint(final Graphics g) {
^
Scripts\MiningBot.java:56: error: ')' expected
public void paint(final Graphics g) {
^
Scripts\MiningBot.java:56: error: ';' expected
public void paint(final Graphics g) {
^
Scripts\MiningBot.java:56: error: ';' expected
public void paint(final Graphics g) {
^
Scripts\MiningBot.java:63: error: reached end of file while parsing
}
^
6 errors
C:\Users\TJ\Desktop\XotikColor>pause
Press any key to continue . . .