Skip to content

Commit

Permalink
merge: version 4.3.0-SNAPSHOT [DEPLOY-SKIP] (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
Siroshun09 authored Jan 4, 2022
2 parents 1237137 + 95c43b7 commit 9a71e8b
Show file tree
Hide file tree
Showing 74 changed files with 1,787 additions and 310 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: "! contains(github.event.head_commit.message, '[DEPLOY-SKIP]')"
steps:
- uses: actions/[email protected]
- name: Set up JDK 16
uses: actions/setup-java@v2.3.1
uses: actions/setup-java@v2.5.0
with:
distribution: 'temurin'
java-version: '16'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
steps:
- uses: actions/[email protected]
- name: Set up JDK 16
uses: actions/setup-java@v2.3.1
uses: actions/setup-java@v2.5.0
with:
distribution: 'temurin'
java-version: '16'
Expand All @@ -32,7 +32,7 @@ jobs:
mv features/gui/build staging/features/gui
mv features/notifier/build staging/features/notifier
mv features/stick/build staging/features/stick
- uses: actions/upload-artifact@v2.2.4
- uses: actions/upload-artifact@v2.3.1
with:
name: Package
path: staging
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Box v4.2.1
# Box v4.3.0-SNAPSHOT

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/okocraft/Box)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/okocraft/Box/Maven%20Build)
Expand Down Expand Up @@ -85,19 +85,19 @@ For snapshot version, use https://okocraft.github.io/Box/maven-snapshot/
<dependency>
<groupId>net.okocraft.box</groupId>
<artifactId>api</artifactId>
<version>4.2.1</version>
<version>4.3.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
```

```gradle
dependencies {
compileOnly 'net.okocraft.box:api:4.2.1'
compileOnly 'net.okocraft.box:api:4.3.0-SNAPSHOT'
}
```

```kotlin
dependencies {
compileOnly("net.okocraft.box:api:4.2.1")
compileOnly("net.okocraft.box:api:4.3.0-SNAPSHOT")
}
```
11 changes: 11 additions & 0 deletions api/src/main/java/net/okocraft/box/api/event/BoxEvent.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
package net.okocraft.box.api.event;

import com.github.siroshun09.event4j.event.Event;
import org.jetbrains.annotations.NotNull;

/**
* A superclass for all events fired by the Box.
*/
public class BoxEvent extends Event {

/**
* Creates the debug log from this event.
*
* @return the debug log
*/
public @NotNull String toDebugLog() {
return toString();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ public FeatureEvent(@NotNull BoxFeature feature, @NotNull Type type) {
return type;
}

@Override
public @NotNull String toDebugLog() {
return "FeatureEvent{" +
"feature=" + feature.getName() +
", type=" + type +
'}';
}

@Override
public String toString() {
return "FeatureEvent{" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
package net.okocraft.box.api.event.general;

import net.okocraft.box.api.event.BoxEvent;
import org.jetbrains.annotations.NotNull;

/**
* An event called when the auto save task started.
*/
public class AutoSaveStartEvent extends BoxEvent {

@Override
public @NotNull String toDebugLog() {
return getEventName();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.Objects;

/**
* A event called when the {@link BoxItem} is imported.
* An event called when the {@link BoxItem} is imported.
* <p>
* This event is for debugging only, and will only be called when the Box is starting.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public PlayerLoadEvent(@NotNull BoxPlayer boxPlayer) {
super(boxPlayer);
}

@Override
public @NotNull String toDebugLog() {
return "PlayerLoadEvent{" +
"uuid=" + getBoxPlayer().getUUID() +
", name=" + getBoxPlayer().getName() +
'}';
}

@Override
public String toString() {
return "PlayerLoadEvent{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class PlayerStockHolderChangeEvent extends PlayerEvent implements AsyncEv
* The constructor of a {@link PlayerStockHolderChangeEvent}.
*
* @param boxPlayer the player of this event
* @param previous the previous {@link StockHolder}
* @param previous the previous {@link StockHolder}
*/
public PlayerStockHolderChangeEvent(@NotNull BoxPlayer boxPlayer,
@NotNull StockHolder previous) {
Expand All @@ -34,4 +34,26 @@ public PlayerStockHolderChangeEvent(@NotNull BoxPlayer boxPlayer,
public @NotNull StockHolder getPreviousStockHolder() {
return previous;
}

@Override
public @NotNull String toDebugLog() {
return "PlayerStockHolderChangeEvent{" +
"uuid=" + getBoxPlayer().getUUID() +
", name=" + getBoxPlayer().getName() +
", previousStockholderUuid=" + previous.getUUID() +
", previousStockHolderName=" + previous.getName() +
", previousStockHolderClass=" + previous.getClass().getSimpleName() +
", currentStockholderUuid=" + getBoxPlayer().getCurrentStockHolder().getUUID() +
", currentStockHolderName=" + getBoxPlayer().getCurrentStockHolder().getName() +
", currentStockHolderClass=" + getBoxPlayer().getCurrentStockHolder().getClass().getSimpleName() +
'}';
}

@Override
public String toString() {
return "PlayerStockHolderChangeEvent{" +
"boxPlayer=" + getBoxPlayer() +
", previous=" + previous +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public PlayerUnloadEvent(@NotNull BoxPlayer boxPlayer) {
super(boxPlayer);
}

@Override
public @NotNull String toDebugLog() {
return "PlayerUnloadEvent{" +
"uuid=" + getBoxPlayer().getUUID() +
", name=" + getBoxPlayer().getName() +
'}';
}

@Override
public String toString() {
return "PlayerUnloadEvent{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ public int getAmount() {
return amount;
}

@Override
public @NotNull String toDebugLog() {
return "StockDecreaseEvent{" +
"stockholderUuid=" + getStockHolder().getUUID() +
", stockHolderName=" + getStockHolder().getName() +
", stockHolderClass=" + getStockHolder().getClass().getSimpleName() +
", item=" + item +
", decrements=" + decrements +
", amount=" + amount +
'}';
}

@Override
public String toString() {
return "StockDecreaseEvent{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ public int getAmount() {
return amount;
}

@Override
public @NotNull String toDebugLog() {
return "StockIncreaseEvent{" +
"stockholderUuid=" + getStockHolder().getUUID() +
", stockHolderName=" + getStockHolder().getName() +
", stockHolderClass=" + getStockHolder().getClass().getSimpleName() +
", item=" + item +
", increments=" + increments +
", amount=" + amount +
'}';
}

@Override
public String toString() {
return "StockIncreaseEvent{" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,24 @@ public int getPreviousAmount() {
return previousAmount;
}

@Override
public @NotNull String toDebugLog() {
return "StockSetEvent{" +
"stockholderUuid=" + getStockHolder().getUUID() +
", stockHolderName=" + getStockHolder().getName() +
", stockHolderClass=" + getStockHolder().getClass().getSimpleName() +
", item=" + item +
", previousAmount=" + previousAmount +
", amount=" + amount +
'}';
}

@Override
public String toString() {
return "StockSetEvent{" +
"stockholder=" + getStockHolder() +
", item=" + item +
", previousAmount=" + previousAmount +
", amount=" + amount +
'}';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,13 @@ public boolean isUserStockHolder() {
throw new IllegalStateException("The StockHolder of this event is not UserStockHolder.");
}
}

@Override
public @NotNull String toDebugLog() {
return getEventName() + "{" +
"uuid=" + getStockHolder().getUUID() +
", name=" + getStockHolder().getName() +
", class=" + getStockHolder().getClass().getSimpleName() +
"}";
}
}
13 changes: 13 additions & 0 deletions api/src/main/java/net/okocraft/box/api/feature/BoxFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

import com.github.siroshun09.event4j.handlerlist.Key;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;

import java.util.Collections;
import java.util.Set;

/**
* An interface that adds a box feature.
Expand Down Expand Up @@ -33,4 +37,13 @@ public interface BoxFeature {
* This method will be called even if an exception is thrown while executing {@link #enable()}.
*/
void disable();

/**
* Gets classes of the dependent {@link BoxFeature}.
*
* @return classes of the dependent {@link BoxFeature}
*/
default @NotNull @Unmodifiable Set<Class<? extends BoxFeature>> getDependencies() {
return Collections.emptySet();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.okocraft.box.api.feature;

/**
* An interface to indicate that the {@link BoxFeature} can be disabled in config.yml.
*/
public interface Disableable {
}
Loading

0 comments on commit 9a71e8b

Please sign in to comment.