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 Mar 10, 2022
2 parents e6ee06f + 6d1a500 commit 8c9eaf4
Show file tree
Hide file tree
Showing 41 changed files with 1,169 additions and 454 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- 在提交代码前, 你必须阅读 [提交规范](https://github.com/StarWishsama/Slimefun4/blob/master/CONTRIBUTING.md) -->

## 简介
<!-- 大致解释一下这个提交更改变动了什么. -->

Expand Down
2 changes: 1 addition & 1 deletion .mvn/maven-git-versioning-extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<version>4.9-release-${commit.timestamp.year}.${commit.timestamp.month}</version>
</ref>
<ref type ="branch">
<pattern>feature/(.+)</pattern>
<pattern>test/(.+)</pattern>
<version>4.9-${1}-${commit.short}</version>
</ref>
<ref type = "tag">
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@
* Added Spore Blossom as a fuel type for the Bio-Generator
* Added a new item setting for Freezers to allow them to use a 9:1 "vanilla" ratio instead of 1:1 (1:1 by default, like before)
* (API) Added `PlayerProfile#hasUnlockedEverything()` to check if a player has unlocked all researches
* (API) Added `Research#getUnlocalizedName()`
* Added support for the plugin "HuskTowns"
* Added support for Minecraft 1.18.2
* 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

#### Changes
* (API) `BiomeMapParser` is now `public`
Expand All @@ -61,6 +66,7 @@
* Fixed "LogBlock" integration
* Fixed "Lands" integration
* Fixed #3133
* Fixed #3483

## Release Candidate 30 (31 Dec 2021)
https://thebusybiscuit.github.io/builds/TheBusyBiscuit/Slimefun4/stable/#30
Expand Down
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 贡献代码指南

在向 Slimefun 汉化版提交代码前, 你必须先阅读这个指南

# 提交信息规范

本项目强制使用 [约定式提交](https://www.conventionalcommits.org/zh-hans/v1.0.0/) 的提交信息规范

> 简单来说, 你的提交信息需要包含以下内容:
>
> <类型>[可选 范围]: <描述>
>
> 例如一个添加了新功能的提交应为 feat(item): add new item to Slimefun
此外, 推荐你使用 [gitmoji](https://gitmoji.dev/) 规范, 但并不强制你使用.

如果你提交的代码中解决或处理了 Issue 中的问题, 请你在主提交消息外显式声明

> 如 resolves #114514, fix #114514
如果是修复请在主提交消息上声明, 不必重复声明.

另外的, 如果是与翻译相关的提交, 类型应为 trans



# 代码规范

**本项目使用空格缩进!!!!!!!!!!**

请不要过度缩减代码长度, 空格少了 Slimefun 也不会因此跑得更快.

如果你希望你的代码被合并至官方, 请遵守 Slimefun 主仓库的 [提交规范](https://github.com/Slimefun/Slimefun4/blob/master/CONTRIBUTING.md)
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ Slimefun 让每个玩家可以自己决定在魔法或科技方面发展<br>
该项目从2013年开始开发,此后一直发展.<br>
从那时一个人开发插件到发展成一个拥有数千名参与者和一百多位贡献者的社区.<br>
它目前添加了超过 **500 种新物品/合成配方**
([查看关于 Slimefun 的历史](https://slimefun.guizhanss.wiki/Slimefun-in-a-nutshell)).
([查看关于 Slimefun 的历史](https://slimefun-wiki.guizhanss.cn/Slimefun-in-a-nutshell)).

与此同时, Slimefun 还有种类繁多的扩展插件可供选择!<br>
打开 [扩展列表](https://slimefun.guizhanss.wiki/Addons), 你可能会找到你想要的扩展.
打开 [扩展列表](https://slimefun-wiki.guizhanss.cn/Addons), 你可能会找到你想要的扩展.

### 导航
* **[下载 Slimefun 4](#%e4%b8%8b%e8%bd%bd-Slimefun4)**
* **[Discord 服务器](#discord)**
* **[Bug 反馈](https://github.com/StarWishsama/Slimefun4/issues)**
* **[官方Wiki](https://github.com/Slimefun/Slimefun4/wiki)**
* **[非官方中文 Wiki](https://slimefun.guizhanss.wiki/)**
* **[FAQ](https://slimefun.guizhanss.wiki/FAQ)**
* **[非官方中文 Wiki](https://slimefun-wiki.guizhanss.cn/)**
* **[FAQ](https://slimefun-wiki.guizhanss.cn/FAQ)**

## :floppy_disk: 下载 Slimefun4
(可以查看: [如何安装 Slimefun](https://slimefun.guizhanss.wiki/Installing-Slimefun))
(可以查看: [如何安装 Slimefun](https://slimefun-wiki.guizhanss.cn/Installing-Slimefun))

Slimefun 4 可以在 Releases 页面下 **免费下载**.<br>
目前汉化版仅提供了官方开发版的选项, 但某些发布的版本会被标记为官方的 "稳定" 版.<br>
Expand Down Expand Up @@ -96,18 +96,18 @@ Slimefun 4 可以在 Releases 页面下 **免费下载**.<br>
Slimefun 有一个 (详细且经常维护的 - *咳咳*) Wiki 为新玩家准备,
你也可以考虑为 Wiki 的编写献出一份力量.
官方 Wiki: https://github.com/Slimefun/Slimefun4/wiki
非官方中文 Wiki: https://slimefun.guizhanss.wiki/
非官方中文 Wiki: https://slimefun-wiki.guizhanss.cn/

#### :star: 有用的文章 (中文)
* [什么是 Slimefun?](https://slimefun.guizhanss.wiki/Slimefun-in-a-nutshell)
* [如何安装 Slimefun](https://slimefun.guizhanss.wiki/Installing-Slimefun)
* [Slimefun 4 扩展列表](https://slimefun.guizhanss.wiki/Addons)
* [Slimefun 4 扩展编写教程](https://slimefun.guizhanss.wiki/Developer-Guide)
* [开始使用](https://slimefun.guizhanss.wiki/Getting-Started)
* [常见问题](https://slimefun.guizhanss.wiki/FAQ)
* [使用中的常见问题](https://slimefun.guizhanss.wiki/Common-Issues)
* [帮助我们扩展 Wiki!](https://slimefun.guizhanss.wiki/Expanding-the-Wiki)
* [帮助我们翻译 Slimefun!](https://slimefun.guizhanss.wiki/Translating-Slimefun)
* [什么是 Slimefun?](https://slimefun-wiki.guizhanss.cn/Slimefun-in-a-nutshell)
* [如何安装 Slimefun](https://slimefun-wiki.guizhanss.cn/Installing-Slimefun)
* [Slimefun 4 扩展列表](https://slimefun-wiki.guizhanss.cn/Addons)
* [Slimefun 4 扩展编写教程](https://slimefun-wiki.guizhanss.cn/Developer-Guide)
* [开始使用](https://slimefun-wiki.guizhanss.cn/Getting-Started)
* [常见问题](https://slimefun-wiki.guizhanss.cn/FAQ)
* [使用中的常见问题](https://slimefun-wiki.guizhanss.cn/Common-Issues)
* [帮助我们扩展 Wiki!](https://slimefun-wiki.guizhanss.cn/Expanding-the-Wiki)
* [帮助我们翻译 Slimefun!](https://slimefun-wiki.guizhanss.cn/Translating-Slimefun)

这个 Wiki 由 @ybw0014 进行维护, 如果你发现有文章缺失, 可以咨询他补充.

Expand Down
11 changes: 5 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<!-- Compiler plugin -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.9.0</version>
<version>3.10.0</version>

<configuration>
<excludes>
Expand Down Expand Up @@ -233,7 +233,7 @@
<dependency>
<groupId>io.github.baked-libs</groupId>
<artifactId>dough-api</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -267,13 +267,13 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>4.3.1</version>
<version>4.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.seeseemelk</groupId>
<artifactId>MockBukkit-v1.18</artifactId>
<version>1.15.5</version>
<version>1.18.1</version>
<scope>test</scope>

<exclusions>
Expand All @@ -286,7 +286,6 @@
</exclusions>
</dependency>


<!-- Third party plugin integrations / soft dependencies -->
<dependency>
<groupId>com.sk89q.worldedit</groupId>
Expand Down Expand Up @@ -361,7 +360,7 @@
<dependency>
<groupId>com.github.LoneDev6</groupId>
<artifactId>itemsadder-api</artifactId>
<version>2.5.5</version>
<version>3.0.0</version>
<scope>provided</scope>

<exclusions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ protected SlimefunItem(ItemGroup itemGroup, ItemStack item, String id, RecipeTyp
return itemGroup;
}

/**
* Retrieve the recipe for this {@link SlimefunItem}.
*
* @return An {@link ItemStack} array of 9 which represents the recipe for this {@link SlimefunItem}
*/
public @Nonnull ItemStack[] getRecipe() {
return recipe;
}
Expand Down Expand Up @@ -655,14 +660,24 @@ public void setResearch(@Nullable Research research) {
this.research = research;
}

public void setRecipe(ItemStack[] recipe) {
/**
* Sets the recipe for this {@link SlimefunItem}.
*
* @param recipe The recipe for this {@link ItemStack}
*/
public void setRecipe(@Nonnull ItemStack[] recipe) {
if (recipe == null || recipe.length != 9) {
throw new IllegalArgumentException("Recipes must be of length 9");
}

this.recipe = recipe;
}

/**
* Sets the {@link RecipeType} for this {@link SlimefunItem}.
*
* @param type The {@link RecipeType} for this {@link SlimefunItem}
*/
public void setRecipeType(@Nonnull RecipeType type) {
Validate.notNull(type, "The RecipeType is not allowed to be null!");
this.recipeType = type;
Expand Down Expand Up @@ -862,7 +877,7 @@ public final void addOfficialWikipage(@Nonnull String page) {
Validate.notNull(page, "Wiki page cannot be null.");
// 转换链接
page = page.replace("#", "?id=");
wikiURL = Optional.of("https://slimefun.guizhanss.wiki/" + page);
wikiURL = Optional.of("https://slimefun-wiki.guizhanss.cn/" + page);
}

/**
Expand Down Expand Up @@ -1119,10 +1134,22 @@ public final int hashCode() {
return getId().hashCode();
}

/**
* Retrieve a {@link SlimefunItem} by its id.
*
* @param id The id of the {@link SlimefunItem}
* @return The {@link SlimefunItem} associated with that id. Null if non-existent
*/
public static @Nullable SlimefunItem getById(@Nonnull String id) {
return Slimefun.getRegistry().getSlimefunItemIds().get(id);
}

/**
* Retrieve a {@link SlimefunItem} from an {@link ItemStack}.
*
* @param item The {@link ItemStack} to check
* @return The {@link SlimefunItem} associated with this {@link ItemStack} if present, otherwise null
*/
public static @Nullable SlimefunItem getByItem(@Nullable ItemStack item) {
if (item == null || item.getType() == Material.AIR) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.apache.commons.lang.Validate;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Keyed;
import org.bukkit.NamespacedKey;
Expand Down Expand Up @@ -120,6 +121,15 @@ public int getID() {
return localized != null ? localized : name;
}

/**
* Retrieve the name of this {@link Research} without any localization nor coloring.
*
* @return The unlocalized, decolorized name for this {@link Research}
*/
public @Nonnull String getUnlocalizedName() {
return ChatColor.stripColor(name);
}

/**
* Gets the cost in XP levels to unlock this {@link Research}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public void load(@Nonnull Slimefun plugin, @Nonnull Config cfg) {
guideKey = new NamespacedKey(plugin, "slimefun_guide_mode");

boolean showVanillaRecipes = cfg.getBoolean("guide.show-vanilla-recipes");
guides.put(SlimefunGuideMode.SURVIVAL_MODE, new SurvivalSlimefunGuide(showVanillaRecipes));
boolean showHiddenItemGroupsInSearch = cfg.getBoolean("guide.show-hidden-item-groups-in-search");
guides.put(SlimefunGuideMode.SURVIVAL_MODE, new SurvivalSlimefunGuide(showVanillaRecipes, showHiddenItemGroupsInSearch));
guides.put(SlimefunGuideMode.CHEAT_MODE, new CheatSheetSlimefunGuide());

researchRanks.addAll(cfg.getStringList("research-ranks"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private void openLanguageSelection(Player p, ItemStack guide) {
});
} else if (i == 7) {
menu.addItem(7, new CustomItemStack(SlimefunUtils.getCustomHead(HeadTexture.ADD_NEW_LANGUAGE.getTexture()), Slimefun.getLocalization().getMessage(p, "guide.languages.translations.name"), "", "&7\u21E8 &e" + Slimefun.getLocalization().getMessage(p, "guide.languages.translations.lore")), (pl, slot, item, action) -> {
ChatUtils.sendURL(pl, "https://slimefun.guizhanss.wiki/Translating-Slimefun");
ChatUtils.sendURL(pl, "https://slimefun-wiki.guizhanss.cn/Translating-Slimefun");
pl.closeInventory();
return false;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {

menu.addMenuClickHandler(8, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://slimefun.guizhanss.wiki/");
ChatUtils.sendURL(pl, "https://slimefun-wiki.guizhanss.cn/");
return false;
});

Expand All @@ -181,7 +181,7 @@ private static void addHeader(Player p, ChestMenu menu, ItemStack guide) {

menu.addMenuClickHandler(47, (pl, slot, item, action) -> {
pl.closeInventory();
ChatUtils.sendURL(pl, "https://slimefun.guizhanss.wiki/Addons");
ChatUtils.sendURL(pl, "https://slimefun-wiki.guizhanss.cn/Addons");
return false;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ public Language(@Nonnull String id, @Nonnull String hash) {
*
* @return The identifier of this {@link Language}
*/
@Nonnull
public String getId() {
public @Nonnull String getId() {
return id;
}

Expand Down Expand Up @@ -101,8 +100,7 @@ public void setFile(@Nonnull LanguageFile file, @Nonnull FileConfiguration confi
*
* @return The {@link ItemStack} used to display this {@link Language}
*/
@Nonnull
public ItemStack getItem() {
public @Nonnull ItemStack getItem() {
return item;
}

Expand All @@ -114,8 +112,7 @@ public ItemStack getItem() {
* The {@link Player} to localize the name for
* @return The localized name of this {@link Language}
*/
@Nonnull
public String getName(@Nonnull Player p) {
public @Nonnull String getName(@Nonnull Player p) {
return Slimefun.getLocalization().getMessage(p, "languages." + id);
}

Expand All @@ -136,7 +133,11 @@ public String toString() {

@Nonnull
FileConfiguration[] getFiles() {
return Arrays.stream(LanguageFile.valuesCached).map(this::getFile).toArray(FileConfiguration[]::new);
// @formatter:off
return Arrays.stream(LanguageFile.valuesCached)
.map(this::getFile)
.toArray(FileConfiguration[]::new);
// @formatter:on
}

}
Loading

0 comments on commit 8c9eaf4

Please sign in to comment.