Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Apr 17, 2022
2 parents fc03ba8 + f78c22a commit 4294d76
Show file tree
Hide file tree
Showing 26 changed files with 344 additions and 137 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ jobs:
prerelease: true
title: "Slimefun 自动构建版本"
files: |
target/Slimefun-v4.9-*.jar
target/Slimefun-*.jar
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<extension>
<groupId>me.qoomon</groupId>
<artifactId>maven-git-versioning-extension</artifactId>
<version>7.2.3</version>
<version>7.3.0</version>
</extension>

</extensions>
8 changes: 4 additions & 4 deletions .mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<refs>
<ref type ="branch">
<pattern>master</pattern>
<version>4.9-canary-${commit.short}</version>
<version>${commit.short}-canary</version>
</ref>
<ref type ="branch">
<pattern>release</pattern>
<version>4.9-release-${commit.timestamp.year}.${commit.timestamp.month}</version>
<version>${commit.timestamp.year}.${commit.timestamp.month}-release</version>
</ref>
<ref type ="branch">
<pattern>test/(.+)</pattern>
<version>4.9-${1}-${commit.short}</version>
<version>${1}-${commit.short}</version>
</ref>
<ref type = "tag">
<pattern>v([0-9].*)></pattern>
<pattern>([0-9].*)></pattern>
<version>${1}</version>
</ref>
</refs>
Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Table of contents
- [Release Candidate 31 (TBD)](#release-candidate-31-tbd)
- [Release Candidate 32 (TBD)](#release-candidate-32-tbd)
- [Release Candidate 31 (14 Mar 2022)](#release-candidate-31-14-mar-2022)
- [Release Candidate 30 (31 Dec 2021)](#release-candidate-30-31-dec-2021)
- [Release Candidate 29 (07 Nov 2021)](#release-candidate-29-07-nov-2021)
- [Release Candidate 28 (06 Sep 2021)](#release-candidate-28-06-sep-2021)
Expand Down Expand Up @@ -31,7 +32,19 @@
- [Release Candidate 2 (29 Sep 2019)](#release-candidate-2-29-sep-2019)
- [Release Candidate 1 (26 Sep 2019)](#release-candidate-1-26-sep-2019)

## Release Candidate 31 (TBD)

## Release Candidate 32 (TBD)

#### Additions

#### Changes

#### Fixes
* Fixed #3445
* Fixed #3504

## Release Candidate 31 (14 Mar 2022)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#31

#### Additions
* Added Armored Jetpack
Expand All @@ -49,6 +62,7 @@
* You can now pick up Slimefun blocks in creative mode using the middle mouse button
* `/sf search` no longer shows items in hidden item groups (can be overidden by a config setting)
* Fluid Pumps can now fill bottles with water
* (API) Added Shulker boxes to `ColoredMaterial` enum

#### Changes
* (API) `BiomeMapParser` is now `public`
Expand Down
6 changes: 0 additions & 6 deletions jitpack.yml

This file was deleted.

14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<!-- Dependency shading -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.3.0</version>

<configuration>
<!-- Relocate these to avoid clashes and conflicts -->
Expand Down Expand Up @@ -169,7 +169,7 @@
<!-- Plugin for Unit Tests -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.0.0-M6</version>

<configuration>
<junitArtifactName>org.junit.jupiter:junit-jupiter</junitArtifactName>
Expand Down Expand Up @@ -245,7 +245,7 @@
<dependency>
<groupId>com.konghq</groupId>
<artifactId>unirest-java</artifactId>
<version>3.13.6</version>
<version>3.13.7</version>
<scope>compile</scope>

<exclusions>
Expand Down Expand Up @@ -273,7 +273,7 @@
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.18</artifactId>
<version>1.18.1</version>
<version>1.24.1</version>
<scope>test</scope>

<exclusions>
Expand Down Expand Up @@ -318,7 +318,7 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.209</version>
<version>2.1.211</version>
<scope>provided</scope>

<exclusions>
Expand Down Expand Up @@ -360,7 +360,7 @@
<dependency>
<groupId>com.github.LoneDev6</groupId>
<artifactId>itemsadder-api</artifactId>
<version>3.0.0</version>
<version>3.0.5</version>
<scope>provided</scope>

<exclusions>
Expand Down Expand Up @@ -415,7 +415,7 @@
<dependency>
<groupId>org.maxgamer</groupId>
<artifactId>QuickShop</artifactId>
<version>5.1.0.3</version>
<version>5.1.0.6</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public ItemGroup(NamespacedKey key, ItemStack item, int tier) {
}

@Override
@Nonnull
public final NamespacedKey getKey() {
public final @Nonnull NamespacedKey getKey() {
return key;
}

Expand All @@ -117,6 +116,16 @@ public void register(@Nonnull SlimefunAddon addon) {
sortCategoriesByTier();
}

/**
* This method returns whether this {@link ItemGroup} has been registered yet.
* More specifically: Whether {@link #register(SlimefunAddon)} was called or not.
*
* @return Whether this {@link ItemGroup} has been registered
*/
public boolean isRegistered() {
return this.addon != null && Slimefun.getRegistry().getAllItemGroups().contains(this);
}

/**
* Returns the tier of this {@link ItemGroup}.
* The tier determines the position of this {@link ItemGroup} in the {@link SlimefunGuide}.
Expand Down Expand Up @@ -157,8 +166,7 @@ private void sortCategoriesByTier() {
*
* @return The {@link SlimefunAddon} or null if unregistered
*/
@Nullable
public final SlimefunAddon getAddon() {
public final @Nullable SlimefunAddon getAddon() {
return addon;
}

Expand All @@ -176,6 +184,10 @@ public void add(@Nonnull SlimefunItem item) {
return;
}

if (isRegistered() && !item.getAddon().getName().equals(this.addon.getName())) {
item.warn("This item does not belong into ItemGroup " + this + " as that group belongs to " + this.addon.getName());
}

items.add(item);
}

Expand All @@ -199,8 +211,7 @@ public void remove(@Nonnull SlimefunItem item) {
*
* @return A localized display item for this {@link ItemGroup}
*/
@Nonnull
public ItemStack getItem(@Nonnull Player p) {
public @Nonnull ItemStack getItem(@Nonnull Player p) {
return new CustomItemStack(item, meta -> {
String name = Slimefun.getLocalization().getItemGroupName(p, getKey());

Expand All @@ -224,8 +235,7 @@ public ItemStack getItem(@Nonnull Player p) {
*
* @return The unlocalized name of this {@link ItemGroup}
*/
@Nonnull
public String getUnlocalizedName() {
public @Nonnull String getUnlocalizedName() {
return ChatColor.stripColor(item.getItemMeta().getDisplayName());
}

Expand All @@ -238,8 +248,7 @@ public String getUnlocalizedName() {
*
* @return The localized name of this {@link ItemGroup}
*/
@Nonnull
public String getDisplayName(@Nonnull Player p) {
public @Nonnull String getDisplayName(@Nonnull Player p) {
String localized = Slimefun.getLocalization().getItemGroupName(p, getKey());

if (localized != null) {
Expand All @@ -254,8 +263,7 @@ public String getDisplayName(@Nonnull Player p) {
*
* @return the list of SlimefunItems bound to this {@link ItemGroup}
*/
@Nonnull
public List<SlimefunItem> getItems() {
public @Nonnull List<SlimefunItem> getItems() {
return items;
}

Expand All @@ -271,6 +279,52 @@ public boolean contains(@Nullable SlimefunItem item) {
return item != null && items.contains(item);
}

/**
* This method returns whether this {@link ItemGroup} can be accessed
* by the given {@link Player}. If an {@link ItemGroup} is not accessible,
* it will not show up in the {@link SlimefunGuide} nor will items from this
* {@link ItemGroup} show up in the guide search.
*
* @param p
* The {@link Player} to check for
*
* @return Whether this {@link ItemGroup} is accessible by the given {@link Player}
*/
public boolean isAccessible(@Nonnull Player p) {
return true;
}

/**
* This method returns whether this {@link ItemGroup} can be viewed
* by the given {@link Player}. Empty {@link ItemGroup ItemGroups} will not
* be visible. This includes {@link ItemGroup ItemGroups} where every {@link SlimefunItem}
* is disabled. If an {@link ItemGroup} is not accessible by the {@link Player},
* see {@link #isAccessible(Player)}, this method will also return false.
*
* @param p
* The {@link Player} to check for
*
* @return Whether this {@link ItemGroup} is visible to the given {@link Player}
*/
public boolean isVisible(@Nonnull Player p) {
if (items.isEmpty() || !isAccessible(p)) {
return false;
}

for (SlimefunItem slimefunItem : getItems()) {
/*
* If any item for this item group is visible,
* the item group itself is also visible.
* Empty item groups are not displayed.
*/
if (!slimefunItem.isHidden() && !slimefunItem.isDisabledIn(p.getWorld())) {
return true;
}
}

return false;
}

@Override
public final boolean equals(Object obj) {
if (obj instanceof ItemGroup) {
Expand Down Expand Up @@ -301,24 +355,9 @@ public String toString() {
*
* @return Whether this {@link ItemGroup} will be hidden to the given {@link Player}
*/
@Deprecated
public boolean isHidden(@Nonnull Player p) {
for (SlimefunItem slimefunItem : getItems()) {
if (!slimefunItem.isHidden() && !slimefunItem.isDisabledIn(p.getWorld())) {
return false;
}
}

return true;
}

/**
* This method returns whether this {@link ItemGroup} has been registered yet.
* More specifically: Whether {@link #register(SlimefunAddon)} was called or not.
*
* @return Whether this {@link ItemGroup} has been registered
*/
public boolean isRegistered() {
return Slimefun.getRegistry().getAllItemGroups().contains(this);
return !isVisible(p);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ protected FlexItemGroup(NamespacedKey key, ItemStack item, int tier) {
super(key, item, tier);
}

@Override
public final boolean isVisible(@Nonnull Player p) {
/*
* We can stop this method right here.
* We provide a custom method with more parameters for this.
* See isVisible(...)
*/
return true;
}

/**
* This method returns whether this {@link FlexItemGroup} is visible under the given context.
* Implementing this method gives full flexibility over who can see the ItemGroup when and where.
Expand Down Expand Up @@ -66,16 +76,6 @@ protected FlexItemGroup(NamespacedKey key, ItemStack item, int tier) {
*/
public abstract void open(Player p, PlayerProfile profile, SlimefunGuideMode layout);

@Override
public final boolean isHidden(@Nonnull Player p) {
/*
* We can stop this method right here.
* We provide a custom method with more parameters for this.
* See isVisible(...)
*/
return false;
}

@Override
public final void add(@Nonnull SlimefunItem item) {
throw new UnsupportedOperationException("You cannot add items to a FlexItemGroup!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ public SeasonalItemGroup(NamespacedKey key, Month month, int tier, ItemStack ite
}

@Override
public boolean isHidden(@Nonnull Player p) {
// Hide this ItemGroup if the month differs
public boolean isAccessible(@Nonnull Player p) {
// Block this ItemGroup if the month differs
if (month != LocalDate.now().getMonth()) {
return true;
return false;
}

return super.isHidden(p);
return super.isAccessible(p);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,29 @@ public SubItemGroup(NamespacedKey key, NestedItemGroup parent, ItemStack item, i
}

@Override
public final boolean isHidden(@Nonnull Player p) {
public final boolean isVisible(@Nonnull Player p) {
/*
* Sub Categories are always hidden,
* they won't show up in the normal guide view.
*/
return false;
}

@Override
public final boolean isAccessible(@Nonnull Player p) {
/*
* Sub Categories are accessible, they are invisible
* but their items are available to the guide search.
*/
return true;
}

/**
* This method returns the parent {@link NestedItemGroup} which this
* {@link SubItemGroup} belongs to.
*
* @return The parent {@link NestedItemGroup}
*/
public final @Nonnull NestedItemGroup getParent() {
return parentItemGroup;
}
Expand Down
Loading

0 comments on commit 4294d76

Please sign in to comment.