Search in sources :

Example 11 with Nerd

use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.

the class NerdListener method onJoin.

@EventHandler
public void onJoin(PlayerJoinEvent event) {
    NerdService service = new NerdService();
    Nerd nerd = Nerd.of(event.getPlayer());
    nerd.setLoginLocation(event.getPlayer().getLocation());
    service.save(nerd);
}
Also used : Nerd(gg.projecteden.nexus.models.nerd.Nerd) NerdService(gg.projecteden.nexus.models.nerd.NerdService) EventHandler(org.bukkit.event.EventHandler)

Example 12 with Nerd

use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.

the class Justice method mute_onMinecraftChatEvent.

@EventHandler(priority = EventPriority.LOWEST)
public void mute_onMinecraftChatEvent(MinecraftChatEvent event) {
    Nerd nerd = Nerd.of(event.getChatter());
    if (!isNewPlayer(nerd))
        return;
    if (nerd.hasMoved())
        return;
    event.setCancelled(true);
    nerd.sendMessage("&cYou must move before you can speak in chat");
    String message = "&e" + nerd.getNickname() + " &ctried to speak before moving: &7" + getMessageDetails(event);
    Broadcast.staff().prefix("Justice").message(message).send();
}
Also used : Nerd(gg.projecteden.nexus.models.nerd.Nerd) EventHandler(org.bukkit.event.EventHandler)

Example 13 with Nerd

use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.

the class NerdListener method onJoin.

@EventHandler(priority = EventPriority.LOWEST)
public void onJoin(AsyncPlayerPreLoginEvent event) {
    NerdService service = new NerdService();
    Nerd nerd = Nerd.of(event.getUniqueId());
    nerd.setLastJoin(LocalDateTime.now());
    nerd.setName(event.getName());
    nerd.getPastNames().add(event.getName());
    service.save(nerd);
}
Also used : Nerd(gg.projecteden.nexus.models.nerd.Nerd) NerdService(gg.projecteden.nexus.models.nerd.NerdService) EventHandler(org.bukkit.event.EventHandler)

Example 14 with Nerd

use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.

the class NerdListener method onQuit.

@EventHandler
public void onQuit(PlayerQuitEvent event) {
    NerdService service = new NerdService();
    Nerd nerd = Nerd.of(event.getPlayer());
    nerd.setLastQuit(LocalDateTime.now());
    nerd.getPastNames().add(Name.of(event.getPlayer()));
    nerd.setLocation(event.getPlayer().getLocation());
    service.save(nerd);
}
Also used : Nerd(gg.projecteden.nexus.models.nerd.Nerd) NerdService(gg.projecteden.nexus.models.nerd.NerdService) EventHandler(org.bukkit.event.EventHandler)

Example 15 with Nerd

use of gg.projecteden.nexus.models.nerd.Nerd in project Nexus by ProjectEdenGG.

the class MapCommand method map.

@Path("[player]")
void map(@Arg(value = "self", permission = Group.STAFF) Nerd nerd) {
    Location location = nerd.getLocation();
    String world = location.getWorld().getName().toLowerCase();
    int x = (int) location.getX();
    int z = (int) location.getZ();
    Map<String, String> names = new HashMap<>();
    BlueMapAPI.getInstance().ifPresent(api -> api.getMaps().forEach(map -> names.put(map.getWorld().getSaveFolder().toFile().getName().toLowerCase(), map.getId())));
    String URL = MapCommand.URL;
    if (isStaff())
        if (!names.isEmpty() && !names.containsKey(world))
            URL = MapCommand.STAFF_URL;
    String link = URL + "/#" + names.getOrDefault(world, world) + ":" + x + ":0:" + z + ":30:0:0:0:0:perspective";
    send(json("&3Map: &e" + URL).url(URL));
    send(json("&3Current Location: &e" + link).url(link));
    send("&eTip: &3Zoom in, right click and drag");
}
Also used : Nexus(gg.projecteden.nexus.Nexus) Description(gg.projecteden.nexus.framework.commands.models.annotations.Description) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path) Nerd(gg.projecteden.nexus.models.nerd.Nerd) BlueMapAPI(de.bluecolored.bluemap.api.BlueMapAPI) CustomCommand(gg.projecteden.nexus.framework.commands.models.CustomCommand) Arg(gg.projecteden.nexus.framework.commands.models.annotations.Arg) HashMap(java.util.HashMap) Group(gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group) Aliases(gg.projecteden.nexus.framework.commands.models.annotations.Aliases) Location(org.bukkit.Location) CommandEvent(gg.projecteden.nexus.framework.commands.models.events.CommandEvent) Map(java.util.Map) HashMap(java.util.HashMap) Location(org.bukkit.Location) Path(gg.projecteden.nexus.framework.commands.models.annotations.Path)

Aggregations

Nerd (gg.projecteden.nexus.models.nerd.Nerd)22 Path (gg.projecteden.nexus.framework.commands.models.annotations.Path)12 NerdService (gg.projecteden.nexus.models.nerd.NerdService)8 Permission (gg.projecteden.nexus.framework.commands.models.annotations.Permission)6 EventHandler (org.bukkit.event.EventHandler)5 Async (gg.projecteden.annotations.Async)4 JsonBuilder (gg.projecteden.nexus.utils.JsonBuilder)4 CustomCommand (gg.projecteden.nexus.framework.commands.models.CustomCommand)3 Arg (gg.projecteden.nexus.framework.commands.models.annotations.Arg)3 Group (gg.projecteden.nexus.framework.commands.models.annotations.Permission.Group)3 CommandEvent (gg.projecteden.nexus.framework.commands.models.events.CommandEvent)3 PlayerNotFoundException (gg.projecteden.nexus.framework.exceptions.postconfigured.PlayerNotFoundException)3 Aliases (gg.projecteden.nexus.framework.commands.models.annotations.Aliases)2 HallOfHistory (gg.projecteden.nexus.models.hallofhistory.HallOfHistory)2 RankHistory (gg.projecteden.nexus.models.hallofhistory.HallOfHistory.RankHistory)2 Rank (gg.projecteden.nexus.models.nerd.Rank)2 Nickname (gg.projecteden.nexus.models.nickname.Nickname)2 Tasks (gg.projecteden.nexus.utils.Tasks)2 TickTime (gg.projecteden.utils.TimeUtils.TickTime)2 HashMap (java.util.HashMap)2