Skip to content

Commit

Permalink
chore: 综合性能优化
Browse files Browse the repository at this point in the history
  • Loading branch information
mcchampions committed Jan 11, 2025
1 parent 3004fee commit 23c7998
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static boolean isSameWorld(World w1, World w2) {

/**
* 将位置转换为易读的文本
*
* <p>
* 注意: 请不要将其用于数据库转换过程中!
*
* @param location 位置
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class TalismanActivateEvent extends PlayerEvent implements Cancellable {
*
*/
@Setter
@Getter
private boolean preventConsumption;
private boolean cancelled;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;

import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
Expand Down Expand Up @@ -32,6 +34,7 @@ class Hologram {
/**
* The label of this {@link Hologram}.
*/
@Getter
private String label;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public final class Slimefun extends JavaPlugin implements SlimefunAddon, ICompat
* Our static instance of {@link Slimefun}.
* Make sure to clean this up in {@link #onDisable()}!
*/
@SuppressWarnings("FieldHasSetterButNoGetter")
private static Slimefun instance;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public ItemStack getItemForEntityType(EntityType type) {
for (int i = 0; i < lore.size(); i++) {
String currentLine = lore.get(i);
if (currentLine.contains("<Type>") || currentLine.contains("<类型>")) {
String typeName = type == null ? "空" : ChatUtils.humanize(type.name());
String typeName = ChatUtils.humanize(type.name());
lore.set(i, currentLine.replace("<Type>", typeName).replace("<类型>", typeName));
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,21 @@ public int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow) {
};
}

private final BlockPlaceHandler HANDLER = new BlockPlaceHandler(false) {
@Override
public void onPlayerPlace(BlockPlaceEvent e) {
// The owner and frequency are required by every node
SlimefunBlockData blockData = StorageCacheUtils.getBlock(e.getBlock().getLocation());
blockData.setData("owner", e.getPlayer().getUniqueId().toString());
blockData.setData(FREQUENCY, "0");

onPlace(e);
}
};

@Override
public BlockPlaceHandler getItemHandler() {
return new BlockPlaceHandler(false) {
@Override
public void onPlayerPlace(BlockPlaceEvent e) {
// The owner and frequency are required by every node
SlimefunBlockData blockData = StorageCacheUtils.getBlock(e.getBlock().getLocation());
blockData.setData("owner", e.getPlayer().getUniqueId().toString());
blockData.setData(FREQUENCY, "0");

onPlace(e);
}
};
return HANDLER;
}

protected void addChannelSelector(Block b, BlockMenu menu, int slotPrev, int slotCurrent, int slotNext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.List;
import java.util.OptionalInt;

import lombok.Getter;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
Expand Down Expand Up @@ -68,6 +69,7 @@ public class GEOMiner extends SlimefunItem

private int energyConsumedPerTick = -1;
private int energyCapacity = -1;
@Getter
private int processingSpeed = -1;

public GEOMiner(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class TickerTask extends BaseTickerTask {
private boolean running;

@Setter
@Getter
private volatile boolean paused;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ private static boolean equalsItemMeta(ItemMeta itemMeta, ItemMeta sfitemMeta, bo
if (itemMeta instanceof PotionMeta potionMeta && sfitemMeta instanceof PotionMeta sfPotionMeta) {
if (Slimefun.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_20_5)) {
//noinspection ConstantValue
if (potionMeta.getBasePotionType() == null && sfPotionMeta.getBasePotionType() == null) {
if (potionMeta.getBasePotionType() == null) {
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Map;

import lombok.Getter;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu.AdvancedMenuClickHandler;
import me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ClickAction;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.interfaces.InventoryBlock;
Expand All @@ -52,6 +53,7 @@ public abstract class AContainer extends SlimefunItem

private int energyConsumedPerTick = -1;
private int energyCapacity = -1;
@Getter
private int processingSpeed = -1;

protected AContainer(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public class CargoTickerTask extends BaseTickerTask {
private boolean running;

@Setter
@Getter
private volatile boolean paused;

public void start(Slimefun plugin) {
Expand Down

0 comments on commit 23c7998

Please sign in to comment.