Skip to content

Commit d040878

Browse files
v2.3.0
- Empty messages won't be sent anymore
1 parent 1664c2d commit d040878

12 files changed

Lines changed: 25 additions & 18 deletions

File tree

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
plugins {
22
id "org.jetbrains.kotlin.jvm" version "1.2.41"
33
id "org.jetbrains.kotlin.kapt" version "1.2.41"
4-
id "com.github.johnrengelman.shadow" version "1.2.4"
4+
id "com.github.johnrengelman.shadow" version "2.0.4"
55
id "flavor.pie.promptsign" version "1.0.2"
66
}
77

88
group "de.randombyte"
9-
version "2.2.2"
9+
version "2.3.0"
1010

1111
repositories {
1212
jcenter()

src/main/kotlin/de/randombyte/unity/Unity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Unity @Inject constructor(
5656
companion object {
5757
const val ID = "unity"
5858
const val NAME = "Unity"
59-
const val VERSION = "2.2.2"
59+
const val VERSION = "2.3.0"
6060
const val AUTHOR = "RandomByte"
6161

6262
const val NUCLEUS_ID = "nucleus"

src/main/kotlin/de/randombyte/unity/commands/AcceptRequestCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class AcceptRequestCommand(
3737
val broadcastMessage = config.texts.unityBroadcast.apply(mapOf(
3838
"member1" to requester.name,
3939
"member2" to player.name)).build()
40-
broadcast(broadcastMessage)
40+
broadcastIfNotEmpty(broadcastMessage)
4141

4242
return CommandResult.success()
4343
}

src/main/kotlin/de/randombyte/unity/commands/CancelRequestCommand.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class CancelRequestCommand(
2424
removeRequest(player.uniqueId, requestee.uniqueId)
2525

2626
val config = configAccessor.get()
27-
requestee.sendMessage(config.texts.cancelledRequestMessage.apply(mapOf(
27+
requestee.sendMessageIfNotEmpty(config.texts.cancelledRequestMessage.apply(mapOf(
2828
"requester" to player.name
2929
)).build())
3030

31-
player.sendMessage(config.texts.sentCancellation.apply(mapOf(
31+
player.sendMessageIfNotEmpty(config.texts.sentCancellation.apply(mapOf(
3232
"requestee" to requestee.name
3333
)).build())
3434

src/main/kotlin/de/randombyte/unity/commands/DeclineRequestCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class DeclineRequestCommand(
2626
val broadcastMessage = configAccessor.get().texts.declinedRequestBroadcast.apply(mapOf(
2727
"requester" to requester.name,
2828
"requestee" to player.name)).build()
29-
broadcast(broadcastMessage)
29+
broadcastIfNotEmpty(broadcastMessage)
3030

3131
return CommandResult.success()
3232
}

src/main/kotlin/de/randombyte/unity/commands/DivorceCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class DivorceCommand(
3232
val divorceBroadcast = config.texts.divorceBroadcast.apply(mapOf(
3333
"member1" to player.name,
3434
"member2" to otherMemberName)).build()
35-
broadcast(divorceBroadcast)
35+
broadcastIfNotEmpty(divorceBroadcast)
3636

3737
return CommandResult.success()
3838
}

src/main/kotlin/de/randombyte/unity/commands/GiftCommand.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class GiftCommand(
2525
otherPlayer.give(itemInHand)
2626
player.setItemInHand(HandTypes.MAIN_HAND, null)
2727

28-
otherPlayer.sendMessage(config.texts.receivedGift.apply(mapOf("otherMember" to player.name)).build())
29-
player.sendMessage(config.texts.sentGift.apply(mapOf("otherMember" to otherPlayer.name)).build())
28+
otherPlayer.sendMessageIfNotEmpty(config.texts.receivedGift.apply(mapOf("otherMember" to player.name)).build())
29+
player.sendMessageIfNotEmpty(config.texts.sentGift.apply(mapOf("otherMember" to otherPlayer.name)).build())
3030

3131
return CommandResult.success()
3232
}

src/main/kotlin/de/randombyte/unity/commands/RequestUnityCommand.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class RequestUnityCommand(
3232
val acceptRequest = config.texts.acceptRequestAction.action(TextActions.runCommand("/unity accept ${player.name}"))
3333
val declineRequest = config.texts.declineRequestAction.action(TextActions.runCommand("/unity decline ${player.name}"))
3434
val requestMessage = config.texts.gotRequest.apply(mapOf("requester" to player.name)).build()
35-
requestee.sendMessage(requestMessage + " " + acceptRequest + " " + declineRequest)
35+
requestee.sendMessageIfNotEmpty(requestMessage + " " + acceptRequest + " " + declineRequest)
3636

37-
player.sendMessage(config.texts.sentRequest.apply(mapOf("requestee" to requestee.name)).build())
37+
player.sendMessageIfNotEmpty(config.texts.sentRequest.apply(mapOf("requestee" to requestee.name)).build())
3838

39-
broadcast(config.texts.requestBroadcast.apply(mapOf(
39+
broadcastIfNotEmpty(config.texts.requestBroadcast.apply(mapOf(
4040
"requester" to player.name,
4141
"requestee" to requestee.name
4242
)).build())

src/main/kotlin/de/randombyte/unity/commands/TeleportCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class TeleportCommand(
1515
override fun executedByUnityMember(player: Player, args: CommandContext, thisUnity: Config.Unity, config: Config): CommandResult {
1616
val otherMember = thisUnity.getOtherMember(player.uniqueId).getUser()!!
1717
val otherPlayer = otherMember.player
18-
.orElseThrow { throw CommandException("'${otherMember.name}' must be online to excute this command!".toText()) }
18+
.orElseThrow { throw CommandException("'${otherMember.name}' must be online to execute this command!".toText()) }
1919

2020
player.location = otherPlayer.location
2121

src/main/kotlin/de/randombyte/unity/commands/UnityCommand.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class UnityCommand(
1616
val config = configAccessor.get()
1717
val unities = config.unities
1818
val unity = unities.getUnity(player.uniqueId)
19-
?: throw CommandException("You must be married to someone to execute this command!".toText()) // TODO: change to 'unity'
19+
?: throw CommandException("You must be married to someone to execute this command!".toText())
2020
return executedByUnityMember(player, args, unity, config)
2121
}
2222

0 commit comments

Comments
 (0)