Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-85 Add delivery codes #85

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repositories {

dependencies {
// minecraft development api
compileOnly("org.spigotmc:spigot-api:1.20.2-R0.1-SNAPSHOT")
compileOnly("org.spigotmc:spigot-api:1.20.2-experimental-SNAPSHOT")
implementation("net.kyori:adventure-platform-bukkit:4.3.1")
implementation("net.kyori:adventure-text-minimessage:4.14.0")
implementation("dev.rollczi.litecommands:bukkit-adventure:2.8.9")
Expand All @@ -51,7 +51,7 @@ dependencies {

// metrics and sentry
implementation("org.bstats:bstats-bukkit:3.0.2")
implementation("io.sentry:sentry:6.31.0")
implementation("io.sentry:sentry:6.32.0")

// database
implementation("com.zaxxer:HikariCP:5.0.1")
Expand Down
48 changes: 24 additions & 24 deletions src/main/java/com/eternalcode/parcellockers/ParcelLockers.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public void onEnable() {

this.audiences = BukkitAudiences.create(this);
MiniMessage miniMessage = MiniMessage.builder()
.postProcessor(new LegacyColorProcessor())
.build();
.postProcessor(new LegacyColorProcessor())
.build();
NotificationAnnouncer announcer = new NotificationAnnouncer(this.audiences, miniMessage);

ConfigurationManager configManager = new ConfigurationManager(this.getDataFolder());
Expand All @@ -84,28 +84,28 @@ public void onEnable() {

HikariDataSource dataSource = DataSourceFactory.buildHikariDataSource(config, this.getDataFolder());

LockerRepositoryImpl parcelLockerRepositoryImpl = new LockerRepositoryImpl(dataSource);
parcelLockerRepositoryImpl.updatePositionCache();
LockerRepositoryImpl lockerRepositoryImpl = new LockerRepositoryImpl(dataSource);
lockerRepositoryImpl.updatePositionCache();

ParcelRepositoryImpl parcelRepository = new ParcelRepositoryImpl(dataSource);

ParcelManager parcelManager = new ParcelManager(config, announcer, parcelRepository);
LockerManager lockerManager = new LockerManager(parcelLockerRepositoryImpl);
LockerManager lockerManager = new LockerManager(lockerRepositoryImpl);

MainGUI mainGUI = new MainGUI(this, server, miniMessage, config, parcelRepository, lockerRepositoryImpl);
ParcelListGUI parcelListGUI = new ParcelListGUI(this, server, miniMessage, config, parcelRepository, lockerRepositoryImpl, mainGUI);

MainGUI mainGUI = new MainGUI(this, server, miniMessage, config, parcelRepository, parcelLockerRepositoryImpl);
ParcelListGUI parcelListGUI = new ParcelListGUI(this, server, miniMessage, config, parcelRepository, parcelLockerRepositoryImpl, mainGUI);

this.liteCommands = LiteBukkitAdventurePlatformFactory.builder(server, "parcellockers", false, this.audiences, true)
.argument(Parcel.class, new ParcelArgument(parcelRepository))
.argument(Player.class, new PlayerArgument(server, config))
.contextualBind(Player.class, new BukkitOnlyPlayerContextual<>(config.messages.onlyForPlayers))
.commandInstance(
new ParcelCommand(server, parcelLockerRepositoryImpl, announcer, config, mainGUI, parcelListGUI, parcelManager),
new ParcelLockersCommand(configManager, config, announcer, miniMessage)
)
.invalidUsageHandler(new InvalidUsage(announcer, config))
.permissionHandler(new PermissionMessage(announcer, config))
.register();
.argument(Parcel.class, new ParcelArgument(parcelRepository))
.argument(Player.class, new PlayerArgument(server, config))
.contextualBind(Player.class, new BukkitOnlyPlayerContextual<>(config.messages.onlyForPlayers))
.commandInstance(
new ParcelCommand(server, lockerRepositoryImpl, announcer, config, mainGUI, parcelListGUI, parcelManager),
new ParcelLockersCommand(configManager, config, announcer, miniMessage)
)
.invalidUsageHandler(new InvalidUsage(announcer, config))
.permissionHandler(new PermissionMessage(announcer, config))
.register();

if (!this.setupEconomy()) {
this.getLogger().severe("Disabling due to no Vault dependency found!");
Expand All @@ -114,9 +114,9 @@ public void onEnable() {
}

Stream.of(
new LockerInteractionController(parcelLockerRepositoryImpl, miniMessage, config),
new LockerPlaceController(config, miniMessage, this, parcelLockerRepositoryImpl, announcer),
new LockerBreakController(parcelLockerRepositoryImpl, announcer, config.messages)
new LockerInteractionController(lockerRepositoryImpl, miniMessage, config),
new LockerPlaceController(config, miniMessage, this, lockerRepositoryImpl, announcer),
new LockerBreakController(lockerRepositoryImpl, announcer, config.messages)
).forEach(controller -> server.getPluginManager().registerEvents(controller, this));

new Metrics(this, 17677);
Expand Down Expand Up @@ -161,12 +161,12 @@ private boolean setupEconomy() {
if (this.getServer().getPluginManager().getPlugin("Vault") == null) {
return false;
}

RegisteredServiceProvider<Economy> rsp = this.getServer().getServicesManager().getRegistration(Economy.class);
if (rsp == null) {
return false;
}

this.economy = rsp.getProvider();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public ParcelLockersCommand(ConfigurationManager configManager, PluginConfigurat
this.announcer = announcer;
this.miniMessage = miniMessage;
}

@Async
@Execute(route = "reload", aliases = {"rl"})
void reload(CommandSender sender) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public PlayerArgument(Server server, PluginConfiguration config) {
@Override
public List<Suggestion> suggest(LiteInvocation invocation) {
return this.server.getOnlinePlayers().stream()
.map(HumanEntity::getName)
.map(Suggestion::of)
.toList();
.map(HumanEntity::getName)
.map(Suggestion::of)
.toList();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void handle(CommandSender sender, LiteInvocation invocation, Schematic sc

for (String scheme : schematics) {
Formatter formatter = new Formatter()
.register("{USAGE}", scheme);
.register("{USAGE}", scheme);

this.announcer.sendMessage(sender, formatter.format(this.config.messages.invalidUsage));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public PermissionMessage(NotificationAnnouncer announcer, PluginConfiguration co
@Override
public void handle(CommandSender commandSender, LiteInvocation invocation, RequiredPermissions requiredPermissions) {
String value = Joiner.on(", ")
.join(requiredPermissions.getPermissions())
.toString();
.join(requiredPermissions.getPermissions())
.toString();

Formatter formatter = new Formatter()
.register("{PERMISSION}", value);
.register("{PERMISSION}", value);

this.announcer.sendMessage(commandSender, formatter.format(this.config.messages.noPermission));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
public class ConfigurationManager {

private static final Cdn CDN = CdnFactory
.createYamlLike()
.getSettings()
.withComposer(PositionComposer.class, new PositionComposer())
.build();
.createYamlLike()
.getSettings()
.withComposer(PositionComposer.class, new PositionComposer())
.build();

private final Set<ReloadableConfig> configs = new HashSet<>();
private final File dataFolder;
Expand All @@ -25,10 +25,10 @@ public ConfigurationManager(File dataFolder) {

public <T extends ReloadableConfig> T load(T config) {
CDN.load(config.resource(this.dataFolder), config)
.orThrow(RuntimeException::new);
.orThrow(RuntimeException::new);

CDN.render(config, config.resource(this.dataFolder))
.orThrow(RuntimeException::new);
.orThrow(RuntimeException::new);

this.configs.add(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public GuiItem toGuiItem(MiniMessage miniMessage, GuiAction<InventoryClickEvent>
}

public GuiItem toGuiItem(MiniMessage miniMessage) {
return this.toGuiItem(miniMessage, event -> {});
return this.toGuiItem(miniMessage, event -> {
});
}

public ConfigItem setType(Material type) {
Expand Down
Loading