From ba0db308ab49a9c544d6d093a5b6763d539b6b0a Mon Sep 17 00:00:00 2001 From: mDiyo Date: Tue, 1 Jul 2014 22:07:00 -0800 Subject: [PATCH 1/3] Update pulsar version --- src/mantle/pulsar/control/PulseManager.java | 112 +++++++++---- src/mantle/pulsar/internal/Configuration.java | 152 +++++++++++++----- src/mantle/pulsar/internal/PulseMeta.java | 20 +-- .../pulsar/internal/logging/ILogger.java | 23 +++ .../pulsar/internal/logging/JULLogger.java | 48 ++++++ .../pulsar/internal/logging/Log4jLogger.java | 48 ++++++ .../pulsar/internal/logging/LogManager.java | 39 +++++ src/mantle/pulsar/pulse/Handler.java | 14 ++ src/mantle/pulsar/pulse/IPulse.java | 15 +- src/mantle/pulsar/pulse/Pulse.java | 9 +- src/mantle/pulsar/pulse/PulseProxy.java | 3 + 11 files changed, 389 insertions(+), 94 deletions(-) create mode 100644 src/mantle/pulsar/internal/logging/ILogger.java create mode 100644 src/mantle/pulsar/internal/logging/JULLogger.java create mode 100644 src/mantle/pulsar/internal/logging/Log4jLogger.java create mode 100644 src/mantle/pulsar/internal/logging/LogManager.java create mode 100644 src/mantle/pulsar/pulse/Handler.java diff --git a/src/mantle/pulsar/control/PulseManager.java b/src/mantle/pulsar/control/PulseManager.java index 661c39e..81c5fff 100644 --- a/src/mantle/pulsar/control/PulseManager.java +++ b/src/mantle/pulsar/control/PulseManager.java @@ -1,19 +1,20 @@ package mantle.pulsar.control; import java.lang.reflect.Field; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; - import mantle.pulsar.internal.Configuration; import mantle.pulsar.internal.PulseMeta; +import mantle.pulsar.internal.logging.ILogger; +import mantle.pulsar.internal.logging.LogManager; +import mantle.pulsar.pulse.Handler; import mantle.pulsar.pulse.IPulse; import mantle.pulsar.pulse.Pulse; import mantle.pulsar.pulse.PulseProxy; @@ -25,13 +26,14 @@ import mantle.pulsar.pulse.PulseProxy; * * @author Arkan */ +@SuppressWarnings({"unused", "deprecated"}) public class PulseManager { - private final Logger log; + private final ILogger log; private final boolean useConfig; private final String configName; - private final HashMap pulses = new HashMap(); + private final HashMap pulses = new HashMap(); private boolean blockNewRegistrations = false; private Configuration conf = null; @@ -71,7 +73,7 @@ public class PulseManager { * * @param pulse The Pulse to register. */ - public void registerPulse(IPulse pulse) { + public void registerPulse(Object pulse) { if (blockNewRegistrations) throw new RuntimeException("A mod tried to register a plugin after preinit! Pulse: " + pulse); @@ -81,14 +83,16 @@ public class PulseManager { try { Pulse p = pulse.getClass().getAnnotation(Pulse.class); id = p.id(); + description = p.description(); forced = p.forced(); enabled = p.defaultEnable(); - description = p.description(); } catch (NullPointerException ex) { throw new RuntimeException("Could not parse @Pulse annotation for Pulse: " + pulse); } - PulseMeta meta = new PulseMeta(id, forced, enabled, description); + if (description.equals("")) description = null; // Work around Java not allowing default-null fields. + + PulseMeta meta = new PulseMeta(id, description, forced, enabled); meta.setEnabled(getEnabledFromConfig(meta)); if (meta.isEnabled()) { @@ -104,25 +108,24 @@ public class PulseManager { conf = new Configuration(configName, log); } - return conf.isModuleEnabled(meta.getId(), meta.isEnabled(), meta.getDescription()); + return conf.isModuleEnabled(meta); } - private void parseAndAddProxies(IPulse pulse) { + /** + * @deprecated FML handles proxies now. + * + * @param pulse Pulse to parse for proxy annotations. + */ + @Deprecated + private void parseAndAddProxies(Object pulse) { try { for (Field f : pulse.getClass().getDeclaredFields()) { log.debug("Parsing field: " + f); PulseProxy p = f.getAnnotation(PulseProxy.class); - if (p != null) { - boolean accessible = f.isAccessible(); - f.setAccessible(true); - switch (FMLCommonHandler.instance().getSide()) { - case CLIENT: - f.set(pulse, Class.forName(p.client()).newInstance()); - break; - default: - f.set(pulse, Class.forName(p.server()).newInstance()); - } - f.setAccessible(accessible); + if (p != null) { // Support for deprecated PulseProxy annotation + log.warn("Pulse " + pulse + " used the deprecated PulseProxy annotation. As of Pulsar 0.1.0, it's now preferred to use FML's SidedProxy annotation."); + log.warn("The old PulseProxy parsing will be removed in the next breaking update (Pulsar 1.x)."); + setProxyField(pulse, f, p.client(), p.server()); } } } catch (Exception ex) { @@ -130,25 +133,78 @@ public class PulseManager { } } + @Deprecated + private void setProxyField(Object pulse, Field f, String client, String server) throws Exception { + boolean accessible = f.isAccessible(); + f.setAccessible(true); + switch (FMLCommonHandler.instance().getSide()) { + case CLIENT: + f.set(pulse, Class.forName(client).newInstance()); + break; + default: + f.set(pulse, Class.forName(server).newInstance()); + } + f.setAccessible(accessible); + } + public void preInit(FMLPreInitializationEvent evt) { blockNewRegistrations = true; - for (Map.Entry e : pulses.entrySet()) { + for (Map.Entry e : pulses.entrySet()) { log.debug("Preinitialising Pulse " + e.getValue().getId() + "..."); - e.getKey().preInit(evt); + if (e.getKey() instanceof IPulse) { // Deprecated IPulse handling + IPulse ip = (IPulse)e.getKey(); + ip.preInit(evt); + } else findAndInvokeHandlers(e.getKey(), evt); } } public void init(FMLInitializationEvent evt) { - for (Map.Entry e : pulses.entrySet()) { + for (Map.Entry e : pulses.entrySet()) { log.debug("Initialising Pulse " + e.getValue().getId() + "..."); - e.getKey().init(evt); + + if (e.getKey() instanceof IPulse) { // Deprecated IPulse handling + IPulse ip = (IPulse)e.getKey(); + ip.init(evt); + log.warn("Pulse " + e.getValue().getId() + " is using the deprecated IPulse interface."); + log.warn("This will be removed in the next major version (Pulsar 1.x) - Please switch to @Handler!"); + } else findAndInvokeHandlers(e.getKey(), evt); } } public void postInit(FMLPostInitializationEvent evt) { - for (Map.Entry e : pulses.entrySet()) { + for (Map.Entry e : pulses.entrySet()) { log.debug("Postinitialising Pulse " + e.getValue().getId() + "..."); - e.getKey().postInit(evt); + + if (e.getKey() instanceof IPulse) { // Deprecated IPulse handling + IPulse ip = (IPulse)e.getKey(); + ip.postInit(evt); + } else findAndInvokeHandlers(e.getKey(), evt); + } + } + + /** + * Parse an object for a matching handler for the given object. + * + * @param pulse Object to inspect for Handlers + * @param evt The event object + */ + @SuppressWarnings("unchecked") + private void findAndInvokeHandlers(Object pulse, Object evt) { + for (Method m : pulse.getClass().getDeclaredMethods()) { + try { + if (m.getAnnotation(Handler.class) == null) continue; // Ignore non-@Handler methods + + Class[] pTypes = m.getParameterTypes(); + if (pTypes.length != 1) continue; + + Class pt = pTypes[0]; + if (pt.isAssignableFrom(evt.getClass())) { + m.invoke(pulse, evt); + } + } catch (Exception ex) { + log.warn("Caught exception in findAndInvokeHandlers: " + ex); + ex.printStackTrace(); + } } } diff --git a/src/mantle/pulsar/internal/Configuration.java b/src/mantle/pulsar/internal/Configuration.java index 6b4efe8..9f7dd18 100644 --- a/src/mantle/pulsar/internal/Configuration.java +++ b/src/mantle/pulsar/internal/Configuration.java @@ -2,10 +2,7 @@ package mantle.pulsar.internal; import java.io.*; import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - -import org.apache.logging.log4j.Logger; +import java.util.*; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -13,6 +10,7 @@ import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import cpw.mods.fml.common.Loader; +import mantle.pulsar.internal.logging.ILogger; /** * Gson Configuration helper. @@ -21,11 +19,13 @@ import cpw.mods.fml.common.Loader; */ public class Configuration { + private static final int CONFIG_LEVEL = 1; + private static final Gson gson = new GsonBuilder().setPrettyPrinting().create(); private final String confPath; - private final Logger logger; + private final ILogger logger; - private Map modules; + private Map modules; /** * Creates a new Configuration object. @@ -35,42 +35,36 @@ public class Configuration { * @param confName The config file name (without path or .json suffix) * @param logger The logger to send debug info to. */ - public Configuration(String confName, Logger logger) { + public Configuration(String confName, ILogger logger) { this.confPath = Loader.instance().getConfigDir().toString() + File.separator + confName + ".json"; this.logger = logger; - this.modules = getModulesFromJson(); + getModulesFromJson(); } /** * Gets whether the given module is enabled in the config. * - * @param id Module to lookup. - * @param defaultState Whether the module should be enabled or disabled by default (used to push new entries) - * @param defaultDescription The default description if the value does not exist already + * @param meta The pulse metadata. * @return Whether the module is enabled. */ - public boolean isModuleEnabled(String id, boolean defaultState, String defaultDescription) { - ModuleConfig modConfig = modules.get(id); - if (modConfig == null) { - modules.put(id, new ModuleConfig(defaultState, defaultDescription)); + public boolean isModuleEnabled(PulseMeta meta) { + ConfigEntry entry = modules.get(meta.getId()); + if (entry == null) { + modules.put(meta.getId(), new ConfigEntry(meta.isEnabled(), meta.getDescription())); writeModulesToJson(); - return defaultState; + return meta.isEnabled(); + } else { + return entry.getEnabled(); } - return modConfig.enabled; } - @Deprecated - public boolean isModuleEnabled(String id, boolean defaultState) - { - return isModuleEnabled(id, defaultState, null); - } - - private Map getModulesFromJson() { + private void getModulesFromJson() { // Step 1: Does the file exist? File f = new File(confPath); if (!f.exists()) { logger.info("Couldn't find config file; will generate a new one later."); - return new HashMap(); + modules = new HashMap(); + return; } // Step 2: File exists. Let's make sure it's usable. @@ -79,18 +73,50 @@ public class Configuration { } // Step 3: Good enough. Read it. + try { + try { + modules = parseV1Config(f); + } catch (Exception ex) { + logger.warn("Failed to parse " + f.getName() + " using the v1 parser; trying the v0 parser."); + Map conf = parseV0Config(f); + logger.info("Found valid v0 configuration. Upgrading it."); + modules = conf; + writeModulesToJson(); + logger.info("Upgrade complete! Config is now in v1 format."); + } + } catch (Exception ex) { + logger.warn("Invalid config file. Discarding."); + ex.printStackTrace(); + modules = new HashMap(); + } + } + + private Map parseV0Config(File f) throws Exception { try { JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(f))); - Map m = gson.fromJson(reader, new TypeToken>(){}.getType()); // NASTY! + Map m = gson.fromJson(reader, new TypeToken>(){}.getType()); // NASTY! if (m == null) { throw new NullPointerException("Gson returned null."); } - return m; + Map out = new HashMap(); + for (Map.Entry e : m.entrySet()) { + out.put(e.getKey(), new ConfigEntry(e.getValue())); + } + return out; + } catch (FileNotFoundException fnfe) { + throw new RuntimeException("This shouldn't be possible... " + fnfe); + } + } + + private Map parseV1Config(File f) throws Exception { + try { + JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(f))); + GsonConfig c = gson.fromJson(reader, GsonConfig.class); + if (c.getConfigVersion() > 1) throw new RuntimeException("Pulsar config is from a newer version! Remove it! " + f.getAbsolutePath()); + if (c.getModules() == null) throw new IllegalArgumentException("Not a valid GsonConfig. Try v0 parsing."); + return c.getModules(); } catch (FileNotFoundException fnfe) { throw new RuntimeException("This shouldn't be possible... " + fnfe); - } catch (Exception ex) { - logger.warn("Invalid config file. Discarding."); - return new HashMap(); } } @@ -98,8 +124,8 @@ public class Configuration { try { JsonWriter writer = new JsonWriter(new OutputStreamWriter(new FileOutputStream(new File(confPath)))); writer.setIndent(" "); - Type t = new TypeToken>(){}.getType(); - gson.toJson(modules, t, writer); + GsonConfig out = new GsonConfig(CONFIG_LEVEL, modules); + gson.toJson(out, GsonConfig.class, writer); writer.close(); } catch (Exception ex) { logger.warn("Could not write config? " + confPath); @@ -114,17 +140,59 @@ public class Configuration { super(message); } } - private static class ModuleConfig - { - public boolean enabled = true; - public String description = null; - public ModuleConfig(boolean enabled, String description) - { + + /** + * Internal data holder, for use in the map and JSON. + */ + private static class ConfigEntry { + + private Boolean enabled; + private String description = null; + + public ConfigEntry(Boolean enabled) { this.enabled = enabled; - if (description == null || description.isEmpty()) - this.description = null; - else - this.description = description; + } + + public ConfigEntry(Boolean enabled, String description) { + this(enabled); + this.description = description; + } + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getDescription() { + return description; } } + + /** + * Internal representation of a version 1+ config file. + */ + private static class GsonConfig { + + private int CONFIG_VERSION = 0; + + private Map modules; + + public GsonConfig(int version, Map modules) { + this.CONFIG_VERSION = version; + this.modules = modules; + } + + public int getConfigVersion() { + return CONFIG_VERSION; + } + + public Map getModules() { + return modules; + } + + } + } diff --git a/src/mantle/pulsar/internal/PulseMeta.java b/src/mantle/pulsar/internal/PulseMeta.java index 0620dbd..8ef74a5 100644 --- a/src/mantle/pulsar/internal/PulseMeta.java +++ b/src/mantle/pulsar/internal/PulseMeta.java @@ -10,17 +10,21 @@ public class PulseMeta { private String id, description; private boolean forced, enabled; - public PulseMeta(String id, boolean forced, boolean enabled, String description) { + public PulseMeta(String id, String description, boolean forced, boolean enabled) { this.id = id; + this.description = description; this.forced = forced; this.enabled = enabled; - setDescription(description); } public String getId() { return id; } + public String getDescription() { + return description; + } + public boolean isForced() { return forced; } @@ -32,16 +36,4 @@ public class PulseMeta { public void setEnabled(boolean enabled) { this.enabled = enabled; } - - public void setDescription(String description) - { - if(description == null || description.isEmpty()) - this.description = null; - else - this.description = description; - } - - public String getDescription() { - return description; - } } diff --git a/src/mantle/pulsar/internal/logging/ILogger.java b/src/mantle/pulsar/internal/logging/ILogger.java new file mode 100644 index 0000000..2d26787 --- /dev/null +++ b/src/mantle/pulsar/internal/logging/ILogger.java @@ -0,0 +1,23 @@ +package mantle.pulsar.internal.logging; + +/** + * Interface for log wrappers. + * + * @author Arkan + */ +@SuppressWarnings("unused") +public interface ILogger { + + public void fatal(String msg); + + public void severe(String msg); + + public void warn(String msg); + + public void info(String msg); + + public void debug(String msg); + + public void trace(String msg); + +} diff --git a/src/mantle/pulsar/internal/logging/JULLogger.java b/src/mantle/pulsar/internal/logging/JULLogger.java new file mode 100644 index 0000000..13cbd43 --- /dev/null +++ b/src/mantle/pulsar/internal/logging/JULLogger.java @@ -0,0 +1,48 @@ +package mantle.pulsar.internal.logging; + +import java.util.logging.Logger; + +/** + * Java logger wrapper. + * + * @author Arkan + */ +public class JULLogger implements ILogger { + + private final Logger log; + + public JULLogger(String name) { + log = Logger.getLogger(name); + } + + @Override + public void fatal(String msg) { + log.severe(msg); // JUL doesn't -have- fatal... + } + + @Override + public void severe(String msg) { + log.severe(msg); + } + + @Override + public void warn(String msg) { + log.warning(msg); + } + + @Override + public void info(String msg) { + log.info(msg); + } + + @Override + public void debug(String msg) { + log.fine(msg); // Good enough. + } + + @Override + public void trace(String msg) { + log.finest(msg); // Closest we'll get. + } + +} diff --git a/src/mantle/pulsar/internal/logging/Log4jLogger.java b/src/mantle/pulsar/internal/logging/Log4jLogger.java new file mode 100644 index 0000000..9f38239 --- /dev/null +++ b/src/mantle/pulsar/internal/logging/Log4jLogger.java @@ -0,0 +1,48 @@ +package mantle.pulsar.internal.logging; + +import org.apache.logging.log4j.Logger; + +/** + * Log4j log wrapper. + * + * @author Arkan + */ +public class Log4jLogger implements ILogger { + + private final Logger log; + + public Log4jLogger(String name) { + log = org.apache.logging.log4j.LogManager.getLogger(name); + } + + @Override + public void fatal(String msg) { + log.fatal(msg); + } + + @Override + public void severe(String msg) { + log.error(msg); + } + + @Override + public void warn(String msg) { + log.warn(msg); + } + + @Override + public void info(String msg) { + log.info(msg); + } + + @Override + public void debug(String msg) { + log.debug(msg); + } + + @Override + public void trace(String msg) { + log.trace(msg); + } + +} diff --git a/src/mantle/pulsar/internal/logging/LogManager.java b/src/mantle/pulsar/internal/logging/LogManager.java new file mode 100644 index 0000000..b727ebf --- /dev/null +++ b/src/mantle/pulsar/internal/logging/LogManager.java @@ -0,0 +1,39 @@ +package mantle.pulsar.internal.logging; + +/** + * Static class for getting generic loggers. + * + * @author Arkan + */ +public class LogManager { + + private LogManager() {} // Singleton. + + private static final boolean useLog4j2; + + /* + * Detect the presence of log4j2. + * + * If it's present, we can assume we should be using the damn thing. + */ + static { + boolean l4j = false; + try { + Class cl = Class.forName("org.apache.logging.log4j.LogManager"); + if (cl == null) throw new ClassNotFoundException("This should never happen..."); + l4j = true; + } catch (ClassNotFoundException cnfe) { + // Ignore + } + useLog4j2 = l4j; + } + + public static ILogger getLogger(String name) { + if (useLog4j2) { + return new Log4jLogger(name); + } else { + return new JULLogger(name); + } + } + +} diff --git a/src/mantle/pulsar/pulse/Handler.java b/src/mantle/pulsar/pulse/Handler.java new file mode 100644 index 0000000..547648d --- /dev/null +++ b/src/mantle/pulsar/pulse/Handler.java @@ -0,0 +1,14 @@ +package mantle.pulsar.pulse; + +import java.lang.annotation.*; + +/** + * Annotates methods to be used for event handling. + * + * @author Arkan + */ +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface Handler +{} diff --git a/src/mantle/pulsar/pulse/IPulse.java b/src/mantle/pulsar/pulse/IPulse.java index 4380b2b..cb4febd 100644 --- a/src/mantle/pulsar/pulse/IPulse.java +++ b/src/mantle/pulsar/pulse/IPulse.java @@ -7,29 +7,32 @@ import cpw.mods.fml.common.event.FMLPreInitializationEvent; /** * Base interface for all Pulsar modules ("pulses"). * + * @deprecated Use the new {@link Handler} annotation. + * * @author Arkan */ +@Deprecated public interface IPulse { /** * FML preinit from the parent mod. * - * @param event The FML event inherited from this Pulses parent. + * @param evt The FML event inherited from this Pulses parent. */ - public void preInit(FMLPreInitializationEvent event); + public void preInit(FMLPreInitializationEvent evt); /** * FML init from the parent mod. * - * @param event The FML event inherited from this Pulses parent. + * @param evt The FML event inherited from this Pulses parent. */ - public void init(FMLInitializationEvent event); + public void init(FMLInitializationEvent evt); /** * FML postinit from the parent mod. * - * @param event The FML event inherited from this Pulses parent. + * @param evt The FML event inherited from this Pulses parent. */ - public void postInit(FMLPostInitializationEvent event); + public void postInit(FMLPostInitializationEvent evt); } diff --git a/src/mantle/pulsar/pulse/Pulse.java b/src/mantle/pulsar/pulse/Pulse.java index 251b7cf..5b81e48 100644 --- a/src/mantle/pulsar/pulse/Pulse.java +++ b/src/mantle/pulsar/pulse/Pulse.java @@ -17,6 +17,11 @@ public @interface Pulse { */ public String id(); + /** + * @return This Pulses description, human-readable for config files. Can be blank. + */ + public String description() default ""; + /** * @return Whether this Pulse is mandatory or not (true -> mandatory). */ @@ -27,8 +32,4 @@ public @interface Pulse { */ public boolean defaultEnable() default true; - /** - * @return A description for this Pulse, if present this is used for config descriptions - */ - public String description() default ""; } diff --git a/src/mantle/pulsar/pulse/PulseProxy.java b/src/mantle/pulsar/pulse/PulseProxy.java index 9b9ed6a..5bf99e3 100644 --- a/src/mantle/pulsar/pulse/PulseProxy.java +++ b/src/mantle/pulsar/pulse/PulseProxy.java @@ -5,11 +5,14 @@ import java.lang.annotation.*; /** * Annotation to denote a field that should be populated by a side-specific proxy. * + * @deprecated Use FML's @SidedProxy instead. + * * @author Arkan */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) @Documented +@Deprecated public @interface PulseProxy { /** From b794c0053265ed4f3f3cdb4e37867eb7bb528fdf Mon Sep 17 00:00:00 2001 From: mDiyo Date: Tue, 1 Jul 2014 22:10:48 -0800 Subject: [PATCH 2/3] Remove deprecated annotation on single constructor for PulseManager --- src/mantle/pulsar/control/PulseManager.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mantle/pulsar/control/PulseManager.java b/src/mantle/pulsar/control/PulseManager.java index 81c5fff..8e914cf 100644 --- a/src/mantle/pulsar/control/PulseManager.java +++ b/src/mantle/pulsar/control/PulseManager.java @@ -45,7 +45,6 @@ public class PulseManager { * * @param modId The parents ModID. */ - @Deprecated public PulseManager(String modId) { log = LogManager.getLogger("PulseManager-" + modId); useConfig = false; From 2901427a99c7a3157b7c5be3664ea70c494f835b Mon Sep 17 00:00:00 2001 From: mDiyo Date: Tue, 1 Jul 2014 23:04:51 -0800 Subject: [PATCH 3/3] Remove deprecation on PulseProxy --- src/mantle/pulsar/control/PulseManager.java | 2 +- src/mantle/pulsar/pulse/PulseProxy.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mantle/pulsar/control/PulseManager.java b/src/mantle/pulsar/control/PulseManager.java index 8e914cf..bf3255d 100644 --- a/src/mantle/pulsar/control/PulseManager.java +++ b/src/mantle/pulsar/control/PulseManager.java @@ -124,7 +124,7 @@ public class PulseManager { if (p != null) { // Support for deprecated PulseProxy annotation log.warn("Pulse " + pulse + " used the deprecated PulseProxy annotation. As of Pulsar 0.1.0, it's now preferred to use FML's SidedProxy annotation."); log.warn("The old PulseProxy parsing will be removed in the next breaking update (Pulsar 1.x)."); - setProxyField(pulse, f, p.client(), p.server()); + setProxyField(pulse, f, p.clientSide(), p.serverSide()); } } } catch (Exception ex) { diff --git a/src/mantle/pulsar/pulse/PulseProxy.java b/src/mantle/pulsar/pulse/PulseProxy.java index 5bf99e3..eee81de 100644 --- a/src/mantle/pulsar/pulse/PulseProxy.java +++ b/src/mantle/pulsar/pulse/PulseProxy.java @@ -12,17 +12,16 @@ import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD}) @Documented -@Deprecated public @interface PulseProxy { /** * @return The FQCN of the client proxy. */ - public String client(); + public String clientSide(); /** * @return The FQCN of the server proxy. */ - public String server(); + public String serverSide(); }