diff --git a/.gitignore b/.gitignore index 83ec3ad..5affd90 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ ### Minecraft template # Don't sync the run folder! /run/ +/classes/ +/*.json + ### Java template # Compiled class file *.class diff --git a/.idea/compiler.xml b/.idea/compiler.xml index e8bbc01..5968b79 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -12,9 +12,9 @@ - - - + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index da46dcb..db695ad 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,6 +8,6 @@ - + \ No newline at end of file diff --git a/.idea/modules/DebugServerInfo.iml b/.idea/modules/DebugServerInfo.iml index 9affd70..b1e1d5d 100644 --- a/.idea/modules/DebugServerInfo.iml +++ b/.idea/modules/DebugServerInfo.iml @@ -1,10 +1,11 @@ - + + diff --git a/.idea/modules/DebugServerInfo_api.iml b/.idea/modules/DebugServerInfo_api.iml index 5b0e309..f93260d 100644 --- a/.idea/modules/DebugServerInfo_api.iml +++ b/.idea/modules/DebugServerInfo_api.iml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,21 @@ - + + + + @@ -39,40 +53,41 @@ - + - + - + - + - - - - - - + + + + + + - - - + + + - - - + + + + - + @@ -95,6 +110,7 @@ + diff --git a/.idea/modules/DebugServerInfo_main.iml b/.idea/modules/DebugServerInfo_main.iml index 5a1839b..d4fd155 100644 --- a/.idea/modules/DebugServerInfo_main.iml +++ b/.idea/modules/DebugServerInfo_main.iml @@ -1,5 +1,5 @@ - + @@ -13,25 +13,26 @@ - - + - + + @@ -41,7 +42,6 @@ - @@ -54,40 +54,41 @@ - + - + - + - + - - - - - - + + + + + + - - - + + + - - - + + + + - + @@ -110,6 +111,7 @@ + @@ -121,7 +123,7 @@ - + diff --git a/.idea/modules/DebugServerInfo_test.iml b/.idea/modules/DebugServerInfo_test.iml index 9a1c54f..d942f35 100644 --- a/.idea/modules/DebugServerInfo_test.iml +++ b/.idea/modules/DebugServerInfo_test.iml @@ -1,5 +1,5 @@ - + @@ -10,7 +10,21 @@ - + + + + @@ -41,40 +55,41 @@ - + - + - + - + - - - - - - + + + + + + - - - + + + - - - + + + + - + @@ -97,6 +112,7 @@ + diff --git a/build.gradle b/build.gradle index 6da6a02..ac0224e 100644 --- a/build.gradle +++ b/build.gradle @@ -29,13 +29,17 @@ buildscript { } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" + classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" } } +import groovy.json.JsonBuilder +import groovy.json.JsonOutput +import groovy.json.JsonSlurper + apply plugin: "net.minecraftforge.gradle.forge" -sourceCompatibility = targetCompatibility = "1.7" +sourceCompatibility = targetCompatibility = "1.8" version = modVersion group = modGroup @@ -79,6 +83,35 @@ processResources { from(sourceSets.main.resources.srcDirs) { exclude "mcmod.info" } + + doLast { + def updateFile = new File(project.archivesBaseName + '.json') + def json; + if (updateFile.exists()) { + json = new JsonSlurper().parseText(updateFile.getText()) + } + else { + def builder = new JsonBuilder() + json = builder( + homepage: "https://github.com/" + project.githubOrg + "/" + project.archivesBaseName, + promos: new HashMap<>() + ) + } + def outStream = new ByteArrayOutputStream() + def result = exec { + executable = 'git' + args = [ 'log', '-n', '1', "--format='%B'"] + standardOutput = outStream + } + def fullLog = outStream.toString().replaceAll("^\\s*'\\s*|\\s*'\\s*\$", "").replaceAll("[\\r\\n]+", "\n") + + json['promos'][project.minecraft.version + '-latest'] = project.version + json['promos'][project.minecraft.version + '-recomended'] = project.version + if (!json.containsKey(project.minecraft.version)) json.put(project.minecraft.version, new HashMap<>()) + def version = json[project.minecraft.version] + version.put(project.version, fullLog) + updateFile.write JsonOutput.prettyPrint(JsonOutput.toJson(json)) + } } tasks.withType(Jar) { diff --git a/gradle.properties b/gradle.properties index f1b34d6..7579b35 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,5 +23,6 @@ modGroup=net.dries007.dsi modVersion=1.0.4 modBaseName=DebugServerInfo -forgeVersion=1.10.2-12.18.3.2185 -mcpVersion=stable_29 +forgeVersion=1.12-14.21.1.2426 +mcpVersion=snapshot_20170624 +githubOrg=dries007 diff --git a/run/server.properties b/run/server.properties index cb92e81..390b226 100644 --- a/run/server.properties +++ b/run/server.properties @@ -1,55 +1,39 @@ -# -# Copyright (c) 2017 Dries K. aka Dries007 -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. -# - #Minecraft server properties -#Fri Apr 07 14:28:43 CEST 2017 +#Sun Jul 30 15:07:31 CEST 2017 +spawn-protection=0 +max-tick-time=-1 generator-settings= -use-native-transport=true -op-permission-level=4 -level-name=world -allow-flight=false -announce-player-achievements=true -server-port=25565 -level-type=DEFAULT -level-seed= force-gamemode=false -server-ip= -network-compression-threshold=256 -max-build-height=256 -spawn-npcs=true -white-list=false -spawn-animals=true -snooper-enabled=false -resource-pack-sha1= -online-mode=false -resource-pack= -pvp=true -difficulty=1 -enable-command-block=true +allow-nether=true gamemode=0 +enable-query=false player-idle-timeout=0 +difficulty=1 +spawn-monsters=true +op-permission-level=4 +pvp=true +snooper-enabled=false +level-type=DEFAULT +hardcore=false +enable-command-block=true max-players=5 -max-tick-time=-1 +network-compression-threshold=256 +resource-pack-sha1= +max-world-size=29999984 +server-port=25565 +server-ip= +spawn-npcs=true +allow-flight=false +level-name=world view-distance=10 +resource-pack= +spawn-animals=true +white-list=false generate-structures=true -spawn-protection=0 +online-mode=false +max-build-height=256 +level-seed= +prevent-proxy-connections=false +use-native-transport=true motd=test server please ignore +enable-rcon=false diff --git a/src/main/java/net/dries007/dsi/DebugServerInfo.java b/src/main/java/net/dries007/dsi/DebugServerInfo.java index 5681231..de3d201 100644 --- a/src/main/java/net/dries007/dsi/DebugServerInfo.java +++ b/src/main/java/net/dries007/dsi/DebugServerInfo.java @@ -38,12 +38,7 @@ import net.minecraftforge.fml.relauncher.Side; import org.apache.logging.log4j.Logger; -@Mod( - modid = DebugServerInfo.MOD_ID, - name = DebugServerInfo.MOD_NAME, - acceptableRemoteVersions = "*", - guiFactory = "net.dries007.dsi.client.ConfigGuiFactory" -) +@Mod(modid = DebugServerInfo.MOD_ID, name = DebugServerInfo.MOD_NAME, acceptableRemoteVersions = "*", guiFactory = "net.dries007.dsi.client.ConfigGuiFactory") public class DebugServerInfo { public static final String MOD_ID = "debugserverinfo"; diff --git a/src/main/java/net/dries007/dsi/client/ConfigGuiFactory.java b/src/main/java/net/dries007/dsi/client/ConfigGuiFactory.java index 4405e4a..ffb8e5e 100644 --- a/src/main/java/net/dries007/dsi/client/ConfigGuiFactory.java +++ b/src/main/java/net/dries007/dsi/client/ConfigGuiFactory.java @@ -40,6 +40,7 @@ /** * @author Dries007 */ +@SuppressWarnings("unused") @SideOnly(Side.CLIENT) public class ConfigGuiFactory implements IModGuiFactory { @@ -50,22 +51,21 @@ public void initialize(Minecraft minecraftInstance) } @Override - public Class mainConfigGuiClass() + public Set runtimeGuiCategories() { - return ConfigGuiScreen.class; + return null; } @Override - public Set runtimeGuiCategories() + public boolean hasConfigGui() { - return null; + return true; } - @SuppressWarnings("deprecation") @Override - public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) + public GuiScreen createConfigGui(GuiScreen parentScreen) { - return null; + return new ConfigGuiScreen(parentScreen); } public static class ConfigGuiScreen extends GuiConfig diff --git a/src/main/java/net/dries007/dsi/network/Request.java b/src/main/java/net/dries007/dsi/network/Request.java index 539581e..5227be3 100644 --- a/src/main/java/net/dries007/dsi/network/Request.java +++ b/src/main/java/net/dries007/dsi/network/Request.java @@ -65,7 +65,7 @@ public static class Handler implements IMessageHandler @Override public Data onMessage(Request message, MessageContext ctx) { - ctx.getServerHandler().playerEntity.getEntityData().setInteger(NBT_COUNTER, message.time); + ctx.getServerHandler().player.getEntityData().setInteger(NBT_COUNTER, message.time); return null; } } diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 86398ba..cfba763 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -5,16 +5,13 @@ "description": "Display some server info in the F3 debug info", "version": "${version}", "mcversion": "${mcversion}", - "url": "https://mc.dries007.net/DebugServerInfo", - "updateUrl": "https://mc.dries007.net/DebugServerInfo/update.json", + "url": "https://github.com/dries007/DebugServerInfo", + "updateUrl": "https://mc.dries007.net/DebugServerInfo.json", "authorList": [ "Dries007" ], "credits": "", "logoFile": "", - "screenshots": [], - "dependencies": [ - "forge" - ] + "screenshots": [] } ]