-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
2,259 additions
and
129 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
api/src/main/java/net/draycia/carbon/api/event/events/PartyJoinEvent.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,58 @@ | ||
/* | ||
* CarbonChat | ||
* | ||
* Copyright (c) 2023 Josua Parks (Vicarious) | ||
* Contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.draycia.carbon.api.event.events; | ||
|
||
import java.util.UUID; | ||
import net.draycia.carbon.api.event.CarbonEvent; | ||
import net.draycia.carbon.api.users.CarbonPlayer; | ||
import net.draycia.carbon.api.users.Party; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.framework.qual.DefaultQualifier; | ||
|
||
/** | ||
* Called when a player is added to a {@link Party}. | ||
* | ||
* @since 2.1.0 | ||
*/ | ||
@DefaultQualifier(NonNull.class) | ||
public interface PartyJoinEvent extends CarbonEvent { | ||
|
||
/** | ||
* ID of the player joining a party. | ||
* | ||
* <p>The player's {@link CarbonPlayer#party()} field is not guaranteed to be updated immediately, | ||
* especially if the change needs to propagate cross-server.</p> | ||
* | ||
* @return player id | ||
* @since 2.1.0 | ||
*/ | ||
UUID playerId(); | ||
|
||
/** | ||
* The party being joined. | ||
* | ||
* <p>{@link Party#members()} will reflect the new member.</p> | ||
* | ||
* @return party | ||
* @since 2.1.0 | ||
*/ | ||
Party party(); | ||
|
||
} |
58 changes: 58 additions & 0 deletions
58
api/src/main/java/net/draycia/carbon/api/event/events/PartyLeaveEvent.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,58 @@ | ||
/* | ||
* CarbonChat | ||
* | ||
* Copyright (c) 2023 Josua Parks (Vicarious) | ||
* Contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.draycia.carbon.api.event.events; | ||
|
||
import java.util.UUID; | ||
import net.draycia.carbon.api.event.CarbonEvent; | ||
import net.draycia.carbon.api.users.CarbonPlayer; | ||
import net.draycia.carbon.api.users.Party; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.framework.qual.DefaultQualifier; | ||
|
||
/** | ||
* Called when a player is removed from a {@link Party}. | ||
* | ||
* @since 2.1.0 | ||
*/ | ||
@DefaultQualifier(NonNull.class) | ||
public interface PartyLeaveEvent extends CarbonEvent { | ||
|
||
/** | ||
* ID of the player leaving a party. | ||
* | ||
* <p>The player's {@link CarbonPlayer#party()} field is not guaranteed to be updated immediately, | ||
* especially if the change needs to propagate cross-server.</p> | ||
* | ||
* @return player id | ||
* @since 2.1.0 | ||
*/ | ||
UUID playerId(); | ||
|
||
/** | ||
* The party being left. | ||
* | ||
* <p>{@link Party#members()} will reflect the removed member.</p> | ||
* | ||
* @return party | ||
* @since 2.1.0 | ||
*/ | ||
Party party(); | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* CarbonChat | ||
* | ||
* Copyright (c) 2023 Josua Parks (Vicarious) | ||
* Contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package net.draycia.carbon.api.users; | ||
|
||
import java.util.Set; | ||
import java.util.UUID; | ||
import net.kyori.adventure.text.Component; | ||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.framework.qual.DefaultQualifier; | ||
|
||
/** | ||
* Reference to a chat party. | ||
* | ||
* @see UserManager#createParty(Component) | ||
* @see UserManager#party(UUID) | ||
* @since 2.1.0 | ||
*/ | ||
@DefaultQualifier(NonNull.class) | ||
public interface Party { | ||
|
||
/** | ||
* Get the name of this party. | ||
* | ||
* @return party name | ||
* @since 2.1.0 | ||
*/ | ||
Component name(); | ||
|
||
/** | ||
* Get the unique id of this party. | ||
* | ||
* @return party id | ||
* @since 2.1.0 | ||
*/ | ||
UUID id(); | ||
|
||
/** | ||
* Get a snapshot of the current party members. | ||
* | ||
* @return party members | ||
* @since 2.1.0 | ||
*/ | ||
Set<UUID> members(); | ||
|
||
/** | ||
* Add a user to this party. They will automatically be removed from their previous party if necessary. | ||
* | ||
* @param id user id | ||
* @since 2.1.0 | ||
*/ | ||
void addMember(UUID id); | ||
|
||
/** | ||
* Remove a user from this party. | ||
* | ||
* @param id user id | ||
* @since 2.1.0 | ||
*/ | ||
void removeMember(UUID id); | ||
|
||
/** | ||
* Disband this party. Will remove all members and delete persistent data. | ||
* | ||
* @since 2.1.0 | ||
*/ | ||
void disband(); | ||
|
||
} |
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.