package de.maniacraft.admincontrol;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerListener;
import com.nijiko.permissions.User;
public class PlayerJoin extends PlayerListener {
private ManiaCraftAdminControl plugin;
public PlayerJoin(ManiaCraftAdminControl instance) {
plugin = instance;
}
@Override
public void onPlayerJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
User user = plugin.perm.getUserObject(player.getWorld().getName(), player.getName());
String playerIP = event.getPlayer().getAddress().toString();
if (user == null) {
try {
user = plugin.perm.safeGetUser(player.getWorld().getName(), player.getName());
} catch (Exception e) {
e.printStackTrace();
return;
}
}
if (user.inGroup(player.getWorld().getName(), Config.getString(\"GuestGroup\"))) {
if(plugin.DB.getList().contains(player.getName())) {
plugin.sendOpMessage(\"&a\" + player.getName() + \"&2\" + Config.getString(\"Lang_CanAccept\"));
} else {
player.sendMessage(Config.getString(\"Lang_Welcome\"));
}
}
if(playerIP.contains(\"127.0.0.1\")) {
player.sendMessage(Config.getString(\"Lang_Welcome_IPWarn\"));
}
}
}