From cec05ffb4021d38c5ee9d1a0a3185700bc1e1a1c Mon Sep 17 00:00:00 2001 From: Dennis Bonke <dennisb@kabelfoon.net> Date: Thu, 5 Oct 2017 16:07:27 +0200 Subject: [PATCH] Added an about command, also hopefully fixed build.gradle and sped up the gitlab-ci... --- .gitlab-ci.yml | 26 +++---- VERSION | 2 +- build.gradle | 2 +- .../java/com/advancedmods/amcore/AMCore.java | 18 ++++- .../amcore/common/command/CommandAbout.java | 74 +++++++++++++++++++ .../core/environment/EnviromentChecks.java | 5 ++ 6 files changed, 110 insertions(+), 17 deletions(-) create mode 100644 src/main/java/com/advancedmods/amcore/common/command/CommandAbout.java diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b2bca60..371f479 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -25,7 +25,7 @@ stages: setup-workspace: stage: setup - script: ./gradlew -i setupDecompWorkspace -Pmaven_pass=$MAVEN_PASS + script: ./gradlew -i setupDevWorkspace -Pmaven_pass=$MAVEN_PASS cache: key: "$CI_COMMIT_REF_NAME" policy: push @@ -36,22 +36,22 @@ setup-workspace: build-jar: stage: build script: ./gradlew -i build -Pmaven_pass=$MAVEN_PASS - cache: - key: "$CI_COMMIT_REF_NAME" - policy: push - paths: - - build - - .gradle + #cache: + # key: "$CI_COMMIT_REF_NAME" + # policy: push + # paths: + # - build + # - .gradle deploy-to-maven: stage: deploy script: ./gradlew -i uploadArchives -Pmaven_pass=$MAVEN_PASS - cache: - key: "$CI_COMMIT_REF_NAME" - policy: push - paths: - - build - - .gradle + #cache: + # key: "$CI_COMMIT_REF_NAME" + # policy: push + # paths: + # - build + # - .gradle diff --git a/VERSION b/VERSION index 11f40b6..e844bbb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.7.10R0.2.1B4 Beta 4! Now with better environment checks!. \ No newline at end of file +1.7.10R0.2.2B1 Beta 1! Now with better environment checks!. \ No newline at end of file diff --git a/build.gradle b/build.gradle index da34a86..c5c9667 100644 --- a/build.gradle +++ b/build.gradle @@ -40,7 +40,7 @@ else }*/ //project.ext.maven_pass="" -project.buildnumber = "3" +project.buildnumber = "4" version = "1.7.10-0.2.2-B1" + "-" + project.buildnumber group= "com.advancedmods" // http://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/com/advancedmods/amcore/AMCore.java b/src/main/java/com/advancedmods/amcore/AMCore.java index 7bd0398..bca9b82 100644 --- a/src/main/java/com/advancedmods/amcore/AMCore.java +++ b/src/main/java/com/advancedmods/amcore/AMCore.java @@ -2,6 +2,7 @@ package com.advancedmods.amcore; import com.advancedmods.amcore.common.CommonPlayerTracker; import com.advancedmods.amcore.common.CommonProxy; +import com.advancedmods.amcore.common.command.CommandAbout; import com.advancedmods.amcore.common.handler.ConfigurationHandler; import com.advancedmods.amcore.core.AMCoreProps; import com.advancedmods.amcore.core.environment.EnviromentChecks; @@ -19,6 +20,8 @@ import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLLoadCompleteEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.registry.ExistingSubstitutionException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -42,8 +45,8 @@ public class AMCore extends BaseMod { //public static final String downloadURL = "http://ci.zsinfo.nl/job/AMCore/lastSuccessfulBuild/"; public static final String issueURL = "http://git.zsinfo.nl/advanced-mods/AMCore/issues"; // TODO: Look at these addresses and update if appropriate! - public static final String updateURL = "http://git.zsinfo.nl/advanced-mods/AMCore"; - public static final String downloadURL = "http://git.zsinfo.nl/advanced-mods/AMCore"; + public static final String updateURL = "http://git.zsinfo.nl/advanced-mods/AMCore/tree/master/VERSION"; + public static final String downloadURL = "http://git.zsinfo.nl/advanced-mods/AMCore/pipelines"; //public static final String downloadURL = "https://github.com/AdvancedMods/AMCore/releases"; public static ConfigurationHandler config; @@ -196,6 +199,17 @@ public class AMCore extends BaseMod { } } + @EventHandler + public void serverStarting(FMLServerStartingEvent event) { + try { + log.info("Registering commands..."); + event.registerServerCommand(new CommandAbout()); + log.info("Commands registered."); + } catch (Exception e) { + e.printStackTrace(); + } + } + @Override public String getModId() { return AMCoreProps.modid; diff --git a/src/main/java/com/advancedmods/amcore/common/command/CommandAbout.java b/src/main/java/com/advancedmods/amcore/common/command/CommandAbout.java new file mode 100644 index 0000000..e55e600 --- /dev/null +++ b/src/main/java/com/advancedmods/amcore/common/command/CommandAbout.java @@ -0,0 +1,74 @@ +package com.advancedmods.amcore.common.command; + +import com.advancedmods.amcore.AMCore; +import net.minecraft.command.ICommand; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; +import net.minecraft.world.World; + +import java.util.ArrayList; +import java.util.List; + +/** + * Created by Dennis on 5-10-2017. + */ +public class CommandAbout implements ICommand { + + private final List aliases; + + public CommandAbout() { + aliases = new ArrayList(); + aliases.add("amab"); + } + + @Override + public String getCommandName() { + return "advancedmods_about"; + } + + @Override + public String getCommandUsage(ICommandSender p_71518_1_) { + return "advancedmods_about"; + } + + @Override + public List getCommandAliases() { + return this.aliases; + } + + @Override + public void processCommand(ICommandSender sender, String[] argString) { + World world = sender.getEntityWorld(); + if(world.isRemote) { + AMCore.log.warn("Client side not processing, I suppose..."); + } else { + AMCore.log.info("Processing... (server side)"); + if(argString.length != 0) { + sender.addChatMessage(new ChatComponentText("Invalid argument, no argument required!")); + return; + } + + sender.addChatMessage(new ChatComponentText("Advanced Mods, brought to you by Dennisbonke, Zandor300 and Poedermoeder0174!")); + } + } + + @Override + public boolean canCommandSenderUseCommand(ICommandSender p_71519_1_) { + return true; + } + + @Override + public List addTabCompletionOptions(ICommandSender p_71516_1_, String[] p_71516_2_) { + return null; + } + + @Override + public boolean isUsernameIndex(String[] p_82358_1_, int p_82358_2_) { + return false; + } + + @Override + public int compareTo(Object o) { + return 0; + } +} diff --git a/src/main/java/com/advancedmods/amcore/core/environment/EnviromentChecks.java b/src/main/java/com/advancedmods/amcore/core/environment/EnviromentChecks.java index f94f52a..b3530ef 100644 --- a/src/main/java/com/advancedmods/amcore/core/environment/EnviromentChecks.java +++ b/src/main/java/com/advancedmods/amcore/core/environment/EnviromentChecks.java @@ -30,7 +30,9 @@ public class EnviromentChecks { try { if ((FMLCommonHandler.instance().getSidedDelegate().getSide() == Side.CLIENT) && ((FMLClientHandler.instance().hasOptifine()) || (Loader.isModLoaded("optifine")))) { hasOptifine = true; + log.warn("=============================WARNING!============================="); log.warn("Optifine has been detected on your Minecraft installation, this can cause (rendering) issues due to base edits and / or ASM usage!"); + log.warn("=============================WARNING!============================="); } else { hasOptifine = false; } @@ -49,6 +51,9 @@ public class EnviromentChecks { try { if (ObfUtil.isObf() == true) { + log.warn("=============================WARNING!============================="); + log.warn("We are running in an deobfuscated environment, I hope you know what you are doing!"); + log.warn("=============================WARNING!============================="); isDeobf = true; } else { isDeobf = false; -- GitLab