Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented support for RELATIONSHIP_ADD and RELATIONSHIP_REMOVE.
Created FriendAdded, FriendRemoved, UserBlocked, UserUnblocked, FriendRequestSent, (FR)Canceled, (FR)Received, and (FR)Ignored events. Reordered the events checked in ListenerAdapter to make Messages checked first for faster events for Messages.
- Loading branch information
1 parent
15a216a
commit bc0b8ef
Showing
16 changed files
with
627 additions
and
38 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendAddedEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.Friend; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendAddedEvent extends GenericRelationshipAddEvent | ||
{ | ||
public FriendAddedEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public Friend getFriend() | ||
{ | ||
return (Friend) relationship; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendRemovedEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.Friend; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendRemovedEvent extends GenericRelationshipRemoveEvent | ||
{ | ||
public FriendRemovedEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public Friend getFriend() | ||
{ | ||
return (Friend) relationship; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendRequestCanceledEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.OutgoingFriendRequest; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendRequestCanceledEvent extends GenericRelationshipRemoveEvent | ||
{ | ||
public FriendRequestCanceledEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public OutgoingFriendRequest getFriendRequest() | ||
{ | ||
return (OutgoingFriendRequest) relationship; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendRequestIgnoredEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.IncomingFriendRequest; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendRequestIgnoredEvent extends GenericRelationshipRemoveEvent | ||
{ | ||
public FriendRequestIgnoredEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public IncomingFriendRequest getFriendRequest() | ||
{ | ||
return (IncomingFriendRequest) relationship; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendRequestReceivedEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.IncomingFriendRequest; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendRequestReceivedEvent extends GenericRelationshipAddEvent | ||
{ | ||
public FriendRequestReceivedEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public IncomingFriendRequest getFriendRequest() | ||
{ | ||
return (IncomingFriendRequest) relationship; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/FriendRequestSentEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.OutgoingFriendRequest; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class FriendRequestSentEvent extends GenericRelationshipAddEvent | ||
{ | ||
public FriendRequestSentEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public OutgoingFriendRequest getFriendRequest() | ||
{ | ||
return (OutgoingFriendRequest) relationship; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/net/dv8tion/jda/client/events/relationship/GenericRelationshipAddEvent.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,28 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public abstract class GenericRelationshipAddEvent extends GenericRelationshipEvent | ||
{ | ||
public GenericRelationshipAddEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
src/main/java/net/dv8tion/jda/client/events/relationship/GenericRelationshipEvent.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,49 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.client.entities.RelationshipType; | ||
import net.dv8tion.jda.core.JDA; | ||
import net.dv8tion.jda.core.entities.User; | ||
import net.dv8tion.jda.core.events.Event; | ||
|
||
public abstract class GenericRelationshipEvent extends Event | ||
{ | ||
protected final Relationship relationship; | ||
|
||
public GenericRelationshipEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber); | ||
this.relationship = relationship; | ||
} | ||
|
||
public Relationship getRelationship() | ||
{ | ||
return relationship; | ||
} | ||
|
||
public RelationshipType getRelationshipType() | ||
{ | ||
return relationship.getType(); | ||
} | ||
|
||
public User getUser() | ||
{ | ||
return relationship.getUser(); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/net/dv8tion/jda/client/events/relationship/GenericRelationshipRemoveEvent.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,28 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public abstract class GenericRelationshipRemoveEvent extends GenericRelationshipEvent | ||
{ | ||
public GenericRelationshipRemoveEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/UserBlockedEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.BlockedUser; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class UserBlockedEvent extends GenericRelationshipAddEvent | ||
{ | ||
public UserBlockedEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public BlockedUser getBlockedUser() | ||
{ | ||
return (BlockedUser) getBlockedUser(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/net/dv8tion/jda/client/events/relationship/UserUnblockedEvent.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,34 @@ | ||
/* | ||
* 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.events.relationship; | ||
|
||
import net.dv8tion.jda.client.entities.BlockedUser; | ||
import net.dv8tion.jda.client.entities.Relationship; | ||
import net.dv8tion.jda.core.JDA; | ||
|
||
public class UserUnblockedEvent extends GenericRelationshipRemoveEvent | ||
{ | ||
public UserUnblockedEvent(JDA api, long responseNumber, Relationship relationship) | ||
{ | ||
super(api, responseNumber, relationship); | ||
} | ||
|
||
public BlockedUser getPreviouslyBlockedUser() | ||
{ | ||
return (BlockedUser) relationship; | ||
} | ||
} |
Oops, something went wrong.