mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Case-sensitive Telnet login names
This commit is contained in:
parent
aa0fd34859
commit
05884ae806
@ -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
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user