support displayname changing mods like ConventionalChat
This commit is contained in:
parent
ada8a3ac89
commit
6f9da8f2e3
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.ServerChatHandler
|
||||
import matterlink.bridge.USER_ACTION
|
||||
import matterlink.config.cfg
|
||||
import matterlink.handlers.*
|
||||
|
@ -14,7 +13,6 @@ import net.minecraftforge.event.CommandEvent
|
|||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
import net.minecraftforge.event.entity.player.AchievementEvent
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent
|
||||
|
@ -36,7 +34,7 @@ object EventHandler {
|
|||
return
|
||||
}
|
||||
ProgressHandler.handleProgress(
|
||||
name = e.entityPlayer.name,
|
||||
name = e.entityPlayer.displayName.unformattedText,
|
||||
message = "has earned the achievement",
|
||||
display = e.achievement.statName.unformattedText
|
||||
)
|
||||
|
@ -47,7 +45,7 @@ object EventHandler {
|
|||
@JvmStatic
|
||||
fun chatEvent(e: ServerChatEvent) {
|
||||
ChatProcessor.sendToBridge(
|
||||
user = e.username,
|
||||
user = e.player.displayName.unformattedText,
|
||||
msg = e.message,
|
||||
event = ""
|
||||
)
|
||||
|
@ -59,12 +57,12 @@ object EventHandler {
|
|||
fun commandEvent(e: CommandEvent) {
|
||||
val sender = when {
|
||||
e.sender is DedicatedServer -> cfg.outgoing.systemUser
|
||||
e.sender is TileEntityCommandBlock -> "CommandBlock"
|
||||
else -> e.sender.name
|
||||
else -> e.sender.displayName.unformattedText
|
||||
}
|
||||
val args = e.parameters.joinToString(" ")
|
||||
val type = when {
|
||||
e.command is CommandEmote -> USER_ACTION
|
||||
e.command.name == "me" -> USER_ACTION
|
||||
e.command is CommandBroadcast -> ""
|
||||
else -> return
|
||||
}
|
||||
|
@ -78,7 +76,7 @@ object EventHandler {
|
|||
fun deathEvent(e: LivingDeathEvent) {
|
||||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
player = e.entityLiving.name,
|
||||
player = e.entityLiving.displayName.unformattedText,
|
||||
deathMessage = e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
|
@ -89,14 +87,14 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun joinEvent(e: PlayerEvent.PlayerLoggedInEvent) {
|
||||
JoinLeaveHandler.handleJoin(e.player.name)
|
||||
JoinLeaveHandler.handleJoin(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun leaveEvent(e: PlayerEvent.PlayerLoggedOutEvent) {
|
||||
JoinLeaveHandler.handleLeave(e.player.name)
|
||||
JoinLeaveHandler.handleLeave(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.ServerChatHandler
|
||||
import matterlink.bridge.USER_ACTION
|
||||
import matterlink.config.cfg
|
||||
import matterlink.handlers.*
|
||||
|
@ -14,7 +13,6 @@ import net.minecraftforge.event.CommandEvent
|
|||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
import net.minecraftforge.event.entity.player.AchievementEvent
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent
|
||||
|
@ -37,7 +35,7 @@ object EventHandler {
|
|||
}
|
||||
|
||||
ProgressHandler.handleProgress(
|
||||
name = e.entityPlayer.name,
|
||||
name = e.entityPlayer.displayName.unformattedText,
|
||||
message = "has earned the achievement",
|
||||
display = e.achievement.statName.unformattedText
|
||||
)
|
||||
|
@ -48,7 +46,7 @@ object EventHandler {
|
|||
@JvmStatic
|
||||
fun chatEvent(e: ServerChatEvent) {
|
||||
ChatProcessor.sendToBridge(
|
||||
user = e.username,
|
||||
user = e.player.displayName.unformattedText,
|
||||
msg = e.message,
|
||||
event = ""
|
||||
)
|
||||
|
@ -60,12 +58,12 @@ object EventHandler {
|
|||
fun commandEvent(e: CommandEvent) {
|
||||
val sender = when {
|
||||
e.sender is DedicatedServer -> cfg.outgoing.systemUser
|
||||
e.sender is TileEntityCommandBlock -> "CommandBlock"
|
||||
else -> e.sender.name
|
||||
else -> e.sender.displayName.unformattedText
|
||||
}
|
||||
val args = e.parameters.joinToString(" ")
|
||||
val type = when {
|
||||
e.command is CommandEmote -> USER_ACTION
|
||||
e.command.name == "me" -> USER_ACTION
|
||||
e.command is CommandBroadcast -> ""
|
||||
else -> return
|
||||
}
|
||||
|
@ -79,7 +77,7 @@ object EventHandler {
|
|||
fun deathEvent(e: LivingDeathEvent) {
|
||||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
player = e.entityLiving.name,
|
||||
player = e.entityLiving.displayName.unformattedText,
|
||||
deathMessage = e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
|
@ -90,14 +88,14 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun joinEvent(e: PlayerEvent.PlayerLoggedInEvent) {
|
||||
JoinLeaveHandler.handleJoin(e.player.name)
|
||||
JoinLeaveHandler.handleJoin(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun leaveEvent(e: PlayerEvent.PlayerLoggedOutEvent) {
|
||||
JoinLeaveHandler.handleLeave(e.player.name)
|
||||
JoinLeaveHandler.handleLeave(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package matterlink
|
||||
|
||||
import matterlink.bridge.ServerChatHandler
|
||||
import matterlink.bridge.USER_ACTION
|
||||
import matterlink.config.cfg
|
||||
import matterlink.handlers.*
|
||||
|
@ -13,7 +12,6 @@ import net.minecraftforge.event.CommandEvent
|
|||
import net.minecraftforge.event.ServerChatEvent
|
||||
import net.minecraftforge.event.entity.living.LivingDeathEvent
|
||||
import net.minecraftforge.event.entity.player.AdvancementEvent
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler
|
||||
import net.minecraftforge.fml.common.Mod
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent
|
||||
|
@ -29,7 +27,7 @@ object EventHandler {
|
|||
fun progressEvent(e: AdvancementEvent) {
|
||||
if (e.advancement.display == null) return
|
||||
ProgressHandler.handleProgress(
|
||||
name = e.entityPlayer.name,
|
||||
name = e.entityPlayer.displayName.unformattedText,
|
||||
message = "has made the advancement",
|
||||
display = e.advancement.displayText.unformattedText
|
||||
)
|
||||
|
@ -40,7 +38,7 @@ object EventHandler {
|
|||
@JvmStatic
|
||||
fun chatEvent(e: ServerChatEvent) {
|
||||
ChatProcessor.sendToBridge(
|
||||
user = e.username,
|
||||
user = e.player.displayName.unformattedText,
|
||||
msg = e.message,
|
||||
event = ""
|
||||
)
|
||||
|
@ -50,14 +48,16 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun commandEvent(e: CommandEvent) {
|
||||
logger.info("commandEvent ${e.sender.javaClass.simpleName}")
|
||||
logger.info("commandEvent ${e.sender.javaClass.typeName}")
|
||||
val sender = when {
|
||||
e.sender is DedicatedServer -> cfg.outgoing.systemUser
|
||||
e.sender is TileEntityCommandBlock -> "CommandBlock"
|
||||
else -> e.sender.name
|
||||
else -> e.sender.displayName.unformattedText
|
||||
}
|
||||
val args = e.parameters.joinToString(" ")
|
||||
val type = when {
|
||||
e.command is CommandEmote -> USER_ACTION
|
||||
e.command.name == "me" -> USER_ACTION
|
||||
e.command is CommandBroadcast -> ""
|
||||
else -> return
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ object EventHandler {
|
|||
fun deathEvent(e: LivingDeathEvent) {
|
||||
if (e.entityLiving is EntityPlayer) {
|
||||
DeathHandler.handleDeath(
|
||||
player = e.entityLiving.name,
|
||||
player = e.entityLiving.displayName.unformattedText,
|
||||
deathMessage = e.entityLiving.combatTracker.deathMessage.unformattedText,
|
||||
damageType = e.source.damageType
|
||||
)
|
||||
|
@ -82,14 +82,14 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun joinEvent(e: PlayerEvent.PlayerLoggedInEvent) {
|
||||
JoinLeaveHandler.handleJoin(e.player.name)
|
||||
JoinLeaveHandler.handleJoin(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
@SubscribeEvent
|
||||
@JvmStatic
|
||||
fun leaveEvent(e: PlayerEvent.PlayerLoggedOutEvent) {
|
||||
JoinLeaveHandler.handleLeave(e.player.name)
|
||||
JoinLeaveHandler.handleLeave(e.player.displayName.unformattedText)
|
||||
}
|
||||
|
||||
//FORGE-DEPENDENT
|
||||
|
|
|
@ -3,7 +3,6 @@ package matterlink
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent
|
||||
import cpw.mods.fml.common.gameevent.TickEvent
|
||||
import matterlink.bridge.ServerChatHandler
|
||||
import matterlink.bridge.USER_ACTION
|
||||
import matterlink.config.cfg
|
||||
import matterlink.handlers.*
|
||||
|
@ -11,7 +10,6 @@ import net.minecraft.command.server.CommandBroadcast
|
|||
import net.minecraft.command.server.CommandEmote
|
||||
import net.minecraft.entity.player.EntityPlayer
|
||||
import net.minecraft.entity.player.EntityPlayerMP
|
||||
import net.minecraft.server.MinecraftServer
|
||||
import net.minecraft.server.dedicated.DedicatedServer
|
||||
import net.minecraft.tileentity.TileEntityCommandBlock
|
||||
import net.minecraftforge.event.CommandEvent
|
||||
|
@ -44,7 +42,7 @@ object EventHandler {
|
|||
@SubscribeEvent
|
||||
fun chatEvent(e: ServerChatEvent) {
|
||||
ChatProcessor.sendToBridge(
|
||||
user = e.username,
|
||||
user = e.player.displayName,
|
||||
msg = e.message,
|
||||
event = ""
|
||||
)
|
||||
|
@ -55,12 +53,12 @@ object EventHandler {
|
|||
fun commandEvent(e: CommandEvent) {
|
||||
val sender = when {
|
||||
e.sender is DedicatedServer -> cfg.outgoing.systemUser
|
||||
e.sender is TileEntityCommandBlock -> "CommandBlock"
|
||||
else -> e.sender.commandSenderName
|
||||
}
|
||||
val args = e.parameters.joinToString(" ")
|
||||
val type = when {
|
||||
e.command is CommandEmote -> USER_ACTION
|
||||
e.command.commandName == "me" -> USER_ACTION
|
||||
e.command is CommandBroadcast -> ""
|
||||
else -> return
|
||||
}
|
||||
|
@ -96,7 +94,7 @@ object EventHandler {
|
|||
//FORGE-DEPENDENT
|
||||
@SubscribeEvent
|
||||
fun serverTickEvent(e: TickEvent.ServerTickEvent) {
|
||||
if(e.phase == TickEvent.Phase.END)
|
||||
if (e.phase == TickEvent.Phase.END)
|
||||
TickHandler.handleTick()
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@ pipeline {
|
|||
steps {
|
||||
sh './gradlew :1.7.10:setupCiWorkspace'
|
||||
sh './gradlew :1.7.10:clean'
|
||||
sh './gradlew :1.7.10:build -Pbuild_number=${BUILD_NUMBER}'
|
||||
sh './gradlew :1.7.10:build'
|
||||
archive '1.7.10/build/libs/*jar'
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ pipeline {
|
|||
steps {
|
||||
sh './gradlew :1.10.2:setupCiWorkspace'
|
||||
sh './gradlew :1.10.2:clean'
|
||||
sh './gradlew :1.10.2:build -Pbuild_number=${BUILD_NUMBER}'
|
||||
sh './gradlew :1.10.2:build'
|
||||
archive '1.10.2/build/libs/*jar'
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ pipeline {
|
|||
steps {
|
||||
sh './gradlew :1.11.2:setupCiWorkspace'
|
||||
sh './gradlew :1.11.2:clean'
|
||||
sh './gradlew :1.11.2:build -Pbuild_number=${BUILD_NUMBER}'
|
||||
sh './gradlew :1.11.2:build'
|
||||
archive '1.11.2/build/libs/*jar'
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ pipeline {
|
|||
steps {
|
||||
sh './gradlew :1.12.2:setupCiWorkspace'
|
||||
sh './gradlew :1.12.2:clean'
|
||||
sh './gradlew :1.12.2:build -Pbuild_number=${BUILD_NUMBER}'
|
||||
sh './gradlew :1.12.2:build'
|
||||
archive '1.12.2/build/libs/*jar'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ subprojects {
|
|||
apply plugin: "kotlin"
|
||||
apply plugin: "idea"
|
||||
|
||||
if (project.hasProperty('build_number')) {
|
||||
mod_version += "-build-$build_number"
|
||||
if (System.env.BUILD_NUMBER) {
|
||||
mod_version += "-${System.env.BUILD_NUMBER}"
|
||||
} else if (!project.hasProperty('release')) {
|
||||
mod_version += "-dev"
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import matterlink.instance
|
|||
import org.apache.http.HttpResponse
|
||||
import org.apache.http.client.HttpClient
|
||||
import org.apache.http.client.methods.HttpGet
|
||||
import org.apache.http.impl.client.CloseableHttpClient
|
||||
import org.apache.http.impl.client.HttpClients
|
||||
import java.io.BufferedReader
|
||||
|
||||
|
@ -41,7 +42,7 @@ class UpdateChecker : Thread() {
|
|||
|
||||
instance.info("Checking for new versions...")
|
||||
|
||||
val client: HttpClient = HttpClients.createDefault()
|
||||
val client = HttpClients.createDefault()
|
||||
val request = HttpGet("https://cursemeta.dries007.net/api/v2/direct/GetAllFilesForAddOn/287323")
|
||||
|
||||
with(instance) {
|
||||
|
|
Loading…
Reference in New Issue