-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
95 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/dev/mikchan/mcnp/motd/image/creator/IImageManagerCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dev.mikchan.mcnp.motd.image.creator | ||
|
||
import dev.mikchan.mcnp.motd.MOTDPlugin | ||
import dev.mikchan.mcnp.motd.image.manager.IImageManager | ||
|
||
interface IImageManagerCreator { | ||
fun build(plugin: MOTDPlugin): IImageManager | ||
} |
8 changes: 0 additions & 8 deletions
8
src/main/java/dev/mikchan/mcnp/motd/image/creator/IImagePoolCreator.kt
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/mikchan/mcnp/motd/image/creator/ImageManagerCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.mikchan.mcnp.motd.image.creator | ||
|
||
import dev.mikchan.mcnp.motd.MOTDPlugin | ||
import dev.mikchan.mcnp.motd.image.manager.IImageManager | ||
import dev.mikchan.mcnp.motd.image.manager.ImagePool | ||
|
||
internal class ImageManagerCreator : IImageManagerCreator { | ||
override fun build(plugin: MOTDPlugin): IImageManager { | ||
return ImagePool(plugin) | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
src/main/java/dev/mikchan/mcnp/motd/image/creator/ImagePoolCreator.kt
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...ikchan/mcnp/motd/image/pool/IImagePool.kt → .../mcnp/motd/image/manager/IImageManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...mikchan/mcnp/motd/image/pool/ImagePool.kt → ...chan/mcnp/motd/image/manager/ImagePool.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/java/dev/mikchan/mcnp/motd/motd/creator/IMOTDManagerCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package dev.mikchan.mcnp.motd.motd.creator | ||
|
||
import dev.mikchan.mcnp.motd.MOTDPlugin | ||
import dev.mikchan.mcnp.motd.motd.manager.IMOTDManager | ||
|
||
interface IMOTDManagerCreator { | ||
fun build(plugin: MOTDPlugin): IMOTDManager | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/dev/mikchan/mcnp/motd/motd/creator/MOTDManagerCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package dev.mikchan.mcnp.motd.motd.creator | ||
|
||
import dev.mikchan.mcnp.motd.MOTDPlugin | ||
import dev.mikchan.mcnp.motd.motd.manager.MOTDManager | ||
import dev.mikchan.mcnp.motd.motd.manager.IMOTDManager | ||
|
||
internal class MOTDManagerCreator : IMOTDManagerCreator { | ||
override fun build(plugin: MOTDPlugin): IMOTDManager { | ||
return MOTDManager(plugin) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.mikchan.mcnp.motd.motd.manager | ||
|
||
import org.bukkit.util.CachedServerIcon | ||
|
||
@Suppress("SpellCheckingInspection") | ||
interface IMOTD { | ||
val firstLine: String? | ||
val secondLine: String? | ||
val image: CachedServerIcon? | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/dev/mikchan/mcnp/motd/motd/manager/IMOTDManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package dev.mikchan.mcnp.motd.motd.manager | ||
|
||
interface IMOTDManager { | ||
fun getRandom(): IMOTD? | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/dev/mikchan/mcnp/motd/motd/manager/MOTDManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package dev.mikchan.mcnp.motd.motd.manager | ||
|
||
import dev.mikchan.mcnp.motd.MOTDPlugin | ||
|
||
internal class MOTDManager(private val plugin: MOTDPlugin) : IMOTDManager { | ||
override fun getRandom(): IMOTD? { | ||
return plugin.config.motd.ifEmpty { null }?.random()?.let { MOTDProxy(it, plugin.imageManager) } | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/java/dev/mikchan/mcnp/motd/motd/manager/MOTDProxy.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package dev.mikchan.mcnp.motd.motd.manager | ||
|
||
import dev.mikchan.mcnp.motd.config.config.IMOTDConfig | ||
import dev.mikchan.mcnp.motd.image.manager.IImageManager | ||
import org.bukkit.util.CachedServerIcon | ||
|
||
internal class MOTDProxy( | ||
private val config: IMOTDConfig, | ||
private val imageManager: IImageManager, | ||
) : IMOTD { | ||
override val firstLine: String? | ||
get() = config.firstLine | ||
override val secondLine: String? | ||
get() = config.secondLine | ||
override val image: CachedServerIcon? | ||
get() = config.image?.let { imageManager.get(it) } | ||
} |