Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Jun 28, 2024
1 parent 3930307 commit eae3303
Show file tree
Hide file tree
Showing 97 changed files with 406 additions and 483 deletions.
47 changes: 0 additions & 47 deletions src/main/java/city/norain/slimefun4/utils/LangUtil.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import city.norain.slimefun4.SlimefunExtended;
import city.norain.slimefun4.timings.SQLProfiler;
import city.norain.slimefun4.utils.LangUtil;
import com.xzavier0722.mc.plugin.slimefun4.chat.PlayerChatCatcher;
import com.xzavier0722.mc.plugin.slimefun4.storage.migrator.BlockStorageMigrator;
import com.xzavier0722.mc.plugin.slimefun4.storage.migrator.PlayerProfileMigrator;
Expand Down Expand Up @@ -237,8 +236,6 @@ private void onPluginStart() {
// Check if Paper (<3) is installed
if (PaperLib.isPaper()) {
logger.log(Level.INFO, "检测到你正在使用 Paper 服务端! 性能优化已应用.");
} else {
LangUtil.suggestPaper(this);
}

// Check if CS-CoreLib is installed (it is no longer needed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public CheatSheetSlimefunGuide() {
*
* @return a {@link List} of visible {@link ItemGroup} instances
*/
@Nonnull
@Override
protected List<ItemGroup> getVisibleItemGroups(@Nonnull Player p, @Nonnull PlayerProfile profile) {
List<ItemGroup> groups = new LinkedList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public void openMainMenu(PlayerProfile profile, int page) {
menu.addMenuClickHandler(46, (pl, slot, item, action) -> {
int next = page - 1;

if (next != page && next > 0) {
if (next > 0) {
openMainMenu(profile, next);
}

Expand All @@ -176,7 +176,7 @@ public void openMainMenu(PlayerProfile profile, int page) {
menu.addMenuClickHandler(52, (pl, slot, item, action) -> {
int next = page + 1;

if (next != page && next <= pages) {
if (next <= pages) {
openMainMenu(profile, next);
}

Expand Down Expand Up @@ -251,7 +251,7 @@ public void openItemGroup(PlayerProfile profile, ItemGroup itemGroup, int page)
menu.addMenuClickHandler(46, (pl, slot, item, action) -> {
int next = page - 1;

if (next != page && next > 0) {
if (next > 0) {
openItemGroup(profile, itemGroup, next);
}

Expand All @@ -262,7 +262,7 @@ public void openItemGroup(PlayerProfile profile, ItemGroup itemGroup, int page)
menu.addMenuClickHandler(52, (pl, slot, item, action) -> {
int next = page + 1;

if (next != page && next <= pages) {
if (next <= pages) {
openItemGroup(profile, itemGroup, next);
}

Expand Down Expand Up @@ -439,15 +439,15 @@ private boolean isItemGroupAccessible(Player p, SlimefunItem slimefunItem) {
@ParametersAreNonnullByDefault
private boolean isSearchFilterApplicable(SlimefunItem slimefunItem, String searchTerm) {
String itemName = ChatColor.stripColor(slimefunItem.getItemName()).toLowerCase(Locale.ROOT);
return !itemName.isEmpty() && (itemName.equals(searchTerm) || itemName.contains(searchTerm));
return !itemName.isEmpty() && itemName.contains(searchTerm);
}

@Override
@ParametersAreNonnullByDefault
public void displayItem(PlayerProfile profile, ItemStack item, int index, boolean addToHistory) {
Player p = profile.getPlayer();

if (p == null || item == null || item.getType() == Material.AIR) {
if (p == null || item.getType() == Material.AIR) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ protected SimpleBlockBreakHandler() {
public abstract void onBlockBreak(@Nonnull Block b);

@Override
public void onPlayerBreak(BlockBreakEvent e, ItemStack item, List<ItemStack> drops) {
public void onPlayerBreak(BlockBreakEvent e, @Nonnull ItemStack item, @Nonnull List<ItemStack> drops) {
onBlockBreak(e.getBlock());
}

Expand All @@ -49,7 +49,7 @@ public void onAndroidBreak(AndroidMineEvent e) {
}

@Override
public void onExplode(Block b, List<ItemStack> drops) {
public void onExplode(@Nonnull Block b, @Nonnull List<ItemStack> drops) {
onBlockBreak(b);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* A quick and easy implementation of {@link SlimefunItem} that also implements the
* interface {@link Radioactive}.
* This implementation is {@link NotPlaceable}!
*
* <p>
* Simply specify a level of {@link Radioactivity} in the constructor.
*
* @author TheBusyBiscuit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* This is basically a quickstart class for your very first {@link SlimefunItem}.
* This class easily allows you to add one {@link ItemHandler} to your {@link SlimefunItem}.
*
* <p>
* You could use an {@link ItemUseHandler} for example to give your {@link SlimefunItem}
* very basic right-click functionalities.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* When a {@link VanillaItem} gets disabled, its {@link ItemState} goes on {@code State.VANILLA} which
* automatically
* replace it in the recipes by its vanilla equivalent.
*
* <p>
* A {@link VanillaItem} is also automatically useable in workbenches.
*
* @author TheBusyBiscuit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

import java.util.ArrayList;
import java.util.List;

import lombok.Getter;
import org.bukkit.inventory.ItemStack;

@Getter
public class AltarRecipe {

private final ItemStack catalyst;
Expand All @@ -27,18 +30,6 @@ public AltarRecipe(List<ItemStack> input, ItemStack output) {
this.output = output;
}

public ItemStack getCatalyst() {
return this.catalyst;
}

public ItemStack getOutput() {
return this.output;
}

public List<ItemStack> getInput() {
return this.input;
}

@Override
public boolean equals(Object obj) {
if (obj instanceof AltarRecipe ar) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package io.github.thebusybiscuit.slimefun4.implementation.items.androids;

import lombok.Getter;
import org.bukkit.block.Block;

public class AndroidInstance {

@Getter
private final ProgrammableAndroid android;
private final Block b;

Expand All @@ -12,10 +14,6 @@ public AndroidInstance(ProgrammableAndroid android, Block b) {
this.b = b;
}

public ProgrammableAndroid getAndroid() {
return android;
}

public Block getBlock() {
return b;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import io.github.thebusybiscuit.slimefun4.core.handlers.BlockDispenseHandler;
import io.github.thebusybiscuit.slimefun4.implementation.handlers.VanillaInventoryDropHandler;
import io.github.thebusybiscuit.slimefun4.implementation.items.SimpleSlimefunItem;

import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
import org.bukkit.block.Dispenser;
import org.bukkit.inventory.ItemStack;
Expand All @@ -28,6 +30,7 @@ public AndroidInterface(ItemGroup itemGroup, SlimefunItemStack item, RecipeType
addItemHandler(new VanillaInventoryDropHandler<>(Dispenser.class));
}

@Nonnull
@Override
public BlockDispenseHandler getItemHandler() {
return (e, d, block, machine) -> e.setCancelled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ public enum AndroidType {
*/
FARMER,

/**
* The {@link AdvancedFarmerAndroid} is an extension of the {@link FarmerAndroid},
* it can also harvest plants from ExoticGarden.
*/
ADVANCED_FARMER,

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void replant(@Nonnull Block block) {
}
}

if (saplingType != null && soilRequirement != null) {
if (saplingType != null) {
if (soilRequirement.test(block.getRelative(BlockFace.DOWN).getType())) {
// Replant the block
block.setType(saplingType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private static void removePlayer(Player owner, OfflinePlayer p, Block android, L
Optional<String> trustUsers = getSharedUserData(b.getState());

// Checks for old Android
if (!trustUsers.isPresent()) {
if (trustUsers.isEmpty()) {
List<String> emptyUsers = new ArrayList<>();
setSharedUserData(b.getState(), String.valueOf(emptyUsers));
return emptyUsers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@
*/
public abstract class AbstractAutoCrafter extends SlimefunItem implements EnergyNetComponent {

private final String WIKI_PAGE = "Auto-Crafter";

private final Map<Block, ItemStack> recipeCache;

/**
Expand Down Expand Up @@ -142,6 +140,7 @@ public void onPlayerBreak(BlockBreakEvent e, ItemStack item, List<ItemStack> dro

@Override
public void postRegister() {
String WIKI_PAGE = "Auto-Crafter";
addWikiPage(WIKI_PAGE);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;

import lombok.Getter;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import org.apache.commons.lang.Validate;
import org.bukkit.inventory.ItemStack;
Expand Down Expand Up @@ -43,7 +45,14 @@ public abstract class AbstractRecipe {

/**
* Whether this recipe is enabled.
* -- GETTER --
* This returns whether or not this recipe has been enabled.
* A disabled recipe will not be crafted.
*
* @return Whether this recipe is enabled
*/
@Getter
private boolean enabled = true;

/**
Expand Down Expand Up @@ -85,16 +94,6 @@ public ItemStack getResult() {
return result;
}

/**
* This returns whether or not this recipe has been enabled.
* A disabled recipe will not be crafted.
*
* @return Whether this recipe is enabled
*/
public boolean isEnabled() {
return enabled;
}

/**
* This method enables or disables this recipe.
* A disabled recipe will not be crafted.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ protected void updateRecipe(@Nonnull Block b, @Nonnull Player p) {
menu.open(p);

SoundEffect.AUTO_CRAFTER_UPDATE_RECIPE.playAt(b);
;

if (!task.isEmpty()) {
task.start(menu.toInventory());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import java.util.List;
import java.util.function.Predicate;
import javax.annotation.Nonnull;

import lombok.Getter;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu;
import org.apache.commons.lang.Validate;
import org.bukkit.Keyed;
Expand All @@ -30,6 +32,7 @@
class VanillaRecipe extends AbstractRecipe {

private final int[] slots = {11, 12, 13, 20, 21, 22, 29, 30, 31};
@Getter
private final Recipe recipe;

VanillaRecipe(@Nonnull ShapelessRecipe recipe) {
Expand All @@ -44,10 +47,6 @@ class VanillaRecipe extends AbstractRecipe {
this.recipe = recipe;
}

public Recipe getRecipe() {
return recipe;
}

@Nonnull
private static Collection<Predicate<ItemStack>> getChoices(@Nonnull ShapedRecipe recipe) {
List<Predicate<ItemStack>> choices = new ArrayList<>();
Expand All @@ -65,11 +64,6 @@ private static Collection<Predicate<ItemStack>> getChoices(@Nonnull ShapedRecipe
return choices;
}

@Nonnull
private static RecipeChoice[] getShape(@Nonnull Recipe recipe) {
return Slimefun.getMinecraftRecipeService().getRecipeShape(recipe);
}

@Override
public void show(@Nonnull ChestMenu menu, @Nonnull AsyncRecipeChoiceTask task) {
Validate.notNull(menu, "The ChestMenu cannot be null!");
Expand Down
Loading

0 comments on commit eae3303

Please sign in to comment.