Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First pass on Presence controller/holder
- Loading branch information
Florian Spieß
committed
Nov 1, 2016
1 parent
9af8e2c
commit 9c0d5dc
Showing
11 changed files
with
496 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/main/java/net/dv8tion/jda/client/entities/UserSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2015-2016 Austin Keener & Michael Ritter | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.dv8tion.jda.client.entities; | ||
|
||
import net.dv8tion.jda.core.JDA; | ||
import net.dv8tion.jda.core.OnlineStatus; | ||
import net.dv8tion.jda.core.entities.Guild; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
public interface UserSettings | ||
{ | ||
|
||
JDA getJDA(); | ||
|
||
OnlineStatus getStatus(); | ||
Locale getLocale(); | ||
//getTheme() : ? | ||
|
||
List<Guild> getGuildPositions(); | ||
List<Guild> getRestrictedGuilds(); | ||
|
||
boolean isAllowEmailFriendRequest(); | ||
boolean isConvertEmoticons(); | ||
boolean isDetectPlatformAccounts(); | ||
boolean isDeveloperMode(); | ||
boolean isEnableTTS(); | ||
boolean isShowCurrentGame(); | ||
boolean isRenderEmbeds(); | ||
boolean isMessageDisplayCompact(); | ||
boolean isInlineEmbedMedia(); | ||
boolean isInlineAttachmentMedia(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
src/main/java/net/dv8tion/jda/client/entities/impl/UserSettingsImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/* | ||
* Copyright 2015-2016 Austin Keener & Michael Ritter | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package net.dv8tion.jda.client.entities.impl; | ||
|
||
import net.dv8tion.jda.client.entities.UserSettings; | ||
import net.dv8tion.jda.core.JDA; | ||
import net.dv8tion.jda.core.OnlineStatus; | ||
import net.dv8tion.jda.core.entities.Guild; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
public class UserSettingsImpl implements UserSettings | ||
{ | ||
|
||
private final JDA api; | ||
|
||
private OnlineStatus status = OnlineStatus.UNKNOWN; | ||
|
||
public UserSettingsImpl(JDA api) | ||
{ | ||
this.api = api; | ||
} | ||
|
||
@Override | ||
public JDA getJDA() | ||
{ | ||
return api; | ||
} | ||
|
||
|
||
@Override | ||
public OnlineStatus getStatus() | ||
{ | ||
return status; | ||
} | ||
|
||
@Override | ||
public Locale getLocale() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Guild> getGuildPositions() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<Guild> getRestrictedGuilds() | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean isAllowEmailFriendRequest() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isConvertEmoticons() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDetectPlatformAccounts() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isDeveloperMode() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isEnableTTS() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isShowCurrentGame() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isRenderEmbeds() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isMessageDisplayCompact() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isInlineEmbedMedia() | ||
{ | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isInlineAttachmentMedia() | ||
{ | ||
return false; | ||
} | ||
|
||
/* -- Setters -- */ | ||
|
||
public UserSettingsImpl setStatus(OnlineStatus status) | ||
{ | ||
this.status = status; | ||
return this; | ||
} | ||
|
||
/* -- Object overrides -- */ | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return getJDA().getSelfInfo().getId().hashCode(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object obj) | ||
{ | ||
return obj instanceof UserSettingsImpl && getJDA().equals(((UserSettingsImpl) obj).getJDA()); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "UserSettings(" + getJDA().getSelfInfo() + ")"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.