@@ -68,6 +68,9 @@ public void PlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
6868
6969 @ EventHandler
7070 public void PlayerPreLogin (AsyncPlayerPreLoginEvent event ) {
71+ if (event .getName ().startsWith (Objects .requireNonNull (plugin .getConfig ().getString ("login-ignore-prefix" )))) {
72+ return ;
73+ }
7174 if (Main .regIpData .containsKey (event .getName ())){
7275 Main .regIpData .replace (event .getName (), event .getAddress ().toString ());
7376 } else {
@@ -77,6 +80,10 @@ public void PlayerPreLogin(AsyncPlayerPreLoginEvent event) {
7780
7881 @ EventHandler
7982 public void PlayerLogin (PlayerJoinEvent event ) {
83+ if (event .getPlayer ().getName ().startsWith (Objects .requireNonNull (plugin .getConfig ().getString ("login-ignore-prefix" )))) {
84+ return ;
85+ }
86+
8087// String Message = "玩家<" + event.getName() + ">已从" + event.getAddress() + "登录服务器";
8188 sendRequest (event .getJoinMessage ());
8289
@@ -85,7 +92,7 @@ public void PlayerLogin(PlayerJoinEvent event) {
8592 int timeout ;
8693 try {
8794 Statement statement = Main .dbConn .createStatement ();
88- ResultSet rs = statement .executeQuery ("select * from `password ` where `id`='" + event .getPlayer ().getName () + "'" );
95+ ResultSet rs = statement .executeQuery ("select * from `ms_users ` where `id`='" + event .getPlayer ().getName () + "'" );
8996 boolean flag = false ;
9097 while (rs .next ()) {
9198 flag = true ;
@@ -118,69 +125,40 @@ public void PlayerLogin(PlayerJoinEvent event) {
118125 }
119126 }
120127
128+ public static void addPwdBtnItem (Inventory inv , Integer title , Material material ){
129+ int iter = title ==0 ?1 :title ;
130+ for (int i =0 ; i <iter ; i ++){
131+ inv .addItem (Main .NewItem (material , title .toString ()));
132+ }
133+ }
134+
121135 public static void openInv (Player player , String title ) {
122136 Inventory inv = Bukkit .createInventory (player , InventoryType .CHEST , title );
123137
124138 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码1" ));
125- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "1" ));
126- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "2" ));
127- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "2" ));
128- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "3" ));
129- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "3" ));
130- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "3" ));
139+ addPwdBtnItem (inv , 1 , Material .ORANGE_STAINED_GLASS );
140+ addPwdBtnItem (inv , 2 , Material .ORANGE_STAINED_GLASS );
141+ addPwdBtnItem (inv , 3 , Material .ORANGE_STAINED_GLASS );
131142 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码2" ));
132143 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码3" ));
133144 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码7" ));
134145 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码4" ));
135146 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码5" ));
136147
137148 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码6" ));
138- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "4" ));
139- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "4" ));
140- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "4" ));
141- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "4" ));
142- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "5" ));
143- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "5" ));
144- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "5" ));
145- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "5" ));
146- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "5" ));
147- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
148- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
149- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
150- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
151- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
152- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "6" ));
153- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "0" ));
149+ addPwdBtnItem (inv , 4 , Material .ORANGE_STAINED_GLASS );
150+ addPwdBtnItem (inv , 5 , Material .ORANGE_STAINED_GLASS );
151+ addPwdBtnItem (inv , 6 , Material .ORANGE_STAINED_GLASS );
152+ addPwdBtnItem (inv , 0 , Material .ORANGE_STAINED_GLASS );
154153 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码8" ));
155154 inv .addItem (Main .NewItem (Material .GREEN_STAINED_GLASS , "确认" ));
156155 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码9" ));
157156 inv .addItem (Main .NewItem (Material .RED_STAINED_GLASS , "清空" ));
158157
159158 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码11" ));
160- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
161- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
162- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
163- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
164- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
165- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
166- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "7" ));
167- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
168- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
169- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
170- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
171- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
172- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
173- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
174- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "8" ));
175- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
176- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
177- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
178- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
179- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
180- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
181- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
182- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
183- inv .addItem (Main .NewItem (Material .ORANGE_STAINED_GLASS , "9" ));
159+ addPwdBtnItem (inv , 7 , Material .ORANGE_STAINED_GLASS );
160+ addPwdBtnItem (inv , 8 , Material .ORANGE_STAINED_GLASS );
161+ addPwdBtnItem (inv , 9 , Material .ORANGE_STAINED_GLASS );
184162 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码12" ));
185163 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码13" ));
186164 inv .addItem (Main .NewItem (Material .WHITE_STAINED_GLASS , "请输入密码10" ));
0 commit comments