Skip to content

Commit

Permalink
Manager rewrite (#608)
Browse files Browse the repository at this point in the history
* Remove author tags for myself (since I'm in the copyright anyway)
* Replace existing manager locks with ReentrantLock, this will serve as helpful if somehow threads become deadlocked
* Fixed incorrect timestamp calculation
* Add ability to disable permission checks on all managers
* Fixed field in GuildManager (the correct key is default_message_notifications)
* Fixed wrong key in AuditLogKey#ROLE_HOISTED
* Allow unicode for channel names
* Added more references and examples for use of Permission enum in some places of the API
  • Loading branch information
MinnDevelopment committed Mar 11, 2018
1 parent 52bf802 commit 9e593c5
Show file tree
Hide file tree
Showing 66 changed files with 2,226 additions and 960 deletions.
11 changes: 7 additions & 4 deletions src/main/java/net/dv8tion/jda/client/entities/Application.java
Expand Up @@ -23,9 +23,9 @@
import net.dv8tion.jda.core.entities.ISnowflake;
import net.dv8tion.jda.core.requests.RestAction;

import javax.annotation.CheckReturnValue;
import java.util.Collection;
import java.util.List;
import javax.annotation.CheckReturnValue;

/**
* Represents a Discord Application from its owning client point of view
Expand Down Expand Up @@ -136,11 +136,10 @@ public interface Application extends ISnowflake

/**
* Returns the {@link net.dv8tion.jda.client.managers.ApplicationManager ApplicationManager} for this Application.
* In the ApplicationManager, you can modify things like the name and icon of this Application.
* <br>In the ApplicationManager, you can modify things like the name and icon of this Application.
* You modify multiple fields in one request by chaining setters before calling {@link net.dv8tion.jda.core.requests.RestAction#queue() RestAction.queue()}.
*
* @return The ApplicationManager of this Channel
*
* @see #getManagerUpdatable()
*/
ApplicationManager getManager();

Expand All @@ -152,7 +151,11 @@ public interface Application extends ISnowflake
* @return The ApplicationManagerUpdatable of this Application
*
* @see #getManager()
*
* @deprecated
* Use {@link #getManager()} instead
*/
@Deprecated
ApplicationManagerUpdatable getManagerUpdatable();

/**
Expand Down
Expand Up @@ -18,7 +18,6 @@

import net.dv8tion.jda.client.entities.Application;
import net.dv8tion.jda.client.managers.ApplicationManager;
import net.dv8tion.jda.client.managers.ApplicationManagerUpdatable;
import net.dv8tion.jda.core.JDA;
import net.dv8tion.jda.core.Permission;
import net.dv8tion.jda.core.requests.Request;
Expand All @@ -32,11 +31,11 @@

public class ApplicationImpl implements Application
{

private final JDA api;
private final Object mngLock = new Object();
private ApplicationManager manager;
private ApplicationManagerUpdatable managerUpdatable;
@Deprecated
private net.dv8tion.jda.client.managers.ApplicationManagerUpdatable managerUpdatable;

private BotImpl bot;
private String description;
Expand Down Expand Up @@ -164,16 +163,17 @@ public ApplicationManager getManager()
}

@Override
public ApplicationManagerUpdatable getManagerUpdatable()
@Deprecated
public net.dv8tion.jda.client.managers.ApplicationManagerUpdatable getManagerUpdatable()
{
ApplicationManagerUpdatable mng = managerUpdatable;
net.dv8tion.jda.client.managers.ApplicationManagerUpdatable mng = managerUpdatable;
if (mng == null)
{
synchronized (mngLock)
{
mng = managerUpdatable;
if (mng == null)
mng = managerUpdatable = new ApplicationManagerUpdatable(this);
mng = managerUpdatable = new net.dv8tion.jda.client.managers.ApplicationManagerUpdatable(this);
}
}
return mng;
Expand Down

0 comments on commit 9e593c5

Please sign in to comment.