Skip to content

Commit 9f136f9

Browse files
committed
Removed unused extensions.
Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent d7cdd4b commit 9f136f9

File tree

2 files changed

+10
-85
lines changed

2 files changed

+10
-85
lines changed

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/extensions/Extensions.kt

Lines changed: 8 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
package com.mairwunnx.projectessentials.core.api.v1.extensions
44

5+
import com.mairwunnx.projectessentials.core.api.v1.SETTING_LOC_ENABLED
6+
import com.mairwunnx.projectessentials.core.api.v1.configuration.ConfigurationAPI
57
import com.mairwunnx.projectessentials.core.api.v1.localization.LocalizationAPI.getLocalizedString
6-
import com.mairwunnx.projectessentials.core.api.v1.messaging.MessagingAPI
8+
import com.mairwunnx.projectessentials.core.impl.configurations.GeneralConfiguration
79
import com.mojang.brigadier.context.CommandContext
810
import net.minecraft.client.Minecraft
911
import net.minecraft.command.CommandSource
1012
import net.minecraft.entity.LivingEntity
1113
import net.minecraft.entity.player.PlayerEntity
1214
import net.minecraft.entity.player.ServerPlayerEntity
13-
import net.minecraft.server.MinecraftServer
1415
import net.minecraft.util.SoundCategory
1516
import net.minecraft.util.SoundEvent
1617
import net.minecraft.util.text.ITextComponent
@@ -25,87 +26,9 @@ import net.minecraftforge.fml.DistExecutor
2526
import net.minecraftforge.fml.server.ServerLifecycleHooks
2627
import java.io.File
2728

28-
/**
29-
* Send message to player with localized string
30-
* or simple message.
31-
* @param l10nString localization string or message.
32-
* @param safeLocalization if true then localization
33-
* will provided by server false if localization
34-
* will provided by client resource pack.
35-
* @param args localization string arguments.
36-
* @param argumentChar localization argument char.
37-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
38-
*/
39-
fun ServerPlayerEntity.sendMessage(
40-
l10nString: String,
41-
safeLocalization: Boolean,
42-
vararg args: String,
43-
argumentChar: Char = 's'
44-
) = MessagingAPI.sendMessage(
45-
this, l10nString, safeLocalization, *args, argumentChar = argumentChar
46-
)
47-
48-
/**
49-
* Send message to player action bar with localized
50-
* string or simple message.
51-
* @param l10nString localization string or message.
52-
* @param safeLocalization if true then localization
53-
* will provided by server false if localization
54-
* will provided by client resource pack.
55-
* @param args localization string arguments.
56-
* @param argumentChar localization argument char.
57-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
58-
*/
59-
fun ServerPlayerEntity.sendActionBarMessage(
60-
l10nString: String,
61-
safeLocalization: Boolean,
62-
vararg args: String,
63-
argumentChar: Char = 's'
64-
) = MessagingAPI.sendActionBarMessage(
65-
this, l10nString, safeLocalization, *args, argumentChar = argumentChar
66-
)
67-
68-
/**
69-
* Send message to all player on server with localized
70-
* string or simple message.
71-
* @param l10nString localization string or message.
72-
* @param safeLocalization if true then localization
73-
* will provided by server false if localization
74-
* will provided by client resource pack.
75-
* @param args localization string arguments.
76-
* @param argumentChar localization argument char.
77-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
78-
*/
79-
fun MinecraftServer.sendMessageToAll(
80-
l10nString: String,
81-
safeLocalization: Boolean,
82-
vararg args: String,
83-
argumentChar: Char = 's'
84-
) = MessagingAPI.sendMessageToAll(
85-
this, l10nString, safeLocalization, *args, argumentChar = argumentChar
86-
)
87-
88-
/**
89-
* Send message to all player in specified world id
90-
* with localized string or simple message.
91-
* @param worldId target world id.
92-
* @param l10nString localization string or message.
93-
* @param safeLocalization if true then localization
94-
* will provided by server false if localization
95-
* will provided by client resource pack.
96-
* @param args localization string arguments.
97-
* @param argumentChar localization argument char.
98-
* @since Mod: 2.0.0-SNAPSHOT.1, API: 1.0.0
99-
*/
100-
fun MinecraftServer.sendMessageToAllInWorld(
101-
worldId: Int,
102-
l10nString: String,
103-
safeLocalization: Boolean,
104-
vararg args: String,
105-
argumentChar: Char = 's'
106-
) = MessagingAPI.sendMessageToAllInWorld(
107-
worldId, this, l10nString, safeLocalization, *args, argumentChar = argumentChar
108-
)
29+
private val generalConfiguration by lazy {
30+
ConfigurationAPI.getConfigurationByName<GeneralConfiguration>("general")
31+
}
10932

11033
/**
11134
* Plays sound to player at player position on both sides.
@@ -217,7 +140,7 @@ val CommandEvent.source: CommandSource get() = this.parseResults.context.source
217140
*/
218141
fun hoverEventFrom(
219142
player: ServerPlayerEntity,
220-
safeLocalization: Boolean,
143+
safeLocalization: Boolean = generalConfiguration.getBool(SETTING_LOC_ENABLED),
221144
l10n: String,
222145
vararg args: String
223146
) = if (safeLocalization) {
@@ -247,7 +170,7 @@ fun hoverEventFrom(
247170
*/
248171
fun textComponentFrom(
249172
player: ServerPlayerEntity,
250-
safeLocalization: Boolean,
173+
safeLocalization: Boolean = generalConfiguration.getBool(SETTING_LOC_ENABLED),
251174
l10n: String,
252175
vararg args: String
253176
): ITextComponent = TextComponentUtils.toTextComponent {

src/main/kotlin/com/mairwunnx/projectessentials/core/api/v1/messaging/MessagingAPI.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@file:Suppress("unused")
2+
13
package com.mairwunnx.projectessentials.core.api.v1.messaging
24

35
import com.mairwunnx.projectessentials.core.api.v1.SETTING_LOC_ENABLED

0 commit comments

Comments
 (0)