<modelVersion>4.0.0</modelVersion>
<groupId>net.pterodactylus</groupId>
<artifactId>sone</artifactId>
- <version>0.3.4</version>
+ <version>0.3.5-1</version>
<dependencies>
<dependency>
<groupId>net.pterodactylus</groupId>
}
/** The version. */
- public static final Version VERSION = new Version(0, 3, 4);
+ public static final Version VERSION = new Version(0, 3, 5, 1);
/** The logger. */
private static final Logger logger = Logging.getLogger(SonePlugin.class);
}
/**
+ * Returns the currently logged in Sone.
+ *
+ * @param toadletContext
+ * The toadlet context
+ * @param create
+ * {@code true} to create a new session if no session exists,
+ * {@code false} to not create a new session
+ * @return The currently logged in Sone, or {@code null} if no Sone is
+ * currently logged in
+ */
+ protected Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
+ return webInterface.getCurrentSone(toadletContext, create);
+ }
+
+ /**
* Sets the currently logged in Sone.
*
* @param toadletContext
@Override
public boolean isEnabled(ToadletContext toadletContext) {
if (requiresLogin()) {
- return getCurrentSone(toadletContext) != null;
+ return getCurrentSone(toadletContext, false) != null;
}
return true;
}
* currently logged in
*/
public Sone getCurrentSone(ToadletContext toadletContext) {
- return getCurrentSone(getCurrentSession(toadletContext));
+ return getCurrentSone(toadletContext, true);
+ }
+
+ /**
+ * Returns the currently logged in Sone.
+ *
+ * @param toadletContext
+ * The toadlet context
+ * @param create
+ * {@code true} to create a new session if no session exists,
+ * {@code false} to not create a new session
+ * @return The currently logged in Sone, or {@code null} if no Sone is
+ * currently logged in
+ */
+ public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
+ return getCurrentSone(getCurrentSession(toadletContext, create));
}
/**
@SuppressWarnings("synthetic-access")
public void run() {
lockedSonesNotification.add(sone);
+ lockedSonesTickerObjects.remove(sone);
notificationManager.addNotification(lockedSonesNotification);
}
}, "Sone Locked Notification");
*/
@Override
public void soneUnlocked(Sone sone) {
- Object tickerObject = lockedSonesTickerObjects.remove(sone);
- if (tickerObject == null) {
- return;
- }
lockedSonesNotification.remove(sone);
- Ticker.getInstance().deregisterEvent(tickerObject);
+ Ticker.getInstance().deregisterEvent(lockedSonesTickerObjects.remove(sone));
}
/**