我正在尝试制作一个混合模式验证(我自己的版本),但是有一个问题,在与星号链接的那一行,我得到了[令牌上的语法错误“(”,;预期],[令牌上的语法错误“ )", ; 预期],[void 是变量 onPlayerJoin 的无效类型],java 是否仍然可以运行?
public class MixedPlugin extends JavaPlugin implements Listener{
@Override
public void onEnable(){
getLogger().info("Mixed Mode: ON");
getCommand("mm").setExecutor(new MixedCommand());
@EventHandler
**public void onPlayerJoin(PlayerJoinEvent event) {**
Player player = event.getPlayer();
String name = player.getName();
boolean isGood = getURL("http://minecraft.net/haspaid.jsp?user=deadmau5" + name).equals("true");
if (isGood) {
player.sendMessage("Welcome back to server!");
}
else {
List<String> ex = getConfig().getStringList("allow");
if (((MemorySection)ex).getStringList("allow").contains(player.getName())) {
player.sendMessage("Welcome back to server!");
player.sendMessage("You are a few person that are using cracked minecraft and allowed to join this premium server!");
} else {
player.kickPlayer("Failed to login: User not premium");
}
}
}
}
public String getURL(String url){
Logger log = Logger.getLogger("Minecraft");
String inputLine = "";
try{
URL mcheck = new URL(url);
URLConnection mcheckc = mcheck.openConnection();
mcheckc.setReadTimeout(1500);
BufferedReader in = new BufferedReader(new InputStreamReader(mcheckc.getInputStream()));
inputLine = in.readLine();
in.close();
return inputLine;
} catch(Exception e){
log.warning("Error retrieving "+url+": "+e.getMessage());
}
return "ERROR";
}
@Override
public void onDisable(){
getLogger().info("You have disable Mixed Mode");
}
}