@@ -3,26 +3,18 @@ package com.lambda.friend
33import com.lambda.config.Configurable
44import com.lambda.config.configurations.FriendConfig
55import com.lambda.core.Loadable
6- import com.lambda.event.events.TickEvent
7- import com.lambda.event.listener.SafeListener.Companion.listener
8- import com.lambda.util.world.EntityUtils.getEntities
96import com.mojang.authlib.GameProfile
10- import net.minecraft.entity.player.PlayerEntity
117import net.minecraft.server.network.ServerPlayerEntity
12- import net.minecraft.world.event.listener.EntityGameEventHandler
13- import java.util.Arrays
148import java.util.UUID
159
1610object FriendManager : Configurable(FriendConfig ), Loadable {
1711 override val name = " FriendManager"
1812
19- private val friends by setting(" friends" , arrayListOf <GameProfile >())
13+ private var friends by setting(" friends" , listOf <GameProfile >())
2014
21- fun add (vararg profile : GameProfile ) =
22- friends.addAll(profile)
15+ fun add (profile : GameProfile ) = friends.add(profile)
2316
24- fun remove (vararg profile : GameProfile ) =
25- friends.removeAll(profile.toSet())
17+ fun remove (profile : GameProfile ) = friends.remove(profile)
2618
2719 fun get (name : String ) = friends.firstOrNull { it.name == name }
2820 fun get (uuid : UUID ) = friends.firstOrNull { it.id == uuid }
@@ -36,6 +28,9 @@ object FriendManager : Configurable(FriendConfig), Loadable {
3628 val ServerPlayerEntity .isFriend: Boolean
3729 get() = contains(gameProfile)
3830
31+ fun ServerPlayerEntity.befriend () = add(gameProfile)
32+ fun ServerPlayerEntity.unfriend () = remove(gameProfile)
33+
3934 override fun load (): String {
4035 if (friends.isEmpty()) return " No friends loaded, damn bro you don't have to be antisocial online too,"
4136 val word = if (friends.size == 1 ) " friend" else " friends"
0 commit comments