forked from ChestShop-authors/ChestShop-3
-
Notifications
You must be signed in to change notification settings - Fork 2
/
NameChecker.java
28 lines (23 loc) · 887 Bytes
/
NameChecker.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.Acrobot.ChestShop.Listeners.PreShopCreation;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import com.Acrobot.ChestShop.Permission;
import com.Acrobot.ChestShop.Events.PreShopCreationEvent;
import com.Acrobot.ChestShop.Signs.ChestShopSign;
import com.Acrobot.ChestShop.UUIDs.NameManager;
/**
* @author Acrobot
*/
public class NameChecker implements Listener {
@EventHandler(priority = EventPriority.LOWEST)
public static void onPreShopCreation(PreShopCreationEvent event) {
String name = event.getOwnerName();
Player player = event.getPlayer();
if (!(ChestShopSign.isAdminshopLine(name) && Permission.has(player, Permission.ADMIN))) {
name = NameManager.getNameFor(player);
}
event.setOwnerName(name);
}
}