ChestShop-3/com/Acrobot/ChestShop/Listeners/Player/PlayerConnect.java
Acrobot 5908eb67fa - Added API (let's start with simple things first)
- Copied utilities from ChestShop-4
- Made code really, really nicer to read
- Made every external plugin's wrapper a listener, so it listens to events instead of being hard-coded.
2012-06-08 15:28:36 +02:00

29 lines
942 B
Java

package com.Acrobot.ChestShop.Listeners.Player;
import com.Acrobot.ChestShop.ChestShop;
import com.Acrobot.ChestShop.Permission;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
/**
* @author Acrobot
*/
public class PlayerConnect implements Listener {
@EventHandler
public static void onPlayerJoin(PlayerLoginEvent event) {
String name = event.getPlayer().getName();
if (name != null && ChestShopSign.isAdminShop(name)) {
if (Permission.has(event.getPlayer(), Permission.ADMIN)) {
return;
}
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Oh no you don't. (ChestShop logged your IP to server log!)");
ChestShop.getBukkitLogger().severe(event.getAddress() + " tried to log in on Admin Shop's account!");
}
}
}