-
-
Save md-5/ba398dc0202c50662cee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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