Implement Guice and Moonshine (#139)

* Initial pass - 1/?

* oops

* War against legacy, part 1

* Stuff & Bukkit

* Sponge

* Initial pass - 1/?

* more guice

* Separate guice module out

* Fix broken rebase

* Hello from Carbon!

* stuff

* Move init to correct location

* Bukkit has moonshine!

* Minor adjustments

* Sponge guice part 1

* No turning back from this party

* fix relocations and exclusions

* Some cleanup with the Bukkit side of things, too

* Add comment explaining why we pass this argument

Co-authored-by: Riley Park <[email protected]>
Co-authored-by: jmp <[email protected]>
This commit is contained in:
authored and GitHub committed 2021-05-21 04:04:41 -07:00
1 parent a213ed8d9f
commit 2582c30e84
38 files changed
+908 -129

No files matched your search

@@ -1,12 +1,12 @@
package net.draycia.carbon.api;
import net.draycia.carbon.api.events.CarbonEventHandler;
import net.draycia.carbon.api.users.CarbonPlayer;
import net.draycia.carbon.api.users.UserManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.framework.qual.DefaultQualifier;
import java.nio.file.Path;
/**
* The main plugin interface.<br>
* Instances may be obtained through {@link CarbonChatProvider#carbonChat()}.
@@ -25,6 +25,15 @@ public interface CarbonChat {
*/
Logger logger();
/**
* The plugin's data storage directory.<br>
* This is where configs and misc files will be stored.
*
* @return the plugin's data directory
* @since 2.0.0
*/
Path dataDirectory();
/**
* The event handler, used for listening to and emitting events.
*
@@ -34,11 +43,11 @@ public interface CarbonChat {
CarbonEventHandler eventHandler();
/**
* The user manager, used for loading and obtaining {@link CarbonPlayer CarbonPlayers}.
* The server that carbon is running on.
*
* @return the user manager
* @return the server
* @since 2.0.0
*/
UserManager userManager();
CarbonServer server();
}
@@ -0,0 +1,53 @@
package net.draycia.carbon.api;
import net.draycia.carbon.api.users.CarbonPlayer;
import net.kyori.adventure.audience.Audience;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.framework.qual.DefaultQualifier;
import java.util.UUID;
/**
* The server that carbon is running on.
*
* @since 2.0.0
*/
@DefaultQualifier(NonNull.class)
public interface CarbonServer extends Audience {
/**
* The server's console.
*
* @return the server's console
* @since 2.0.0
*/
Audience console();
/**
* The players that are online on the server.
*
* @return the online players
* @since 2.0.0
*/
Iterable<? extends CarbonPlayer> players();
/**
* Obtains a {@link CarbonPlayer} instance for the specified uuid.
*
* @param uuid the player's uuid
* @return the player
* @since 2.0.0
*/
@Nullable CarbonPlayer player(final UUID uuid);
/**
* Obtains a {@link CarbonPlayer} instance for the specified username.
*
* @param username the player's username
* @return the player
* @since 2.0.0
*/
@Nullable CarbonPlayer player(final String username);
}
@@ -75,4 +75,13 @@ public interface CarbonPlayer extends Audience, Identified {
*/
void selectedChannel(final ChatChannel chatChannel);
/**
* Checks if the player has the specified permission.
*
* @param permission the permission to check
* @return if the player has the permission
* @since 2.0.0
*/
boolean hasPermission(final String permission);
}