Skip to content

Commit

Permalink
merge: version 4.1.0-SNAPSHOT (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 authored Oct 16, 2021
2 parents 26b0762 + 724cda3 commit a1dca85
Show file tree
Hide file tree
Showing 93 changed files with 1,778 additions and 499 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Maven Deployment
on:
push:
branches:
- "v4/master"
- "v4/develop"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Set up JDK 16
uses: actions/[email protected]
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'
- name: Deploy to staging directory
run: |
mvn clean
mvn -B deploy --file pom.xml
- name: Move Javadoc pages to staging directory (release)
if: ${{ github.ref == 'refs/heads/v4/master' }}
run: |
rm -rf staging/release
mv target/site/apidocs staging/release
- name: Move Javadoc pages to staging directory (snapshot)
if: ${{ github.ref == 'refs/heads/v4/develop' }}
run: |
rm -rf staging/snapshot
mv target/site/apidocs staging/snapshot
- name: Create top and not-found pages
run: |
cp -f assets/gh-pages.html staging/index.html
cp -f assets/gh-pages.html staging/404.html
- name: Deploy to GitHub Pages
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./staging
keep_files: true
allow_empty_commit: true
6 changes: 3 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].5
- name: Set up JDK 16
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
distribution: 'temurin'
java-version: '16'
cache: 'maven'
- name: Build with Maven
run: |
mvn clean
mvn -B package --file pom.xml
mvn -B package --file pom.xml -D maven.javadoc.skip=true
- name: Move the artifact
run: |
mkdir staging
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ buildNumber.properties
# Box Wiki

./wiki

# Box Staging Directory

staging
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,48 @@ Box には以下のような特徴があります。
* `languages/ja_JP.yml`

が生成されます。起動後、何も設定しなくても使い始めることができます。

## API

### Javadocs

- [Latest Release](https://okocraft.github.io/Box/release)
- [Snapshot](https://okocraft.github.io/Box/snapshot)

### Usage

#### 1. Add a repository

```xml
<repository>
<id>okocraft-box-repo</id>
<url>https://okocraft.github.io/Box/maven/</url>
</repository>
```

```gradle
repositories {
maven {
url 'https://okocraft.github.io/Box/maven/'
}
}
```

For snapshot version, use https://okocraft.github.io/Box/maven-snapshot/

#### 2. Add to dependencies

```xml
<dependency>
<groupId>net.okocraft.box</groupId>
<artifactId>api</artifactId>
<version>4.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```

```gradle
dependencies {
compileOnly 'net.okocraft.box:api:4.1.0-SNAPSHOT'
}
```
43 changes: 3 additions & 40 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>net.okocraft.box</groupId>
<artifactId>parent</artifactId>
<version>4.0.0</version>
<version>4.1.0-SNAPSHOT</version>
</parent>

<artifactId>api</artifactId>
Expand All @@ -16,51 +16,14 @@
<dependency>
<groupId>com.github.siroshun09.configapi</groupId>
<artifactId>configapi-yaml</artifactId>
<version>4.5.0-SNAPSHOT</version>
<version>4.5.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.siroshun09.event4j</groupId>
<artifactId>event4j</artifactId>
<version>2.0.0</version>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<source>${java.version}</source>
<charset>${project.charset}</charset>
<encoding>${project.charset}</encoding>
<docencoding>${project.charset}</docencoding>
<linksource>true</linksource>
<locale>en_US</locale>
<notimestamp>true</notimestamp>
<show>protected</show>
<quiet>true</quiet>
<links>
<link>https://papermc.io/javadocs/paper/1.17/</link>
<link>https://jd.adventure.kyori.net/api/4.8.1/</link>
<link>https://javadoc.io/doc/org.jetbrains/annotations/22.0.0/</link>
<link>https://siroshun09.github.io/ConfigAPI/</link>
<link>https://siroshun09.github.io/Event4J/</link>
</links>
</configuration>
</plugin>
</plugins>
</build>
</project>
11 changes: 11 additions & 0 deletions api/src/main/java/net/okocraft/box/api/BoxAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import net.okocraft.box.api.model.manager.StockManager;
import net.okocraft.box.api.model.manager.UserManager;
import net.okocraft.box.api.player.BoxPlayerMap;
import net.okocraft.box.api.taskfactory.TaskFactory;
import net.okocraft.box.api.util.ExecutorProvider;
import org.bukkit.NamespacedKey;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;

Expand Down Expand Up @@ -106,11 +108,20 @@ public interface BoxAPI {
*/
@NotNull CustomDataContainer getCustomDataContainer();

/**
* Gets the {@link TaskFactory}.
*
* @return the {@link TaskFactory}
*/
@NotNull TaskFactory getTaskFactory();

/**
* Gets the {@link ExecutorProvider}.
*
* @return the {@link ExecutorProvider}
*/
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "4.2.0")
@NotNull ExecutorProvider getExecutorProvider();

/**
Expand Down
4 changes: 3 additions & 1 deletion api/src/main/java/net/okocraft/box/api/BoxProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
* A class to provide {@link BoxAPI}.
*/
Expand Down Expand Up @@ -31,7 +33,7 @@ public final class BoxProvider {
*/
public static void set(@NotNull BoxAPI api) {
if (API == null) {
API = api;
API = Objects.requireNonNull(api);
} else {
throw new IllegalStateException("BoxAPI is already set.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
Expand Down Expand Up @@ -40,9 +41,9 @@ public AbstractCommand(@NotNull String name, @NotNull String permissionNode) {
* @param aliases the set of aliases
*/
public AbstractCommand(@NotNull String name, @NotNull String permissionNode, @NotNull Set<String> aliases) {
this.name = name;
this.permissionNode = permissionNode;
this.aliases = aliases;
this.name = Objects.requireNonNull(name);
this.permissionNode = Objects.requireNonNull(permissionNode);
this.aliases = Objects.requireNonNull(aliases);
}

public @NotNull String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;

/**
Expand Down Expand Up @@ -34,6 +35,7 @@ class SubCommandHolder {
* @param subCommands the set of subcommands
*/
public SubCommandHolder(@NotNull Command... subCommands) {
Objects.requireNonNull(subCommands);
this.subCommands = new ArrayList<>(Arrays.asList(subCommands));
}

Expand Down Expand Up @@ -74,7 +76,7 @@ public void unregister(@NotNull Command subCommand) {
* @return the search result
*/
public @NotNull Optional<Command> search(@NotNull String name) {
name = name.toLowerCase(Locale.ROOT);
name = Objects.requireNonNull(name).toLowerCase(Locale.ROOT);

for (var subCommand : subCommands) {
if (subCommand.getName().equals(name) || subCommand.getAliases().contains(name)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.okocraft.box.api.feature.BoxFeature;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
* A class that represents a {@link BoxFeature} related event.
*/
Expand All @@ -19,8 +21,8 @@ public class FeatureEvent extends BoxEvent {
* @param type the type of this event
*/
public FeatureEvent(@NotNull BoxFeature feature, @NotNull Type type) {
this.feature = feature;
this.type = type;
this.feature = Objects.requireNonNull(feature);
this.type = Objects.requireNonNull(type);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import net.okocraft.box.api.model.item.BoxItem;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
* A event called when the {@link BoxItem} is imported.
* <p>
Expand All @@ -20,7 +22,7 @@ public class ItemImportEvent extends ItemEvent {
*/
public ItemImportEvent(@NotNull BoxItem importedItem, @NotNull ItemType type) {
super(importedItem);
this.type = type;
this.type = Objects.requireNonNull(type);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.okocraft.box.api.player.BoxPlayer;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
* A class that represents a {@link BoxPlayer} related event.
*/
Expand All @@ -17,7 +19,7 @@ public class PlayerEvent extends BoxEvent {
* @param boxPlayer the player of this event
*/
public PlayerEvent(@NotNull BoxPlayer boxPlayer) {
this.boxPlayer = boxPlayer;
this.boxPlayer = Objects.requireNonNull(boxPlayer);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import net.okocraft.box.api.player.BoxPlayer;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;

/**
* A {@link PlayerEvent} called when the player changed the {@link StockHolder}.
*/
Expand All @@ -20,7 +22,7 @@ public class PlayerStockHolderChangeEvent extends PlayerEvent {
public PlayerStockHolderChangeEvent(@NotNull BoxPlayer boxPlayer,
@NotNull StockHolder previous) {
super(boxPlayer);
this.previous = previous;
this.previous = Objects.requireNonNull(previous);
}

/**
Expand Down
Loading

0 comments on commit a1dca85

Please sign in to comment.