mirror of
https://e.coding.net/circlecloud/GuiACK.git
synced 2024-12-04 16:38:48 +00:00
fix open error...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
5e1b2ce224
commit
a4c389c53b
@ -11,9 +11,22 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class VerifyGui {
|
||||
static List<String> verifylist = new ArrayList<String>();
|
||||
|
||||
static List<String> playerlist = new ArrayList<String>();
|
||||
public static String invname = "§v§e§r§c防挂机验证 §3请选择验证码: ";
|
||||
|
||||
public static void add(Player p) {
|
||||
playerlist.add(p.getName());
|
||||
}
|
||||
|
||||
public static boolean checkopen(Player p) {
|
||||
if (playerlist.contains(p.getName()))
|
||||
return false;
|
||||
else {
|
||||
open(p);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static void init(List<String> verifylist) {
|
||||
VerifyGui.verifylist = verifylist;
|
||||
}
|
||||
@ -32,5 +45,10 @@ public class VerifyGui {
|
||||
Inventory inv = Bukkit.createInventory(null, 9, invname + list[ri].getItemMeta().getDisplayName());
|
||||
inv.setContents(list);
|
||||
p.openInventory(inv);
|
||||
add(p);
|
||||
}
|
||||
|
||||
public static void remove(Player p) {
|
||||
playerlist.remove(p.getName());
|
||||
}
|
||||
}
|
||||
|
@ -40,11 +40,11 @@ public class PlayerListen implements Listener {
|
||||
Player p = (Player) e.getPlayer();
|
||||
if (checklist.containsKey(p.getName()) && checklist.get(p.getName())) {
|
||||
checklist.put(p.getName(), false);
|
||||
VerifyGui.remove(p);
|
||||
return;
|
||||
}
|
||||
if (p.isOnline())
|
||||
Bukkit.getScheduler().runTaskLater(plugin, new VerifyTask(p), 3);
|
||||
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -70,6 +70,7 @@ public class PlayerListen implements Listener {
|
||||
p.sendMessage("§a验证成功 奖励金钱: " + plugin.reward);
|
||||
checklist.put(p.getName(), true);
|
||||
p.closeInventory();
|
||||
VerifyGui.remove(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,8 @@ public class VerifyTask implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
if (p.isOnline())
|
||||
VerifyGui.open(p);
|
||||
if (!VerifyGui.checkopen(p))
|
||||
p.kickPlayer("验证码输入超时 请重新登录!");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user