diff --git a/1.7.10/build.gradle b/1.7.10/build.gradle deleted file mode 100644 index 307d3d4..0000000 --- a/1.7.10/build.gradle +++ /dev/null @@ -1,117 +0,0 @@ -buildscript { - repositories { - jcenter() - maven { - url = 'http://files.minecraftforge.net/maven' - } - mavenCentral() - maven { - url = 'https://plugins.gradle.org/m2/' - } - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '1.2-SNAPSHOT' - classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version - } -} - -apply plugin: 'forge' -apply plugin: 'com.matthewprenger.cursegradle' - -version = project.mc_version + '-' + project.mod_version - -archivesBaseName = project.mod_name - -sourceCompatibility = targetCompatibility = '1.8' - -configurations { - shade - compile.extendsFrom shade -} - -dependencies { - shade project(':core') - shade project(':api') - shade project(':Jankson') -} - -minecraft { - version = project.mc_version + '-' + project.forge_version + '-' + project.mc_version - runDir = 'run' - - mappings = project.mcp_mappings - - srgExtra 'PK: kotlin matterlink/repack/kotlin' - srgExtra 'PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations' - srgExtra 'PK: org/intellij matterlink/repack/org/intellij' - srgExtra 'PK: blue/endless matterlink/repack/blue/endless' -} - -compileKotlin.doFirst { - def target = 'src/main/kotlin/matterlink/gen' - copy { - from('src/templates/kotlin/matterlink/Constants.kt') - into(target) - } - ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) { - fileset(dir: target, includes: 'Constants.kt') - } - ant.replaceregexp(match: '@MCVERSION@', replace: project.mc_version, flags: 'g', byline: true) { - fileset(dir: target, includes: 'Constants.kt') - } - ant.replaceregexp(match: '@FORGELIN-VERSION@', replace: project.forgelin_version, flags: 'g', byline: true) { - fileset(dir: target, includes: 'Constants.kt') - } - ant.replaceregexp(match: '@FORGE-VERSION@', replace: project.forge_version, flags: 'g', byline: true) { - fileset(dir: target, includes: 'Constants.kt') - } - ant.replaceregexp(match: '@BUILD_NUMBER@', replace: System.env.BUILD_NUMBER ?: -1, flags: 'g', byline: true) { - fileset(dir: target, includes: 'Constants.kt') - } -} - -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.mod_version - inputs.property 'mcversion', project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(project(':core').sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version': project.mod_version, 'mcversion': project.minecraft.version - } - - // copy everything else except the mcmod.info - from(project(':core').sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } -} - -jar { - configurations.shade.each { dep -> - from(project.zipTree(dep)) { - exclude 'META-INF', 'META-INF/**' - exclude 'com/google/gson', 'com/google/gson/**' - } - } -} - -curseforge { - if (project.hasProperty('CURSEFORGE_API_TOKEN') && project.hasProperty('release')) { - apiKey = CURSEFORGE_API_TOKEN - } - project { - id = project.curse_id - releaseType = project.curse_release_type - if (project.hasProperty('changelog_file')) { - println("changelog = $changelog_file") - changelogType = 'markdown' - changelog = file(changelog_file) - } - mainArtifact(jar) { - displayName = "MatterLink $version" - } - } -} \ No newline at end of file diff --git a/1.7.10/gradle.properties b/1.7.10/gradle.properties deleted file mode 100644 index f7103cd..0000000 --- a/1.7.10/gradle.properties +++ /dev/null @@ -1,3 +0,0 @@ -mc_version = 1.7.10 -mcp_mappings = stable_12 -forge_version = 10.13.4.1614 diff --git a/1.7.10/src/main/kotlin/matterlink/EventHandler.kt b/1.7.10/src/main/kotlin/matterlink/EventHandler.kt deleted file mode 100644 index d6365f0..0000000 --- a/1.7.10/src/main/kotlin/matterlink/EventHandler.kt +++ /dev/null @@ -1,101 +0,0 @@ -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.api.ApiMessage.Companion.USER_ACTION -import matterlink.config.cfg -import matterlink.handlers.* -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.dedicated.DedicatedServer -import net.minecraftforge.event.CommandEvent -import net.minecraftforge.event.ServerChatEvent -import net.minecraftforge.event.entity.living.LivingDeathEvent -import net.minecraftforge.event.entity.player.AchievementEvent - -//FORGE-DEPENDENT -object EventHandler { - - //MC-VERSION & FORGE DEPENDENT - @SubscribeEvent - fun progressEvent(e: AchievementEvent) { - val achievement = e.achievement - val entityPlayer = e.entityPlayer as? EntityPlayerMP ?: return - val statFile = entityPlayer.statFile - - if (!statFile.canUnlockAchievement(achievement) || statFile.hasAchievementUnlocked(achievement)) { - return - } - - ProgressHandler.handleProgress( - name = e.entityPlayer.displayName, - message = "has earned the achievement", - display = e.achievement.statName.unformattedText - ) - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun chatEvent(e: ServerChatEvent) { - if(e.isCanceled) return - e.isCanceled = ChatProcessor.sendToBridge( - user = e.player.displayName, - msg = e.message, - event = "", - uuid = e.player.gameProfile.id - ) - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun commandEvent(e: CommandEvent) { - val sender = when { - e.sender is DedicatedServer -> cfg.outgoing.systemUser - 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 - } - ChatProcessor.sendToBridge(user = sender, msg = args, event = type) - - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun deathEvent(e: LivingDeathEvent) { - if (e.entityLiving is EntityPlayer) { - val player = e.entityLiving as EntityPlayer - DeathHandler.handleDeath( - player = player.displayName, - deathMessage = e.entityLiving.combatTracker.func_151521_b().unformattedText, - damageType = e.source.damageType - ) - } - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun joinEvent(e: PlayerEvent.PlayerLoggedInEvent) { - JoinLeaveHandler.handleJoin(e.player.displayName) - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun leaveEvent(e: PlayerEvent.PlayerLoggedOutEvent) { - JoinLeaveHandler.handleLeave(e.player.displayName) - } - - //FORGE-DEPENDENT - @SubscribeEvent - fun serverTickEvent(e: TickEvent.ServerTickEvent) { - if (e.phase == TickEvent.Phase.END) - TickHandler.handleTick() - } -} \ No newline at end of file diff --git a/1.7.10/src/main/kotlin/matterlink/MatterLink.kt b/1.7.10/src/main/kotlin/matterlink/MatterLink.kt deleted file mode 100644 index 13da1b6..0000000 --- a/1.7.10/src/main/kotlin/matterlink/MatterLink.kt +++ /dev/null @@ -1,127 +0,0 @@ -package matterlink - -import com.mojang.authlib.GameProfile -import cpw.mods.fml.common.FMLCommonHandler -import cpw.mods.fml.common.Mod -import cpw.mods.fml.common.event.FMLInitializationEvent -import cpw.mods.fml.common.event.FMLPreInitializationEvent -import cpw.mods.fml.common.event.FMLServerStartingEvent -import cpw.mods.fml.common.event.FMLServerStoppingEvent -import matterlink.bridge.command.IBridgeCommand -import matterlink.command.AuthCommand -import matterlink.command.MatterLinkCommand -import matterlink.command.MatterLinkCommandSender -import matterlink.config.BaseConfig -import matterlink.config.cfg -import net.minecraft.entity.player.EntityPlayerMP -import net.minecraft.server.MinecraftServer -import net.minecraft.util.ChatComponentText -import net.minecraftforge.common.ForgeVersion -import net.minecraftforge.common.MinecraftForge -import java.util.* - -@Mod( - modid = MODID, - name = NAME, version = MODVERSION, - useMetadata = true, - acceptableRemoteVersions = "*" -) -class MatterLink : IMatterLink() { - init { - instance = this - } - - @Mod.EventHandler - fun preInit(event: FMLPreInitializationEvent) { - MinecraftForge.EVENT_BUS.register(EventHandler) - FMLCommonHandler.instance().bus().register(EventHandler) - - logger = event.modLog as org.apache.logging.log4j.core.Logger - logger.info("Building bridge!") - - cfg = BaseConfig(event.modConfigurationDirectory).load() - } - - @Mod.EventHandler - fun init(event: FMLInitializationEvent) { - this.registerBridgeCommands() - } - - @Mod.EventHandler - fun serverStarting(event: FMLServerStartingEvent) { - logger.debug("Registering server commands") - event.registerServerCommand(MatterLinkCommand()) - event.registerServerCommand(AuthCommand()) - start() - } - - @Mod.EventHandler - fun serverStopping(event: FMLServerStoppingEvent) { - stop() - } - - //FORGE-DEPENDENT - override fun wrappedSendToPlayers(msg: String) { - MinecraftServer.getServer().configurationManager.sendChatMsg(ChatComponentText(msg)) - } - - override fun wrappedSendToPlayer(username: String, msg: String) { - val profile = profileByName(username) ?: run { - logger.error("cannot find player by name $username") - return - } - val player = playerByProfile(profile) ?: run { - logger.error("${profile.name} is not online") - return - } - player.addChatMessage(ChatComponentText(msg)) - } - - override fun wrappedSendToPlayer(uuid: UUID, msg: String) { - val profile = profileByUUID(uuid) ?: run { - logger.error("cannot find player by uuid $uuid") - return - } - val player = playerByProfile(profile) ?: run { - logger.error("${profile.name} is not online") - return - } - player.addChatMessage(ChatComponentText(msg)) - } - - override fun isOnline(username: String) = (FMLCommonHandler.instance() - .minecraftServerInstance.configurationManager.getPlayerByUsername(username) ?: null) != null - - private fun playerByProfile(gameProfile: GameProfile): EntityPlayerMP? { - return FMLCommonHandler.instance().minecraftServerInstance.configurationManager.createPlayerForUser(gameProfile) - } - - private fun profileByUUID(uuid: UUID): GameProfile? = try { - FMLCommonHandler.instance().minecraftServerInstance.playerProfileCache.func_152652_a(uuid) - } catch (e: IllegalArgumentException) { - logger.warn("cannot find profile by uuid $uuid") - null - } - - private fun profileByName(username: String): GameProfile? = try { - FMLCommonHandler.instance().minecraftServerInstance.playerProfileCache.getGameProfileForUsername(username) - } catch (e: IllegalArgumentException) { - logger.warn("cannot find profile by username $username") - null - } - - override fun nameToUUID(username: String): UUID? = profileByName(username)?.id - - override fun uuidToName(uuid: UUID): String? = profileByUUID(uuid)?.name - - override fun commandSenderFor( - user: String, - env: IBridgeCommand.CommandEnvironment, - op: Boolean - ) = MatterLinkCommandSender(user, env, op) - - override val mcVersion: String = MCVERSION - override val modVersion: String = MODVERSION - override val buildNumber = BUILD_NUMBER - override val forgeVersion = ForgeVersion.getVersion() -} diff --git a/1.7.10/src/main/kotlin/matterlink/command/AuthCommand.kt b/1.7.10/src/main/kotlin/matterlink/command/AuthCommand.kt deleted file mode 100644 index 881cc9a..0000000 --- a/1.7.10/src/main/kotlin/matterlink/command/AuthCommand.kt +++ /dev/null @@ -1,35 +0,0 @@ -package matterlink.command - -import net.minecraft.command.CommandBase -import net.minecraft.command.ICommandSender -import net.minecraft.command.WrongUsageException -import net.minecraft.entity.player.EntityPlayer -import net.minecraft.util.ChatComponentText - - -class AuthCommand : CommandBase() { - override fun getCommandName(): String { - return CommandCoreAuth.name - } - - override fun getCommandUsage(sender: ICommandSender): String { - return CommandCoreAuth.usage - } - - override fun getCommandAliases(): List { - return CommandCoreAuth.aliases - } - - override fun processCommand(sender: ICommandSender, args: Array) { - if (args.isEmpty()) { - throw WrongUsageException("Invalid command! Valid uses: ${this.getCommandUsage(sender)}") - } - - val uuid = (sender as? EntityPlayer)?.uniqueID?.toString() - val reply = CommandCoreAuth.execute(args, sender.commandSenderName, uuid) - - if (reply.isNotEmpty()) { - sender.addChatMessage(ChatComponentText(reply)) - } - } -} diff --git a/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommand.kt b/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommand.kt deleted file mode 100644 index 592b00c..0000000 --- a/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommand.kt +++ /dev/null @@ -1,35 +0,0 @@ -package matterlink.command - -import net.minecraft.command.CommandBase -import net.minecraft.command.ICommandSender -import net.minecraft.command.WrongUsageException -import net.minecraft.entity.player.EntityPlayer -import net.minecraft.util.ChatComponentText - - -class MatterLinkCommand : CommandBase() { - override fun getCommandName(): String { - return CommandCoreML.name - } - - override fun getCommandUsage(sender: ICommandSender): String { - return CommandCoreML.usage - } - - override fun getCommandAliases(): List { - return CommandCoreML.aliases - } - - override fun processCommand(sender: ICommandSender, args: Array) { - if (args.isEmpty()) { - throw WrongUsageException("Invalid command! Valid uses: ${this.getCommandUsage(sender)}") - } - - val uuid = (sender as? EntityPlayer)?.uniqueID?.toString() - val reply = CommandCoreML.execute(args, sender.commandSenderName, uuid) - - if (reply.isNotEmpty()) { - sender.addChatMessage(ChatComponentText(reply)) - } - } -} diff --git a/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommandSender.kt b/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommandSender.kt deleted file mode 100644 index 564e697..0000000 --- a/1.7.10/src/main/kotlin/matterlink/command/MatterLinkCommandSender.kt +++ /dev/null @@ -1,46 +0,0 @@ -package matterlink.command - -import matterlink.bridge.command.IBridgeCommand -import matterlink.bridge.command.IMinecraftCommandSender -import net.minecraft.command.ICommandSender -import net.minecraft.server.MinecraftServer -import net.minecraft.util.ChatComponentText -import net.minecraft.util.ChunkCoordinates -import net.minecraft.util.IChatComponent -import net.minecraft.world.World - -class MatterLinkCommandSender( - user: String, - env: IBridgeCommand.CommandEnvironment, - op: Boolean) : IMinecraftCommandSender(user, env, op), ICommandSender { - - override fun execute(cmdString: String): Boolean { - return 0 < MinecraftServer.getServer().commandManager.executeCommand( - this, - cmdString - ).apply { - sendReply(cmdString) - } - } - - override fun getFormattedCommandSenderName(): IChatComponent { - return ChatComponentText(displayName) - } - - override fun getCommandSenderName() = accountName - - override fun getEntityWorld(): World { - return MinecraftServer.getServer().worldServerForDimension(0) - } - - override fun canCommandSenderUseCommand(permLevel: Int, commandName: String): Boolean { - //we do permission - return canExecute(commandName) - } - - override fun addChatMessage(component: IChatComponent) { - appendReply(component.unformattedText) - } - - override fun getCommandSenderPosition(): ChunkCoordinates = ChunkCoordinates(0, 0, 0) -} \ No newline at end of file diff --git a/1.7.10/src/templates/kotlin/matterlink/Constants.kt b/1.7.10/src/templates/kotlin/matterlink/Constants.kt deleted file mode 100644 index ad1e302..0000000 --- a/1.7.10/src/templates/kotlin/matterlink/Constants.kt +++ /dev/null @@ -1,7 +0,0 @@ -package matterlink - -const val MODID = "matterlink" -const val NAME = "MatterLink" -const val MODVERSION = "@MODVERSION@" -const val MCVERSION = "@MCVERSION@" -const val BUILD_NUMBER = @BUILD_NUMBER@ diff --git a/Jenkinsfile b/Jenkinsfile index 2dfd40b..4bf8d5d 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,14 +6,6 @@ pipeline { sh 'git submodule update --init --recursive' } } - stage("1.7.10") { - steps { - sh './gradlew :1.7.10:setupCiWorkspace' - sh './gradlew :1.7.10:clean' - sh './gradlew :1.7.10:build' - archiveArtifacts artifacts: '1.7.10/build/libs/*jar' - } - } stage("1.10.2") { steps { sh './gradlew :1.10.2:setupCiWorkspace' diff --git a/README.md b/README.md index 2684ba7..ac8c91c 100644 --- a/README.md +++ b/README.md @@ -32,8 +32,6 @@ Chat with us on IRC: [#matterlink @ irc.esper.net](irc://irc.esper.net/matterlin [![Download 1.10.2](https://curse.nikky.moe/api/img/287323?logo&style=for-the-badge&version=1.10.2)](https://curse.nikky.moe/api/url/287323?version=1.10.2) -[![Download 1.7.10](https://curse.nikky.moe/api/img/287323?logo&style=for-the-badge&version=1.7.10)](https://curse.nikky.moe/api/url/287323?version=1.7.10) - ## Dependencies [![Forgelin Files](https://curse.nikky.moe/api/img/248453/files?logo&style=for-the-badge)](https://minecraft.curseforge.com/projects/248453/files) diff --git a/settings.gradle b/settings.gradle index 6755ab8..6d6a07a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ rootProject.name = 'MatterLink' include 'core', 'api' include 'Jankson' -include '1.12.2', '1.11.2', '1.10.2', '1.7.10' \ No newline at end of file +include '1.12.2', '1.11.2', '1.10.2' \ No newline at end of file