From dc2ed4824befa454b34204f129b44108965957e9 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Mon, 28 Dec 2020 18:53:55 +0100 Subject: [PATCH 1/9] test --- .../jadarstudios/developercapes/DevCapes.java | 159 ++++++++++++++++ .../developercapes/HDImageBuffer.java | 41 ++++ .../developercapes/RenderEventHandler.java | 39 ++++ .../developercapes/cape/AbstractCape.java | 42 +++++ .../developercapes/cape/CapeConfig.java | 27 +++ .../cape/CapeConfigManager.java | 176 ++++++++++++++++++ .../developercapes/cape/CapeManager.java | 81 ++++++++ .../developercapes/cape/ICape.java | 29 +++ .../developercapes/cape/StaticCape.java | 60 ++++++ .../developercapes/user/Group.java | 61 ++++++ .../developercapes/user/GroupManager.java | 93 +++++++++ .../developercapes/user/User.java | 28 +++ .../developercapes/user/UserManager.java | 82 ++++++++ 13 files changed, 918 insertions(+) create mode 100644 src/main/java/com/jadarstudios/developercapes/DevCapes.java create mode 100644 src/main/java/com/jadarstudios/developercapes/HDImageBuffer.java create mode 100644 src/main/java/com/jadarstudios/developercapes/RenderEventHandler.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/AbstractCape.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/CapeConfig.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/CapeConfigManager.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/CapeManager.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/ICape.java create mode 100644 src/main/java/com/jadarstudios/developercapes/cape/StaticCape.java create mode 100644 src/main/java/com/jadarstudios/developercapes/user/Group.java create mode 100644 src/main/java/com/jadarstudios/developercapes/user/GroupManager.java create mode 100644 src/main/java/com/jadarstudios/developercapes/user/User.java create mode 100644 src/main/java/com/jadarstudios/developercapes/user/UserManager.java diff --git a/src/main/java/com/jadarstudios/developercapes/DevCapes.java b/src/main/java/com/jadarstudios/developercapes/DevCapes.java new file mode 100644 index 00000000000..5539eb08499 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/DevCapes.java @@ -0,0 +1,159 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes; + +import com.jadarstudios.developercapes.cape.CapeConfig; +import com.jadarstudios.developercapes.cape.CapeConfigManager; +import net.minecraftforge.common.MinecraftForge; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.io.*; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; + +/** + * DeveloperCapes is a library for Minecraft. It allows developers to quickly add capes for players they specify. DevCapes uses Minecraft Forge. + * + * @author jadar + */ +public class DevCapes { + private static DevCapes instance; + + public static final Logger logger = LogManager.getLogger("DevCapes"); + + protected DevCapes() { + MinecraftForge.EVENT_BUS.register(new RenderEventHandler()); + } + + public static DevCapes getInstance() { + if (instance == null) { + instance = new DevCapes(); + } + return instance; + } + + /** + * InputStream.close() needs to be called on this after you're done! + * + * @return {@link InputStream} for the {@link URL} + */ + public InputStream getStreamForURL(URL url) { + InputStream is = null; + try { + URLConnection connection = url.openConnection(); + connection.setRequestProperty("User-Agent", System.getProperty("java.version")); + connection.connect(); + + is = connection.getInputStream(); + } catch (IOException e) { + e.printStackTrace(); + } + return is; + } + + /** + * InputStream.close() needs to be called on this after you're done! + * + * @return {@link InputStream} for the {@link File} + */ + public InputStream getStreamForFile(File file) { + InputStream is = null; + try { + is = new FileInputStream(file); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + return is; + } + + @Deprecated + /** + * DEPRECATED: Please use {@link #registerConfig(String jsonUrl)} instead.

+ * Registers a config with DevCapes. + * + * @param jsonUrl + * The URL as a String that links to the Json file that you want + * to add + * @param identifier + * A unique Identifier, normally your mod id + * @return The id of the registered config + */ + public int registerConfig(String jsonURL, String identifier) { + return this.registerConfig(jsonURL); + } + + /** + * Registers a config with DevCapes. + * + * @param jsonUrl The URL as a String that links to the Json file that you want + * to add + * @return The id of the registered config + */ + public int registerConfig(String jsonUrl) { + int id = -1; + try { + URL url = new URL(jsonUrl); + id = this.registerConfig(url); + } catch (MalformedURLException e) { + e.printStackTrace(); + } + return id; + } + + @Deprecated + /** + * DEPRECATED: Please use {@link #registerConfig(URL url)} instead.

+ * Registers a config with DevCapes. + * + * @param jsonUrl + * A {@link URL} that links to the Json file that you want to add + * @param identifier + * A unique Identifier, normally your mod id + * @return The id of the registered config + */ + public int registerConfig(URL url, String identifier) { + return this.registerConfig(url); + } + + /** + * Registers a config with DevCapes and returns the ID of the config. + * + * @param jsonUrl A {@link URL} that links to the Json file that you want to add + * @return The id of the registered config + */ + public int registerConfig(URL jsonUrl) { + int id = -1; + InputStream is = this.getStreamForURL(jsonUrl); + + if (is == null) { + DevCapes.logger.error(String.format("Unable to establish a connection to the server, %s", jsonUrl.getHost())); + return id; + } + + CapeConfig config = CapeConfigManager.getInstance().parse(is); + + try { + id = CapeConfigManager.getUniqueId(); + CapeConfigManager.getInstance().addConfig(id, config); + } catch (CapeConfigManager.InvalidCapeConfigIdException e) { + e.printStackTrace(); + } + + silentClose(is); + + return id; + } + + private static void silentClose(InputStream is) { + try { + is.close(); + } catch (IOException ignored) { + } + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/HDImageBuffer.java b/src/main/java/com/jadarstudios/developercapes/HDImageBuffer.java new file mode 100644 index 00000000000..884c8ca7c8a --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/HDImageBuffer.java @@ -0,0 +1,41 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 3.3.0.0 + */ +package com.jadarstudios.developercapes; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.renderer.IImageBuffer; + +import java.awt.Graphics; +import java.awt.image.BufferedImage; + +/** + * This class is an implementation of {@link IImageBuffer} that allows capes to be in HD + * + * @author Jadar + */ +@SideOnly(Side.CLIENT) +public class HDImageBuffer implements IImageBuffer { + @Override + public BufferedImage parseUserSkin(final BufferedImage texture) { + if (texture == null) + return null; + int imageWidth = texture.getWidth(null) <= 64 ? 64 : texture.getWidth(null); + int imageHeight = texture.getHeight(null) <= 32 ? 32 : texture.getHeight(null); + + BufferedImage capeImage = new BufferedImage(imageWidth, imageHeight, 2); + + Graphics graphics = capeImage.getGraphics(); + graphics.drawImage(texture, 0, 0, null); + graphics.dispose(); + + return capeImage; + } + + @Override + public void func_152634_a() {} +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/RenderEventHandler.java b/src/main/java/com/jadarstudios/developercapes/RenderEventHandler.java new file mode 100644 index 00000000000..4494c87e3e5 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/RenderEventHandler.java @@ -0,0 +1,39 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes; + +import com.jadarstudios.developercapes.cape.ICape; +import com.jadarstudios.developercapes.user.User; +import com.jadarstudios.developercapes.user.UserManager; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraftforge.client.event.RenderPlayerEvent; + +/** + * This is not the class you are looking for. + * + * @author jadar + */ +public class RenderEventHandler { + + @SubscribeEvent + public void renderPlayer(RenderPlayerEvent.Specials.Pre event) { + AbstractClientPlayer player = (AbstractClientPlayer) event.entityPlayer; + + UserManager manager = UserManager.getInstance(); + User user = manager.getUser(player.getUniqueID().toString()); + if (user == null) return; + + ICape cape = user.capes.get(0); + if (cape == null) return; + + boolean flag = cape.isTextureLoaded(player); + if (!flag) { + cape.loadTexture(player); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/AbstractCape.java b/src/main/java/com/jadarstudios/developercapes/cape/AbstractCape.java new file mode 100644 index 00000000000..075bc52df08 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/AbstractCape.java @@ -0,0 +1,42 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.util.ResourceLocation; + +/** + * Abstract Implementation of ICape used within Dev. Capes + * + * @author jadar + */ +public abstract class AbstractCape implements ICape { + protected String name; + protected ITextureObject texture; + protected ResourceLocation location; + + public AbstractCape(String name) { + this.name = name; + } + + public AbstractCape() {} + + @Override + public String getName() { + return name; + } + + @Override + public ITextureObject getTexture() { + return this.texture; + } + + @Override + public ResourceLocation getLocation() { + return this.location; + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/CapeConfig.java b/src/main/java/com/jadarstudios/developercapes/cape/CapeConfig.java new file mode 100644 index 00000000000..345bb1b1cfe --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/CapeConfig.java @@ -0,0 +1,27 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import com.jadarstudios.developercapes.user.Group; +import com.jadarstudios.developercapes.user.User; + +import java.util.HashMap; + +/** + * The players that need to be outfitted are stored here + * + * @author jadar + */ +public class CapeConfig { + public HashMap groups; + public HashMap users; + + public CapeConfig() { + groups = new HashMap(); + users = new HashMap(); + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/CapeConfigManager.java b/src/main/java/com/jadarstudios/developercapes/cape/CapeConfigManager.java new file mode 100644 index 00000000000..d91bc7f0afd --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/CapeConfigManager.java @@ -0,0 +1,176 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import com.google.common.collect.HashBiMap; +import com.google.common.primitives.UnsignedBytes; +import com.google.gson.Gson; +import com.google.gson.JsonSyntaxException; +import com.jadarstudios.developercapes.DevCapes; +import com.jadarstudios.developercapes.user.Group; +import com.jadarstudios.developercapes.user.GroupManager; +import com.jadarstudios.developercapes.user.User; +import com.jadarstudios.developercapes.user.UserManager; +import org.apache.commons.lang3.ObjectUtils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.BitSet; +import java.util.Map; + +/** + * All configs need a manager, this is it. + * + * @author jadar + */ +public class CapeConfigManager { + + protected static CapeConfigManager instance; + + protected static BitSet availableIds = new BitSet(256); + protected HashBiMap configs; + + static { + availableIds.clear(availableIds.size()); + } + + public CapeConfigManager() { + configs = HashBiMap.create(); + } + + public static CapeConfigManager getInstance() { + if (instance == null) { + instance = new CapeConfigManager(); + } + return instance; + } + + public void addConfig(int id, CapeConfig config) throws InvalidCapeConfigIdException { + int realId = claimId(id); + this.configs.put(realId, config); + addUsers(config.users); + addGroups(config.groups); + } + + protected void addUsers(Map users){ + try { + UserManager.getInstance().addUsers(users.values()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void addGroups(Map groups){ + try { + GroupManager.getInstance().addGroups(groups.values()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public CapeConfig getConfig(int id) { + return this.configs.get(id); + } + + public int getIdForConfig(CapeConfig config) { + return this.configs.inverse().get(config); + } + + public static int getUniqueId() { + return availableIds.nextClearBit(1); + } + + public static int claimId(int id) throws InvalidCapeConfigIdException { + if(id <= 0){ + throw new InvalidCapeConfigIdException("The config ID must be a positive non-zero integer"); + } + try { + UnsignedBytes.checkedCast(id); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } + + boolean isRegistered = availableIds.get(id); + if (isRegistered) { + throw new InvalidCapeConfigIdException(String.format("The config ID %d is already claimed.", id)); + } + + availableIds.set(id); + return id; + } + + public CapeConfig parse(InputStream is) { + if (is == null) { + throw new NullPointerException("Can not parse a null input stream!"); + } + + CapeConfig instance = new CapeConfig(); + InputStreamReader isr = new InputStreamReader(is); + + try { + Map entries = new Gson().fromJson(isr, Map.class); + + for (Map.Entry entry : entries.entrySet()) { + final String nodeName = entry.getKey(); + final Object obj = entry.getValue(); + if (obj instanceof Map) { + parseGroup(instance, nodeName, (Map) obj); + } else if (obj instanceof String) { + parseUser(instance, nodeName, (String) obj); + } + } + } catch (JsonSyntaxException e) { + DevCapes.logger.error("CapeConfig could not be parsed because:"); + e.printStackTrace(); + } + + return instance; + } + + protected void parseGroup(CapeConfig config, String node, Map group) { + Group g = GroupManager.getInstance().parse(node, group); + if (g != null) { + config.groups.put(g.name, g); + } + } + + protected void parseUser(CapeConfig config, String node, String user) { + User u = UserManager.getInstance().parse(node, user); + if (u != null) { + config.users.put(node, u); + } + } + + /** + * DEPRECATED! Please use {@link com.jadarstudios.developercapes.cape.CapeConfigManager#parse(java.io.InputStream is)} + * This will be removed in the next major release. + */ + @Deprecated + public CapeConfig parseFromStream(InputStream is) { + return this.parse(is); + } + + public static class InvalidCapeConfigIdException extends Exception { + public InvalidCapeConfigIdException() { + super(); + } + + public InvalidCapeConfigIdException(String s) { + super(s); + } + + public InvalidCapeConfigIdException(Throwable cause) { + super(cause); + } + + public InvalidCapeConfigIdException(String message, Throwable cause) { + super(message, cause); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/CapeManager.java b/src/main/java/com/jadarstudios/developercapes/cape/CapeManager.java new file mode 100644 index 00000000000..d0800375491 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/CapeManager.java @@ -0,0 +1,81 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import com.jadarstudios.developercapes.DevCapes; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; + +/** + * This manages all of the capes, be nice to it or you won't get one! + * + * @author jadar + */ +public class CapeManager { + + protected static CapeManager instance; + + private HashMap capes; + + public CapeManager() { + this.capes = new HashMap(); + } + + public static CapeManager getInstance() { + if (instance == null) { + instance = new CapeManager(); + } + return instance; + } + + public void addCape(ICape cape) { + if (!capes.containsValue(cape)) { + capes.put(cape.getName(), cape); + } + } + + public void addCapes(Collection capes) { + for (ICape c : capes) { + this.addCape(c); + } + } + + public ICape getCape(String capeName) { + return capes.get(capeName); + } + + public ICape newCape(String name) { + StaticCape cape = new StaticCape(name); + this.capes.put(name, cape); + return cape; + } + + public ICape parse(String name, Object object) { + ICape cape = null; + if(object instanceof String || object instanceof URL){ + cape = parse(name, object.toString()); + }else{ + DevCapes.logger.error(String.format("Cape, %s, could not be parsed because it is not in an accepted format!", object)); + } + return cape; + } + + protected ICape parse(String name, String url) { + ICape cape = null; + + try { + cape = new StaticCape(name, new URL(url)); + } catch (MalformedURLException e) { + DevCapes.logger.error(String.format("Are you crazy?? \"%s\" is not a valid URL!", url)); + e.printStackTrace(); + } + return cape; + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/ICape.java b/src/main/java/com/jadarstudios/developercapes/cape/ICape.java new file mode 100644 index 00000000000..79a652432eb --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/ICape.java @@ -0,0 +1,29 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.texture.ITextureObject; +import net.minecraft.util.ResourceLocation; + +/** + * Any class implementing this will be requested to act as a cape. + * + * @author jadar + */ +public interface ICape { + + public String getName(); + + public ITextureObject getTexture(); + + public ResourceLocation getLocation(); + + public void loadTexture(AbstractClientPlayer player); + + public boolean isTextureLoaded(AbstractClientPlayer player); +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/cape/StaticCape.java b/src/main/java/com/jadarstudios/developercapes/cape/StaticCape.java new file mode 100644 index 00000000000..1844f952874 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/cape/StaticCape.java @@ -0,0 +1,60 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.cape; + +import com.jadarstudios.developercapes.HDImageBuffer; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.AbstractClientPlayer; +import net.minecraft.client.renderer.ThreadDownloadImageData; +import net.minecraft.util.ResourceLocation; + +import java.net.URL; + +/** + * Default Cape implementation + * + * @author jadar + */ +public class StaticCape extends AbstractCape { + + public StaticCape(String name, URL url) { + this.setName(name); + this.setURL(url); + } + + public StaticCape(String name) { + this(name, null); + } + + @Override + public void loadTexture(AbstractClientPlayer player) { + ResourceLocation location = this.getLocation(); + player.func_152121_a(MinecraftProfileTexture.Type.CAPE, location); + + Minecraft.getMinecraft().renderEngine.loadTexture(location, this.getTexture()); + } + + @Override + public boolean isTextureLoaded(AbstractClientPlayer player) { + ResourceLocation cape = player.getLocationCape(); + return cape != null; + } + + public void setURL(URL url) { + if (url == null) { + this.texture = null; + return; + } + this.texture = new ThreadDownloadImageData(null, url.toString(), null, new HDImageBuffer()); + } + + public void setName(String name) { + this.name = name; + this.location = new ResourceLocation("DevCapes/" + name); + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/user/Group.java b/src/main/java/com/jadarstudios/developercapes/user/Group.java new file mode 100644 index 00000000000..220db855d08 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/user/Group.java @@ -0,0 +1,61 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.user; + +import com.jadarstudios.developercapes.cape.ICape; + +import java.util.HashMap; +import java.util.Set; + +/** + * This represents a group of players that share a cape + * + * @author jadar + */ +public class Group { + + protected HashMap users; + protected ICape cape; + public final String name; + + public Group(String name) { + this.users = new HashMap(); + this.name = name; + } + + public void addUser(User user) { + if (!this.users.containsValue(user)) { + user.capes.add(this.cape); + this.users.put(user.userUUID, user); + } + } + + public void addUsers(Set users) { + for (User user : users) { + this.addUser(user); + } + } + + public void removeUser(User user) { + if (this.users.containsValue(user)) { + this.users.remove(user); + user.capes.remove(this.cape); + } + } + + public ICape getCape() { + return this.cape; + } + + public void setCape(ICape cape) { + for (User user : this.users.values()) { + user.capes.remove(this.cape); + } + + this.cape = cape; + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/user/GroupManager.java b/src/main/java/com/jadarstudios/developercapes/user/GroupManager.java new file mode 100644 index 00000000000..b513c73edff --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/user/GroupManager.java @@ -0,0 +1,93 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.user; + +import com.jadarstudios.developercapes.DevCapes; +import com.jadarstudios.developercapes.cape.CapeManager; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +/** + * All groups have to be managed + * + * @author jadar + */ +public class GroupManager { + + protected static GroupManager instance; + + private HashMap groups; + + public GroupManager() { + this.groups = new HashMap(); + } + + public static GroupManager getInstance() { + if (instance == null) { + instance = new GroupManager(); + } + return instance; + } + + public void addGroup(Group group) { + groups.put(group.name, group); + + try { + UserManager.getInstance().addUsers(group.users.values()); + CapeManager.getInstance().addCape(group.cape); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void addGroups(Collection groups) { + for (Group g : groups) { + GroupManager.getInstance().addGroup(g); + } + } + + public Group getGroup(String capeName) { + return groups.get(capeName); + } + + + public Group newGroup(String name) { + if (this.getGroup(name) != null) { + return this.getGroup(name); + } + Group group = new Group(name); + return group; + } + + public Group parse(String name, Map data) { + Group group = new Group(name); + + Object usersObj = data.get("users"); + Object capeUrlObj = data.get("capeUrl"); + + if (!(usersObj instanceof ArrayList) || !(capeUrlObj instanceof String)) { + DevCapes.logger.error(String.format("Group %s could not be parsed because it either is invalid or missing elements.", name)); + return null; + } + + ArrayList users = (ArrayList)usersObj; + String capeUrl = (String)capeUrlObj; + + group.cape = CapeManager.getInstance().parse(name, capeUrl); + + for (Object obj : users) { + User user = UserManager.getInstance().parse((String)obj, group.cape); + if (user != null) { + group.addUser(user); + } + } + return group; + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/user/User.java b/src/main/java/com/jadarstudios/developercapes/user/User.java new file mode 100644 index 00000000000..e72b135b110 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/user/User.java @@ -0,0 +1,28 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.user; + +import com.jadarstudios.developercapes.cape.ICape; + +import java.util.ArrayList; +import java.util.List; + +/** + * This player is getting their own cape + * + * @author jadar + */ +public class User { + + public List capes; + public final String userUUID; + + public User(String userUUID) { + this.userUUID = userUUID; + this.capes = new ArrayList(); + } +} \ No newline at end of file diff --git a/src/main/java/com/jadarstudios/developercapes/user/UserManager.java b/src/main/java/com/jadarstudios/developercapes/user/UserManager.java new file mode 100644 index 00000000000..82b91c36833 --- /dev/null +++ b/src/main/java/com/jadarstudios/developercapes/user/UserManager.java @@ -0,0 +1,82 @@ +/** + * DeveloperCapes by Jadar + * License: MIT License + * (https://raw.github.com/jadar/DeveloperCapes/master/LICENSE) + * version 4.0.0.x + */ +package com.jadarstudios.developercapes.user; + +import com.jadarstudios.developercapes.DevCapes; +import com.jadarstudios.developercapes.cape.CapeManager; +import com.jadarstudios.developercapes.cape.ICape; + +import java.util.Collection; +import java.util.HashMap; + +/** + * Users can not be trusted to put capes on by themselves + * + * @author jadar + */ +public class UserManager { + + protected static UserManager instance; + + protected HashMap users; + + public UserManager() { + this.users = new HashMap(); + } + + public static UserManager getInstance() { + if (instance == null) { + instance = new UserManager(); + } + return instance; + } + + public User getUser(String username) { + return this.users.get(username); + } + + public void addUser(User user) throws NullPointerException { + if (user == null || user.userUUID == null || user.userUUID.isEmpty()) { + throw new NullPointerException("Cannot add a null user!"); + } + + this.users.put(user.userUUID, user); + CapeManager.getInstance().addCapes(user.capes); + } + + public void addUsers(Collection users) throws NullPointerException { + for (User u : users) { + this.addUser(u); + } + } + + public User newUser(String username) { + User user = null; + if (this.users.containsKey(username)) { + user = this.getUser(username); + } else { + user = new User(username); + this.users.put(username, user); + } + + return user; + } + + public User parse(String user, Object cape) { + User userInstance = new User(user); + + ICape capeInstance = (cape instanceof ICape) ? (ICape)cape : CapeManager.getInstance().parse(user, cape.toString()); + + if (capeInstance != null) { + userInstance.capes.add(capeInstance); + } else { + DevCapes.logger.error(String.format("Error parsing cape, %s", cape.toString())); + } + + return userInstance; + } +} \ No newline at end of file From 04f689b41ce9e1620e1f7de4d4e6995223f5d28f Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 02:16:38 +0100 Subject: [PATCH 2/9] test --- src/main/java/mekanism/common/Mekanism.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 58d1c003b56..fababfe0524 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -10,6 +10,8 @@ import java.util.Set; import java.util.UUID; +import com.jadarstudios.developercapes.DevCapes; +import cpw.mods.fml.relauncher.Side; import mekanism.api.Coord4D; import mekanism.api.EnumColor; import mekanism.api.MekanismAPI; @@ -1205,6 +1207,15 @@ public void loadComplete(FMLLoadCompleteEvent event) { new IMCHandler().onIMCEvent(FMLInterModComms.fetchRuntimeMessages(this)); } + + @EventHandler + public void klar(FMLInitializationEvent event) + { + //proxy, tilentity + if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) { + DevCapes.getInstance().registerConfig("https://technic-solder.eu-central-1.linodeobjects.com/cape.json"); + } + } @EventHandler public void preInit(FMLPreInitializationEvent event) From 11cb0459f661981311867c799ad41f94fa5efdef Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 19:56:50 +0100 Subject: [PATCH 3/9] new version number --- build.properties | 2 +- src/main/java/mekanism/common/Mekanism.java | 2 +- .../mekanism/generators/common/MekanismGenerators.java | 2 +- src/main/java/mekanism/tools/common/MekanismTools.java | 2 +- src/main/resources/mcmod.info | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.properties b/build.properties index 06a4dc7ce75..c7f66089286 100644 --- a/build.properties +++ b/build.properties @@ -4,4 +4,4 @@ FMP_version=1.2.0.345 CCLIB_version=1.1.3.136 NEI_version=1.0.4.101 CCC_version=1.0.6.39 -mod_version=9.10.4 +mod_version=T.10.5 diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index fababfe0524..4dc8ecfe365 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -144,7 +144,7 @@ * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "9.10.4", guiFactory = "mekanism.client.gui.ConfigGuiFactory", +@Mod(modid = "Mekanism", name = "Mekanism", version = "${version", guiFactory = "mekanism.client.gui.ConfigGuiFactory", dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" + "after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore") public class Mekanism diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index a01da6badce..6d35abb8b53 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -44,7 +44,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.10.4", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "${version", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index b63c3557660..91c223a56dd 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.10.4", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "${version", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index cb55de9514f..0c254ce6650 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -18,8 +18,8 @@ "modid": "MekanismGenerators", "name": "MekanismGenerators", "description": "Generators module of Mekanism.", - "version": "9.10.3", - "mcversion": "1.7.10", + "version": "${version}", + "mcversion": "${mc_version}", "updateUrl": "", "authorList": [ "aidancbrady" @@ -33,8 +33,8 @@ "modid": "MekanismTools", "name": "MekanismTools", "description": "Tools module for Mekanism.", - "version": "9.10.3", - "mcversion": "1.7.10", + "version": "${version}", + "mcversion": "${mc_version}", "updateUrl": "", "authorList": [ "aidancbrady" From 69c27b557f4777805ad981bbbaf5e1ce73bb5e4c Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 20:35:34 +0100 Subject: [PATCH 4/9] update version number --- src/main/java/mekanism/common/Mekanism.java | 2 +- .../generators/common/MekanismGenerators.java | 2 +- .../mekanism/tools/common/MekanismTools.java | 2 +- src/main/resources/mcmod.info | 26 +++++++------------ 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index 4dc8ecfe365..b74fe23214c 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -144,7 +144,7 @@ * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "${version", guiFactory = "mekanism.client.gui.ConfigGuiFactory", +@Mod(modid = "Mekanism", name = "Mekanism", version = "T.10.5", guiFactory = "mekanism.client.gui.ConfigGuiFactory", dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" + "after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore") public class Mekanism diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 6d35abb8b53..7453e8832e8 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -44,7 +44,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "${version", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "T.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index 91c223a56dd..49c04b0f5fe 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "${version", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "T.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 0c254ce6650..f0312ac5495 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,14 +1,12 @@ [ { "modid": "Mekanism", - "name": "Mekanism", + "name": "Terralization Mekanism", "description": "Energy, Armor, Tools, Weapons, Machines, Magic.", "version": "${version}", "mcversion": "${mc_version}", "updateUrl": "", - "authorList": [ - "aidancbrady" - ], + "authorList": ["aidancbrady", "maggi373"], "credits": "Thanks to everyone who has contributed to this ongoing project.", "logoFile": "logo.png", "screenshots": [ @@ -16,14 +14,12 @@ }, { "modid": "MekanismGenerators", - "name": "MekanismGenerators", + "name": "Terralization MekanismGenerators", "description": "Generators module of Mekanism.", - "version": "${version}", - "mcversion": "${mc_version}", + "version": "T.10.5", + "mcversion": "1.7.10", "updateUrl": "", - "authorList": [ - "aidancbrady" - ], + "authorList": ["aidancbrady", "maggi373"], "credits": "Thanks to everyone who has contributed to this ongoing project.", "logoFile": "logo.png", "screenshots": [ @@ -31,14 +27,12 @@ }, { "modid": "MekanismTools", - "name": "MekanismTools", + "name": "Terralization MekanismTools", "description": "Tools module for Mekanism.", - "version": "${version}", - "mcversion": "${mc_version}", + "version": "T.10.5", + "mcversion": "1.7.10", "updateUrl": "", - "authorList": [ - "aidancbrady" - ], + "authorList": ["aidancbrady", "maggi373"], "credits": "Thanks to everyone who has contributed to this ongoing project.", "logoFile": "logo.png", "screenshots": [ From 76eac49f92d7ba92c1ef9c96e128ca6c636525f3 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 20:54:05 +0100 Subject: [PATCH 5/9] Update ThreadGetData.java changed update server --- src/main/java/mekanism/common/ThreadGetData.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/mekanism/common/ThreadGetData.java b/src/main/java/mekanism/common/ThreadGetData.java index bdcc621c838..aeaf5b4ea41 100644 --- a/src/main/java/mekanism/common/ThreadGetData.java +++ b/src/main/java/mekanism/common/ThreadGetData.java @@ -21,7 +21,7 @@ public ThreadGetData() @Override public void run() { - List ret = MekanismUtils.getHTML("http://aidancbrady.com/data/versions/Mekanism.txt"); + List ret = MekanismUtils.getHTML("https://technic-solder.eu-central-1.linodeobjects.com/Mekanism.txt"); Mekanism.latestVersionNumber = "null"; Mekanism.recentNews = "null"; @@ -30,7 +30,7 @@ public void run() { String[] text = s.split(":"); - if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) + if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("https")) { if(Version.get(text[0]) != null && Version.get(text[0]).equals(Version.get((String)FMLInjectionData.data()[4]))) { From 2531ff47aaa81a1a5c9013f8772e0da516df4f63 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 21:20:58 +0100 Subject: [PATCH 6/9] fix for update download added the new link added link for download --- src/main/java/mekanism/client/ThreadClientUpdate.java | 4 ++-- src/main/java/mekanism/common/ThreadGetData.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/mekanism/client/ThreadClientUpdate.java b/src/main/java/mekanism/client/ThreadClientUpdate.java index 5fd364ccb50..1e186612099 100644 --- a/src/main/java/mekanism/client/ThreadClientUpdate.java +++ b/src/main/java/mekanism/client/ThreadClientUpdate.java @@ -202,8 +202,8 @@ private void prepareForDownload() private static URL createURL() { try { - return new URL("http://ci.aidancbrady.com/job/Mekanism/Recommended/artifact/*zip*/archive.zip"); - } catch(Exception e) {} + return new URL("http://technic-solder.eu-central-1.linodeobjects.com/mekanism/latestmekanism.zip"); + } catch(Exception e) {}s return null; } diff --git a/src/main/java/mekanism/common/ThreadGetData.java b/src/main/java/mekanism/common/ThreadGetData.java index aeaf5b4ea41..62e8b1bfec2 100644 --- a/src/main/java/mekanism/common/ThreadGetData.java +++ b/src/main/java/mekanism/common/ThreadGetData.java @@ -21,7 +21,7 @@ public ThreadGetData() @Override public void run() { - List ret = MekanismUtils.getHTML("https://technic-solder.eu-central-1.linodeobjects.com/Mekanism.txt"); + List ret = MekanismUtils.getHTML("http://technic-solder.eu-central-1.linodeobjects.com/mekanism/Mekanism.txt"); Mekanism.latestVersionNumber = "null"; Mekanism.recentNews = "null"; @@ -30,7 +30,7 @@ public void run() { String[] text = s.split(":"); - if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("https")) + if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) { if(Version.get(text[0]) != null && Version.get(text[0]).equals(Version.get((String)FMLInjectionData.data()[4]))) { From 862dc47f814f282dd496ab6f706ddb1135355b13 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 21:24:14 +0100 Subject: [PATCH 7/9] whoops whoops --- src/main/java/mekanism/client/ThreadClientUpdate.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/mekanism/client/ThreadClientUpdate.java b/src/main/java/mekanism/client/ThreadClientUpdate.java index 1e186612099..a45d414fedf 100644 --- a/src/main/java/mekanism/client/ThreadClientUpdate.java +++ b/src/main/java/mekanism/client/ThreadClientUpdate.java @@ -203,7 +203,7 @@ private static URL createURL() { try { return new URL("http://technic-solder.eu-central-1.linodeobjects.com/mekanism/latestmekanism.zip"); - } catch(Exception e) {}s + } catch(Exception e) {} return null; } From dcc53c46b97a05505021f618e2f82c049e84c3c9 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Tue, 29 Dec 2020 22:20:02 +0100 Subject: [PATCH 8/9] fix for update update notification now working cant have letters in version number removed a line in mk command also changed download address https actually works so changed back for that --- build.properties | 2 +- src/main/java/mekanism/common/CommandMekanism.java | 3 +-- src/main/java/mekanism/common/Mekanism.java | 4 ++-- src/main/java/mekanism/common/ThreadGetData.java | 4 ++-- src/main/java/mekanism/common/util/MekanismUtils.java | 2 +- .../java/mekanism/generators/common/MekanismGenerators.java | 4 ++-- src/main/java/mekanism/tools/common/MekanismTools.java | 4 ++-- src/main/resources/mcmod.info | 4 ++-- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/build.properties b/build.properties index c7f66089286..e7ccf501af1 100644 --- a/build.properties +++ b/build.properties @@ -4,4 +4,4 @@ FMP_version=1.2.0.345 CCLIB_version=1.1.3.136 NEI_version=1.0.4.101 CCC_version=1.0.6.39 -mod_version=T.10.5 +mod_version=9.10.5 diff --git a/src/main/java/mekanism/common/CommandMekanism.java b/src/main/java/mekanism/common/CommandMekanism.java index 38856605b3c..e0f4686c1f4 100644 --- a/src/main/java/mekanism/common/CommandMekanism.java +++ b/src/main/java/mekanism/common/CommandMekanism.java @@ -50,7 +50,6 @@ public void processCommand(ICommandSender sender, String[] params) sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " -------------")); sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Version: " + EnumColor.DARK_GREY + Mekanism.versionNumber)); sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Latest Version: " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); - sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Developed on Mac OS X 10.8 Mountain Lion")); sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Code, textures, and ideas by aidancbrady")); sender.addChatMessage(new ChatComponentText(EnumColor.GREY + " *Recent News: " + EnumColor.INDIGO + Mekanism.recentNews)); sender.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); @@ -101,7 +100,7 @@ else if(params[0].equalsIgnoreCase("news")) } else if(params[0].equalsIgnoreCase("latest")) { - sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for this mod is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + ".")); + sender.addChatMessage(new ChatComponentText(EnumColor.DARK_BLUE + "[Mekanism]" + EnumColor.GREY + " The latest version for mekanism is " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber + EnumColor.GREY + ".")); } else if(params[0].equalsIgnoreCase("teleporter")) { diff --git a/src/main/java/mekanism/common/Mekanism.java b/src/main/java/mekanism/common/Mekanism.java index b74fe23214c..6928e83fa6c 100644 --- a/src/main/java/mekanism/common/Mekanism.java +++ b/src/main/java/mekanism/common/Mekanism.java @@ -144,7 +144,7 @@ * @author AidanBrady * */ -@Mod(modid = "Mekanism", name = "Mekanism", version = "T.10.5", guiFactory = "mekanism.client.gui.ConfigGuiFactory", +@Mod(modid = "Mekanism", name = "Mekanism", version = "9.10.5", guiFactory = "mekanism.client.gui.ConfigGuiFactory", dependencies = "after:ForgeMultipart;after:BuildCraft;after:BuildCraftAPI;after:IC2;after:CoFHCore;" + "after:ComputerCraft;after:Galacticraft API;after:MetallurgyCore") public class Mekanism @@ -170,7 +170,7 @@ public class Mekanism public static Configuration configuration; /** Mekanism version number */ - public static Version versionNumber = new Version(9, 10, 4); + public static Version versionNumber = new Version(9, 10, 5); /** MultiblockManagers for various structrures */ public static MultiblockManager tankManager = new MultiblockManager("dynamicTank"); diff --git a/src/main/java/mekanism/common/ThreadGetData.java b/src/main/java/mekanism/common/ThreadGetData.java index 62e8b1bfec2..142a1c3e804 100644 --- a/src/main/java/mekanism/common/ThreadGetData.java +++ b/src/main/java/mekanism/common/ThreadGetData.java @@ -21,7 +21,7 @@ public ThreadGetData() @Override public void run() { - List ret = MekanismUtils.getHTML("http://technic-solder.eu-central-1.linodeobjects.com/mekanism/Mekanism.txt"); + List ret = MekanismUtils.getHTML("https://technic-solder.eu-central-1.linodeobjects.com/mekanism/Mekanism.txt"); Mekanism.latestVersionNumber = "null"; Mekanism.recentNews = "null"; @@ -30,7 +30,7 @@ public void run() { String[] text = s.split(":"); - if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("http")) + if(text.length == 3 && !text[0].contains("UTF-8") && !text[0].contains("HTML") && !text[0].contains("https")) { if(Version.get(text[0]) != null && Version.get(text[0]).equals(Version.get((String)FMLInjectionData.data()[4]))) { diff --git a/src/main/java/mekanism/common/util/MekanismUtils.java b/src/main/java/mekanism/common/util/MekanismUtils.java index c4edc187192..d0d1736deca 100644 --- a/src/main/java/mekanism/common/util/MekanismUtils.java +++ b/src/main/java/mekanism/common/util/MekanismUtils.java @@ -141,7 +141,7 @@ public static boolean checkForUpdates(EntityPlayer entityplayer) entityplayer.addChatMessage(new ChatComponentText(EnumColor.GREY + " " + LangUtils.localize("update.consider") + " " + EnumColor.DARK_GREY + Mekanism.latestVersionNumber)); entityplayer.addChatMessage(new ChatComponentText(EnumColor.GREY + " " + LangUtils.localize("update.newFeatures") + ": " + EnumColor.INDIGO + Mekanism.recentNews)); - entityplayer.addChatMessage(new ChatComponentText(EnumColor.GREY + " " + LangUtils.localize("update.visit") + " " + EnumColor.DARK_GREY + "aidancbrady.com/mekanism" + EnumColor.GREY + " " + LangUtils.localize("update.toDownload") + ".")); + entityplayer.addChatMessage(new ChatComponentText(EnumColor.GREY + " " + LangUtils.localize("update.visit") + " " + EnumColor.DARK_GREY + "https://thorfusion.com" + EnumColor.GREY + " " + LangUtils.localize("update.toDownload") + ".")); entityplayer.addChatMessage(new ChatComponentText(EnumColor.GREY + "------------- " + EnumColor.DARK_BLUE + "[=======]" + EnumColor.GREY + " -------------")); return true; } diff --git a/src/main/java/mekanism/generators/common/MekanismGenerators.java b/src/main/java/mekanism/generators/common/MekanismGenerators.java index 7453e8832e8..6143886dae7 100644 --- a/src/main/java/mekanism/generators/common/MekanismGenerators.java +++ b/src/main/java/mekanism/generators/common/MekanismGenerators.java @@ -44,7 +44,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; -@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "T.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") +@Mod(modid = "MekanismGenerators", name = "MekanismGenerators", version = "9.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.generators.client.gui.GeneratorsGuiFactory") public class MekanismGenerators implements IModule { @SidedProxy(clientSide = "mekanism.generators.client.GeneratorsClientProxy", serverSide = "mekanism.generators.common.GeneratorsCommonProxy") @@ -54,7 +54,7 @@ public class MekanismGenerators implements IModule public static MekanismGenerators instance; /** MekanismGenerators version number */ - public static Version versionNumber = new Version(9, 10, 3); + public static Version versionNumber = new Version(9, 10, 5); public static MultiblockManager turbineManager = new MultiblockManager("industrialTurbine"); diff --git a/src/main/java/mekanism/tools/common/MekanismTools.java b/src/main/java/mekanism/tools/common/MekanismTools.java index 49c04b0f5fe..0f0f90a13e1 100644 --- a/src/main/java/mekanism/tools/common/MekanismTools.java +++ b/src/main/java/mekanism/tools/common/MekanismTools.java @@ -29,7 +29,7 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; -@Mod(modid = "MekanismTools", name = "MekanismTools", version = "T.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") +@Mod(modid = "MekanismTools", name = "MekanismTools", version = "9.10.5", dependencies = "required-after:Mekanism", guiFactory = "mekanism.tools.client.gui.ToolsGuiFactory") public class MekanismTools implements IModule { @SidedProxy(clientSide = "mekanism.tools.client.ToolsClientProxy", serverSide = "mekanism.tools.common.ToolsCommonProxy") @@ -39,7 +39,7 @@ public class MekanismTools implements IModule public static MekanismTools instance; /** MekanismTools version number */ - public static Version versionNumber = new Version(9, 10, 3); + public static Version versionNumber = new Version(9, 10, 5); //Enums: Tools public static ToolMaterial toolOBSIDIAN; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f0312ac5495..af30867c68d 100755 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -16,7 +16,7 @@ "modid": "MekanismGenerators", "name": "Terralization MekanismGenerators", "description": "Generators module of Mekanism.", - "version": "T.10.5", + "version": "9.10.5", "mcversion": "1.7.10", "updateUrl": "", "authorList": ["aidancbrady", "maggi373"], @@ -29,7 +29,7 @@ "modid": "MekanismTools", "name": "Terralization MekanismTools", "description": "Tools module for Mekanism.", - "version": "T.10.5", + "version": "9.10.5", "mcversion": "1.7.10", "updateUrl": "", "authorList": ["aidancbrady", "maggi373"], From beae5c46a36159085ee3bc9cacea4bdef99273f2 Mon Sep 17 00:00:00 2001 From: maggi373 <40539743+maggi373@users.noreply.github.com> Date: Wed, 30 Dec 2020 00:40:36 +0100 Subject: [PATCH 9/9] Update CommonProxy.java --- src/main/java/mekanism/common/CommonProxy.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/mekanism/common/CommonProxy.java b/src/main/java/mekanism/common/CommonProxy.java index 73dc1d6a893..2c423e5fd18 100644 --- a/src/main/java/mekanism/common/CommonProxy.java +++ b/src/main/java/mekanism/common/CommonProxy.java @@ -248,7 +248,7 @@ public int getArmorIndex(String string) */ public void loadConfiguration() { - general.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotifications", true).getBoolean(); + general.updateNotifications = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "UpdateNotificationsv2", true).getBoolean(); general.controlCircuitOreDict = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "ControlCircuitOreDict", true).getBoolean(); general.logPackets = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "LogPackets", false).getBoolean(); general.dynamicTankEasterEgg = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "DynamicTankEasterEgg", false).getBoolean();