Localized DoubleLoginFix
This commit is contained in:
parent
f153867d85
commit
441e020192
@ -1,26 +1,32 @@
|
||||
package fr.xephi.authme.listener;
|
||||
//Prevent Ghost Players
|
||||
|
||||
import fr.xephi.authme.message.MessageKey;
|
||||
import fr.xephi.authme.service.CommonService;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class DoubleLoginFixListener implements Listener {
|
||||
@Inject
|
||||
private CommonService service;
|
||||
|
||||
public DoubleLoginFixListener() {
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Collection<? extends Player> PlayerList = Bukkit.getServer().getOnlinePlayers();
|
||||
HashSet<String> PlayerSet = new HashSet<String>();
|
||||
for (Player ep : PlayerList) {
|
||||
if (PlayerSet.contains(ep.getName().toLowerCase())) {
|
||||
ep.kickPlayer("You have been disconnected due to doubled login.");
|
||||
ep.kickPlayer(service.retrieveSingleMessage(ep.getPlayer(), MessageKey.DOUBLE_LOGIN_FIX));
|
||||
break;
|
||||
}
|
||||
PlayerSet.add(ep.getName().toLowerCase());
|
||||
|
||||
@ -4,6 +4,10 @@ package fr.xephi.authme.message;
|
||||
* Keys for translatable messages managed by {@link Messages}.
|
||||
*/
|
||||
public enum MessageKey {
|
||||
/**
|
||||
* You have been disconnected due to doubled login.
|
||||
*/
|
||||
DOUBLE_LOGIN_FIX("double_login_fix.fix_message"),
|
||||
|
||||
/**
|
||||
* You are stuck in portal during Login.
|
||||
|
||||
@ -152,6 +152,7 @@ public class MessageUpdater {
|
||||
.put("gui_captcha", "3rd party features: GUI Captcha")
|
||||
.put("bedrock_auto_login", "3rd party features: Bedrock Auto Login")
|
||||
.put("login_location_fix", "3rd party features: Login Location Fix")
|
||||
.put("double_login_fix", "3rd party features: Double Login Fix")
|
||||
.build();
|
||||
|
||||
Set<String> addedKeys = new HashSet<>();
|
||||
|
||||
@ -176,3 +176,7 @@ login_location_fix:
|
||||
fix_portal: '&aYou are stuck in portal during Login.'
|
||||
fix_underground: '&aYou are stuck underground during Login.'
|
||||
cannot_fix_underground: '&aYou are stuck underground during Login, but we cant fix it.'
|
||||
|
||||
# 3rd party features: Double Login Fix
|
||||
double_login_fix:
|
||||
fix_message: '&cYou have been disconnected due to doubled login.'
|
||||
|
||||
@ -185,3 +185,9 @@ login_location_fix:
|
||||
fix_portal: '&a你在登录时卡在了地狱门, 现已修正'
|
||||
fix_underground: '&a你被埋住了, 坐标已修正, 下次下线之前请小心!'
|
||||
cannot_fix_underground: '&a你被埋住了, 坐标无法修正, 只好送你去了最高点, 自求多福吧少年~'
|
||||
|
||||
# 3rd party features: Double Login Fix
|
||||
double_login_fix:
|
||||
fix_message: '&a已修复幽灵玩家, 请重新进入'
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user