Skip to content

Commit

Permalink
Merge Upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Feb 4, 2020
1 parent 508ba64 commit cbc647d
Show file tree
Hide file tree
Showing 60 changed files with 1,803 additions and 746 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.mrCookieSlime</groupId>
<artifactId>Slimefun</artifactId>
<version>4.2-UNOFFCIAL-20200203</version>
<version>4.2-UNOFFCIAL-20200204</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.github.thebusybiscuit.slimefun4.api;

public enum SlimefunBranch {

DEVELOPMENT("master"),
STABLE("stable"),
UNOFFICIAL("Unknown"),
UNKNOWN("Unknown");

private final String name;

private SlimefunBranch(String name) {
this.name = name;
}

public String getName() {
return name;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public void run(Player p) {
}
}

texts.add(ChatColors.color("&8\u21E8 &6Tier " + tier));
texts.add(ChatColors.color("&8\u21E8 &6等级 " + tier));
tooltips.add(null);
actions.add(null);
}
if (category instanceof LockedCategory && !((LockedCategory) category).hasUnlocked(p, profile)) {
StringBuilder parents = new StringBuilder(ChatColors.color("&4&lLOCKED\n\n&7In order to unlock this Category,\n&7you need to unlock all Items from\n&7the following Categories first:\n"));
StringBuilder parents = new StringBuilder(ChatColors.color("&4&l已锁定\n\n&7为了解锁此类别,\n&7你需要先解锁以下类别中的所有物品:\n"));

for (Category parent : ((LockedCategory) category).getParents()) {
parents.append(ChatColors.color("\n&c" + ItemUtils.getItemName(parent.getItem(p))));
Expand All @@ -109,7 +109,7 @@ public void run(Player p) {
else if (category instanceof SeasonalCategory) {
if (((SeasonalCategory) category).isUnlocked()) {
texts.add(ChatColors.color(shorten("&a", ItemUtils.getItemName(category.getItem(p)))));
tooltips.add(ChatColors.color("&eClick to open the following Category:\n" + ItemUtils.getItemName(category.getItem(p))));
tooltips.add(ChatColors.color("&e单击打开以下类别:\n" + ItemUtils.getItemName(category.getItem(p))));
actions.add(new PlayerRunnable(1) {

@Override
Expand All @@ -122,7 +122,7 @@ public void run(final Player p) {
}
else {
texts.add(ChatColors.color(shorten("&a", ItemUtils.getItemName(category.getItem(p)))));
tooltips.add(ChatColors.color("&eClick to open the following Category:\n" + ItemUtils.getItemName(category.getItem(p))));
tooltips.add(ChatColors.color("&e单击打开以下类别:\n" + ItemUtils.getItemName(category.getItem(p))));
actions.add(new PlayerRunnable(1) {

@Override
Expand Down Expand Up @@ -151,7 +151,7 @@ public void run(Player p) {

for (int i = 0; i < texts.size(); i = i + 10) {
TellRawMessage pageMessage = new TellRawMessage();
pageMessage.addText(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
pageMessage.addText(ChatColors.color("&b&l- Slimefun 指南 -\n\n"));

for (int j = i; j < texts.size() && j < i + 10; j++) {
pageMessage.addText(texts.get(j) + "\n");
Expand All @@ -163,7 +163,7 @@ public void run(Player p) {
pages.add(pageMessage);
}

new CustomBookOverlay("Slimefun Guide", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
new CustomBookOverlay("Slimefun 指南", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
}

@Override
Expand All @@ -189,7 +189,7 @@ public void openCategory(PlayerProfile profile, Category category, boolean survi
Research research = item.getResearch();

texts.add(ChatColors.color(shorten("&7", item.getItemName())));
tooltips.add(ChatColors.color(item.getItemName() + "\n&c&lLOCKED\n\n&7Cost: " + (p.getLevel() >= research.getCost() ? "&b": "&4") + research.getCost() + " Levels\n\n&a> Click to unlock"));
tooltips.add(ChatColors.color(item.getItemName() + "\n&c&l已锁定\n\n&7消耗等级 " + (p.getLevel() >= research.getCost() ? "&b": "&4") + research.getCost() + " \n\n&a> 单击解锁"));
actions.add(new PlayerRunnable(2) {

@Override
Expand Down Expand Up @@ -231,7 +231,7 @@ public void run(final Player p) {
}
}

tooltip.append(ChatColors.color("\n\n&e&oClick for more Info"));
tooltip.append(ChatColors.color("\n\n&e&o单击查看更多信息"));

tooltips.add(tooltip.toString());
actions.add(new PlayerRunnable(2) {
Expand All @@ -254,7 +254,7 @@ public void run(Player p) {

for (int i = 0; i < texts.size(); i = i + 10) {
TellRawMessage pageMessage = new TellRawMessage();
pageMessage.addText(ChatColors.color("&b&l- Slimefun Guide -\n\n"));
pageMessage.addText(ChatColors.color("&b&l- Slimefun 指南 -\n\n"));

for (int j = i; j < texts.size() && j < i + 10; j++) {
pageMessage.addText(texts.get(j) + "\n");
Expand All @@ -264,7 +264,7 @@ public void run(Player p) {

pageMessage.addText("\n");
pageMessage.addText(ChatColors.color("&6\u21E6 &lBack"));
pageMessage.addHoverEvent(HoverAction.SHOW_TEXT, ChatColors.color("&eClick to go back to the Category Overview"));
pageMessage.addHoverEvent(HoverAction.SHOW_TEXT, ChatColors.color("&e单击返回类别列表"));
pageMessage.addClickEvent(new PlayerRunnable(2) {

@Override
Expand All @@ -276,10 +276,10 @@ public void run(final Player p) {
pages.add(pageMessage);
}

new CustomBookOverlay("Slimefun Guide", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
new CustomBookOverlay("Slimefun 指南", "TheBusyBiscuit", pages.toArray(new TellRawMessage[0])).open(p);
}
else {
p.sendMessage(ChatColor.RED + "That Category is too big to open :/");
p.sendMessage(ChatColor.RED + "这个类别太大了打不开 :/");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ else if (!survival || ((LockedCategory) category).hasUnlocked(p, profile)) {
parents.add(parent.getItem(p).getItemMeta().getDisplayName());
}

menu.addItem(index, new CustomItem(Material.BARRIER, "&4LOCKED &7- &r" + category.getItem(p).getItemMeta().getDisplayName(), parents.toArray(new String[0])));
menu.addItem(index, new CustomItem(Material.BARRIER, "&4已锁定 &7- &r" + category.getItem(p).getItemMeta().getDisplayName(), parents.toArray(new String[0])));
menu.addMenuClickHandler(index, ChestMenuUtils.getEmptyClickHandler());
index++;
}
Expand Down Expand Up @@ -182,7 +182,7 @@ public void openCategory(PlayerProfile profile, Category category, boolean survi
ChestMenu menu = create(p);
fillInv(p, profile, menu, survival);

menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(), meta -> meta.setLore(Arrays.asList("", ChatColors.color("&rLeft Click: &7Go back to Main Menu")))));
menu.addItem(1, new CustomItem(ChestMenuUtils.getBackButton(), meta -> meta.setLore(Arrays.asList("", ChatColors.color("&r左键: &7返回主菜单")))));
menu.addMenuClickHandler(1, (pl, s, is, action) -> {
openMainMenu(profile, survival, 1);
return false;
Expand Down Expand Up @@ -218,7 +218,7 @@ public void openCategory(PlayerProfile profile, Category category, boolean survi

if (survival && research != null && !profile.hasUnlocked(research)) {
if (Slimefun.hasPermission(p, sfitem, false)) {
menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&lLOCKED", "", "&a> Click to unlock", "", "&7Cost: &b" + research.getCost() + " Level"));
menu.addItem(index, new CustomItem(Material.BARRIER, "&r" + ItemUtils.getItemName(sfitem.getItem()), "&4&l已锁定", "", "&a> Click to unlock", "", "&7消耗经验 &b" + research.getCost() + " "));
menu.addMenuClickHandler(index, (pl, slot, item, action) -> {
if (!Research.isResearching(pl)) {
if (research.canUnlock(pl)) {
Expand Down Expand Up @@ -400,10 +400,10 @@ private void showMinecraftRecipe(Recipe[] recipes, int index, ItemStack item, Pl
}

if (mcRecipe == MinecraftRecipe.SHAPED_CRAFTING) {
recipeType = new RecipeType(new CustomItem(mcRecipe.getMachine(), null, "&7Shaped Recipe"));
recipeType = new RecipeType(new CustomItem(mcRecipe.getMachine(), null, "&7有序合成表"));
}
else if (mcRecipe == MinecraftRecipe.SHAPELESS_CRAFTING) {
recipeType = new RecipeType(new CustomItem(mcRecipe.getMachine(), null, "&7Shapeless Recipe"));
recipeType = new RecipeType(new CustomItem(mcRecipe.getMachine(), null, "&7无序合成表"));
}
else {
recipeType = new RecipeType(mcRecipe);
Expand All @@ -412,7 +412,7 @@ else if (mcRecipe == MinecraftRecipe.SHAPELESS_CRAFTING) {
result = recipe.getResult();
}
else {
recipeItems = new ItemStack[] {null, null, null, null, new CustomItem(Material.BARRIER, "&4We are somehow unable to show you this Recipe :/"), null, null, null, null};
recipeItems = new ItemStack[] {null, null, null, null, new CustomItem(Material.BARRIER, "&4我们不知道为什么不能展示合成表了 :/"), null, null, null, null};
}

ChestMenu menu = create(p);
Expand Down Expand Up @@ -536,8 +536,8 @@ private void addBackButton(ChestMenu menu, int slot, PlayerProfile profile, bool

menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(), meta -> meta.setLore(Arrays.asList(
"",
ChatColors.color("&rLeft Click: &7Go back to previous Page"),
ChatColors.color("&rShift + left Click: &7Go back to Main Menu")
ChatColors.color("&r左键: &7返回上一页"),
ChatColors.color("&rShift + 左键: &7返回主菜单")
))));

menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
Expand All @@ -553,7 +553,7 @@ private void addBackButton(ChestMenu menu, int slot, PlayerProfile profile, bool

}
else {
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(), meta -> meta.setLore(Arrays.asList("", ChatColors.color("&rLeft Click: &7Go back to Main Menu")))));
menu.addItem(slot, new CustomItem(ChestMenuUtils.getBackButton(), meta -> meta.setLore(Arrays.asList("", ChatColors.color("&r左键: &7返回主菜单")))));
menu.addMenuClickHandler(slot, (pl, s, is, action) -> {
openMainMenu(profile, survival, 1);
return false;
Expand All @@ -566,8 +566,8 @@ private static ItemStack getDisplayItem(Player p, boolean isSlimefunRecipe, Item
SlimefunItem slimefunItem = SlimefunItem.getByItem(item);
if (slimefunItem == null) return item;

String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&rNeeds to be unlocked elsewhere" : "&rNo Permission";
return Slimefun.hasUnlocked(p, slimefunItem, false) ? item: new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&lLOCKED", "", lore);
String lore = Slimefun.hasPermission(p, slimefunItem, false) ? "&r需要在别处解锁" : "&r你没有权限";
return Slimefun.hasUnlocked(p, slimefunItem, false) ? item: new CustomItem(Material.BARRIER, ItemUtils.getItemName(item), "&4&l已锁定", "", lore);
}
else {
return item;
Expand Down
Loading

0 comments on commit cbc647d

Please sign in to comment.