mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-07-08 20:14:46 +02:00
- 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.
29 lines
942 B
Java
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!");
|
|
}
|
|
}
|
|
}
|