-
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
1 parent
c2f7cdb
commit d299a35
Showing
22 changed files
with
162 additions
and
143 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
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
14 changes: 0 additions & 14 deletions
14
src/main/kotlin/com/fardragi/nyaruko/auth/messages/AlreadyRegisteredMessage.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/kotlin/com/fardragi/nyaruko/auth/messages/LoginCheckFailMessage.kt
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/kotlin/com/fardragi/nyaruko/auth/messages/LoginCheckSuccessMessage.kt
This file was deleted.
Oops, something went wrong.
22 changes: 10 additions & 12 deletions
22
src/main/kotlin/com/fardragi/nyaruko/auth/messages/LoginMessage.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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
package com.fardragi.nyaruko.auth.messages | ||
|
||
import com.fardragi.nyaruko.shared.messages.TextBuilder | ||
import net.minecraft.event.ClickEvent | ||
import net.minecraft.event.HoverEvent | ||
import net.minecraft.util.ChatComponentText | ||
import net.minecraft.util.ChatStyle | ||
import net.minecraft.util.EnumChatFormatting | ||
|
||
object LoginMessage { | ||
fun create(): ChatComponentText { | ||
val command = ChatComponentText("/login <password>") | ||
command.chatStyle = ChatStyle() | ||
.setChatClickEvent(ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/login")) | ||
.setChatHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("/login"))) | ||
fun usageAction(): TextBuilder { | ||
val textBuilder = TextBuilder() | ||
.append("/login <senha>", EnumChatFormatting.YELLOW) { | ||
it.clickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/login") | ||
it.hoverEvent(HoverEvent.Action.SHOW_TEXT) { event -> | ||
event.append("/login") | ||
} | ||
} | ||
|
||
val text = ChatComponentText("use ") | ||
text.chatStyle = ChatStyle().setColor(EnumChatFormatting.YELLOW) | ||
text.appendSibling(command) | ||
|
||
return text | ||
return textBuilder | ||
} | ||
} |
44 changes: 38 additions & 6 deletions
44
src/main/kotlin/com/fardragi/nyaruko/auth/messages/RegisterMessage.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 |
---|---|---|
@@ -1,14 +1,46 @@ | ||
package com.fardragi.nyaruko.auth.messages | ||
|
||
import net.minecraft.util.ChatComponentText | ||
import net.minecraft.util.ChatStyle | ||
import com.fardragi.nyaruko.shared.messages.MessageBuilder | ||
import com.fardragi.nyaruko.shared.messages.TextBuilder | ||
import net.minecraft.event.ClickEvent | ||
import net.minecraft.event.HoverEvent | ||
import net.minecraft.util.EnumChatFormatting | ||
|
||
object RegisterMessage { | ||
fun create(): ChatComponentText { | ||
val text = ChatComponentText("use /register <password> <repeat password>") | ||
text.chatStyle = ChatStyle().setColor(EnumChatFormatting.YELLOW) | ||
fun usageAction(): TextBuilder { | ||
val textBuilder = TextBuilder() | ||
.append("/register <senha> <repetir senha>", EnumChatFormatting.YELLOW) { | ||
it.clickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/register") | ||
it.hoverEvent(HoverEvent.Action.SHOW_TEXT) { event -> | ||
event.append("/register") | ||
} | ||
} | ||
|
||
return text | ||
return textBuilder | ||
} | ||
|
||
fun alreadyRegistered(): MessageBuilder { | ||
val messageBuilder = MessageBuilder() | ||
.add { builder -> | ||
builder.append("Usuario ja registrado, use ", EnumChatFormatting.YELLOW) | ||
builder.append(LoginMessage.usageAction()) | ||
builder.append(" para entrar", EnumChatFormatting.YELLOW) | ||
} | ||
|
||
return messageBuilder | ||
} | ||
|
||
fun success(): MessageBuilder { | ||
val messageBuilder = MessageBuilder() | ||
.add { builder -> | ||
builder.append("Registrado com sucesso", EnumChatFormatting.GREEN) | ||
} | ||
.add { builder -> | ||
builder.append("Use ", EnumChatFormatting.YELLOW) | ||
builder.append(LoginMessage.usageAction()) | ||
builder.append(" para entrar", EnumChatFormatting.YELLOW) | ||
} | ||
|
||
return messageBuilder | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/fardragi/nyaruko/config/DiscordConfig.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 com.fardragi.nyaruko.config | ||
|
||
private const val CATEGORY = "discord" | ||
|
||
class DiscordConfig(config: Config) { | ||
val discordInvite: String = config.configuration.getString("discordInvite", CATEGORY, "https://discord.gg/", "Link for discord invite") | ||
|
||
init { | ||
config.save() | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/kotlin/com/fardragi/nyaruko/exceptions/MessageException.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 com.fardragi.nyaruko.exceptions | ||
|
||
import com.fardragi.nyaruko.shared.messages.MessageBuilder | ||
|
||
class MessageException(val messageBuilder: MessageBuilder) : Exception() |
13 changes: 3 additions & 10 deletions
13
src/main/kotlin/com/fardragi/nyaruko/extensions/ChatComponentText.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 |
---|---|---|
@@ -1,17 +1,10 @@ | ||
package com.fardragi.nyaruko.extensions | ||
|
||
import com.fardragi.nyaruko.shared.messages.MessageBuilder | ||
import net.minecraft.command.ICommandSender | ||
import net.minecraft.entity.player.EntityPlayer | ||
import net.minecraft.util.ChatComponentText | ||
|
||
fun EntityPlayer.addChatMessages(messages: Array<ChatComponentText>) { | ||
messages.forEach { | ||
this.addChatMessage(it) | ||
} | ||
} | ||
|
||
fun ICommandSender.addChatMessages(messages: Array<ChatComponentText>) { | ||
messages.forEach { | ||
fun ICommandSender.sendMessages(messageBuilder: MessageBuilder) { | ||
messageBuilder.build().forEach { | ||
this.addChatMessage(it) | ||
} | ||
} |
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
Oops, something went wrong.