Skip to content

Instantly share code, notes, and snippets.

@md-5
Created July 15, 2012 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save md-5/ba398dc0202c50662cee to your computer and use it in GitHub Desktop.
Save md-5/ba398dc0202c50662cee to your computer and use it in GitHub Desktop.
public class Sentinel extends org.bukkit.plugin.java.JavaPlugin implements org.bukkit.event.Listener {
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
}
@org.bukkit.event.EventHandler
public void login(org.bukkit.event.player.AsyncPlayerPreLoginEvent event) throws Exception {
java.net.URLConnection con = new java.net.URL("https://login.minecraft.net/?user=" + java.net.URLEncoder.encode(event.getName(), "UTF-8") + "&version=13&password=").openConnection();
java.io.InputStream is = con.getInputStream();
java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(is));
if (br.readLine().equals("Account migrated, use e-mail as username.")) {
event.disallow(org.bukkit.event.player.PlayerPreLoginEvent.Result.KICK_OTHER, "Sorry, but migrated accounts are not allowed at this time.");
}
br.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment