Case-sensitive Telnet login names

This commit is contained in:
unknown 2013-12-17 15:16:32 +01:00
parent aa0fd34859
commit 05884ae806
2 changed files with 28 additions and 11 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Dec 15 23:11:53 CET 2013
build.number=674
#Tue Dec 17 15:15:51 CET 2013
build.number=680

View File

@ -1,7 +1,10 @@
package me.StevenLawson.TotalFreedomMod.Listener;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_Superadmin;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -11,15 +14,29 @@ public class TFM_CustomListener implements Listener
@EventHandler(priority = EventPriority.NORMAL)
public void onTelnetPreLogin(me.StevenLawson.BukkitTelnet.TelnetPreLoginEvent event)
{
String ip = event.getIp();
if (ip != null && !ip.isEmpty())
final String ip = event.getIp();
if (ip == null || ip.isEmpty())
{
TFM_Superadmin admin = TFM_SuperadminList.getAdminEntryByIP(ip, true);
if (admin != null && (admin.isTelnetAdmin() || admin.isSeniorAdmin()))
return;
}
final TFM_Superadmin admin = TFM_SuperadminList.getAdminEntryByIP(ip, true);
if (admin == null || !(admin.isTelnetAdmin() || admin.isSeniorAdmin()))
{
return;
}
event.setBypassPassword(true);
event.setName(admin.getName());
final OfflinePlayer player = Bukkit.getOfflinePlayer(admin.getName());
if (player == null)
{
return;
}
}
event.setName(player.getName());
}
}