Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于若干issue的修复 #989

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
3141a30
chore(deps): use dough from jitpack
ybw0014 Oct 19, 2023
7affe4c
chore: Merge branch 'dev'
StarWishsama Oct 20, 2023
54c1294
chore: Merge branch 'dev'
StarWishsama Oct 20, 2023
ffd3ced
chore: fixed git hook
StarWishsama Dec 4, 2023
d813882
fix: missing tab completer
StarWishsama Oct 21, 2023
40b4cac
chore: cleanup
StarWishsama Oct 21, 2023
c01a969
fix(android): ensure android status before execute instruction
StarWishsama Oct 26, 2023
e35c108
chore(deps): introduced lombok
StarWishsama Oct 26, 2023
84fdef6
fix(deps): missing annotation processor
StarWishsama Oct 26, 2023
f29813d
fix(research): convert rate not being updated
StarWishsama Oct 28, 2023
2727655
chore: fix pre-commit hook
StarWishsama Oct 28, 2023
296ac2b
chore: spotless stuff
StarWishsama Oct 28, 2023
6eeae92
🔧 Bump me.clip:placeholderapi from 2.11.3 to 2.11.4 (#35)
dependabot[bot] Oct 29, 2023
8cf003d
🔧 Bump com.rudikershaw.gitbuildhook:git-build-hook-maven-plugin (#37)
dependabot[bot] Oct 29, 2023
1a2c98b
🔧 Bump com.gmail.nossr50.mcMMO:mcMMO from 2.1.223 to 2.1.225 (#38)
dependabot[bot] Oct 29, 2023
c1cc2ca
🔧 Bump com.sk89q.worldedit:worldedit-core from 7.2.15 to 7.2.17 (#36)
dependabot[bot] Oct 29, 2023
292d0a5
fix(tool): closes #809
StarWishsama Oct 30, 2023
c326314
chore: fixing pre-commit
StarWishsama Oct 30, 2023
651c832
fix(tool): duplicated code
StarWishsama Oct 30, 2023
42bc3f8
🔧 Bump com.zaxxer:HikariCP from 5.0.1 to 5.1.0 (#40)
dependabot[bot] Nov 7, 2023
8f7b5e2
🔧 Bump me.clip:placeholderapi from 2.11.4 to 2.11.5 (#39)
dependabot[bot] Nov 7, 2023
8aa175f
chore(deps): bump dependencies
ybw0014 Nov 22, 2023
39fe312
Merge upstream (#44)
ybw0014 Nov 23, 2023
2c3c5fe
feat: e2e test (#45)
ybw0014 Nov 24, 2023
bd791bf
chore: 最小化部分数据库报错
StarWishsama Nov 24, 2023
c1ad75f
🔧 Bump net.guizhanss:GuizhanLib-common from 1.5.0 to 1.6.1 (#47)
dependabot[bot] Nov 29, 2023
6a5ae60
🔧 Bump net.guizhanss:GuizhanLib-updater from 1.5.0 to 1.6.1 (#48)
dependabot[bot] Nov 29, 2023
4f137a9
chore: backpack 默认 op 权限
StarWishsama Nov 29, 2023
61f4cc4
chore(deps): use dough from jitpack
ybw0014 Oct 19, 2023
50f52a2
fix: version
dependabot[bot] Nov 29, 2023
2945e6a
ci: fix jitpack
ybw0014 Dec 29, 2023
c35b36f
Merge branch 'dev'
StarWishsama Jan 1, 2024
eabaa21
Merge remote-tracking branch 'origin/master'
StarWishsama Jan 1, 2024
40c4284
Merge branch 'dev'
StarWishsama Feb 4, 2024
5f642d0
chore(deps): bump org.postgresql:postgresql from 42.6.0 to 42.7.2
dependabot[bot] Feb 21, 2024
1e05b50
Merge pull request #845 from StarWishsama/dependabot/maven/org.postgr…
StarWishsama Feb 21, 2024
35a49db
Merge branch 'dev'
StarWishsama Apr 2, 2024
ea9e628
Merge branch 'refs/heads/dev'
StarWishsama May 18, 2024
faea471
chore: 尝试让构建站重新构建
ybw0014 May 19, 2024
f9f4bb9
chore: 尝试让构建站再次重新构建
ybw0014 May 19, 2024
ea2c1d2
chore(renovate): 配置 renovate
ybw0014 May 26, 2024
226af9b
Merge branch 'refs/heads/dev'
StarWishsama Jun 9, 2024
7f9f9b2
fix(radiation): 让玩家在进入是获得辐射免疫 (#907)
JWJUN233233 Jul 4, 2024
47ebbd4
Revert "fix(radiation): 让玩家在进入是获得辐射免疫 (#907)"
StarWishsama Jul 4, 2024
af4cb3b
Merge pull request #917 from SlimefunGuguProject/revert-907-fix/radia…
StarWishsama Jul 4, 2024
ebd90ae
Merge branch 'refs/heads/dev'
StarWishsama Jul 13, 2024
3525534
Merge branch 'refs/heads/dev'
StarWishsama Jul 16, 2024
be9a3e5
Merge branch 'refs/heads/dev'
StarWishsama Jul 17, 2024
d36ce9d
Merge branch 'refs/heads/dev'
StarWishsama Jul 17, 2024
5d89728
Merge branch 'refs/heads/dev'
StarWishsama Aug 4, 2024
538e41a
Merge branch 'refs/heads/dev'
ybw0014 Aug 6, 2024
dc72b4b
Merge branch 'refs/heads/dev'
StarWishsama Aug 29, 2024
9fdeb08
Merge branch 'refs/heads/dev'
StarWishsama Sep 12, 2024
7bb1ab3
Merge branch 'refs/heads/dev'
StarWishsama Sep 15, 2024
0021742
Merge branch 'refs/heads/dev'
StarWishsama Sep 17, 2024
b974f06
Merge branch 'refs/heads/dev'
StarWishsama Oct 14, 2024
9ddebfa
1.21.x
haiman233 Nov 9, 2024
6664da3
Merge pull request #968 from haiman233/master
StarWishsama Nov 10, 2024
5cf0268
commit fix
m1919810 Dec 29, 2024
3b663d6
revert #988
m1919810 Dec 29, 2024
e576df5
Merge remote-tracking branch 'source/dev' into commit
m1919810 Dec 29, 2024
b6fa02a
formating
m1919810 Dec 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
formating
  • Loading branch information
m1919810 committed Dec 29, 2024
commit b6fa02ae4297d8e3a35f27e2f1377c83ad8dba3b
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,8 @@ public SlimefunBlockData getBlockData(Location l) {
return getBlockDataFromCache(l);
}

//var chunk = l.getChunk();
//fix issue #935
// var chunk = l.getChunk();
// fix issue #935
var chunkData = getChunkDataCache(l, false);
var lKey = LocationUtils.getLocKey(l);
if (chunkData != null) {
Expand All @@ -444,7 +444,7 @@ public SlimefunBlockData getBlockData(Location l) {
var re =
result.isEmpty() ? null : new SlimefunBlockData(l, result.get(0).get(FieldKey.SLIMEFUN_ID));
if (re != null) {
//fix issue #935
// fix issue #935
chunkData = getChunkDataCache(l, true);
chunkData.addBlockCacheInternal(re, false);
re = chunkData.getBlockCacheInternal(lKey);
Expand Down Expand Up @@ -1272,14 +1272,15 @@ private SlimefunChunkData getChunkDataCache(Chunk chunk, boolean createOnNotExis
})
: loadedChunk.get(LocationUtils.getChunkKey(chunk));
}
//fix issue 935: auto chunk load when using loc.getChunk(),if chunk data is already loaded into cache, we generate keyString using location,instead of loc.getChunk
// fix issue 935: auto chunk load when using loc.getChunk(),if chunk data is already loaded into cache, we generate
// keyString using location,instead of loc.getChunk
private SlimefunChunkData getChunkDataCache(Location loc, boolean createOnNotExists) {
var re= loadedChunk.get(LocationUtils.getChunkKey(loc));
if(re!=null){
var re = loadedChunk.get(LocationUtils.getChunkKey(loc));
if (re != null) {
return re;
}else{
//这里不要检测createOnNotExist 容易出事
return getChunkDataCache(loc.getChunk(),createOnNotExists);
} else {
// jump to origin getChunkDataCache and call getChunk() to trigger chunkLoad
return getChunkDataCache(loc.getChunk(), createOnNotExists);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public static String getLocKey(Location l) {
public static String getChunkKey(Chunk chunk) {
return chunk.getWorld().getName() + ";" + chunk.getX() + ":" + chunk.getZ();
}

public static String getChunkKey(Location loc) {
return loc.getWorld().getName() + ";" + (loc.getBlockX()>>4) + ":" + (loc.getBlockZ()>>4);
return loc.getWorld().getName() + ";" + (loc.getBlockX() >> 4) + ":" + (loc.getBlockZ() >> 4);
}

public static Location toLocation(String lKey) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull ItemStack item) {

Validate.notNull(id, "The Item id must never be null!");
Validate.isTrue(
id.equals(id.toUpperCase(Locale.ROOT)), "Slimefun Item Ids must be uppercase! (e.g. 'MY_ITEM_ID')");
id.equals(id.toUpperCase(Locale.ROOT)), "Slimefun Item Ids must be uppercase! (e.g. 'MY_ITEM_ID')");

if (Slimefun.instance() == null) {
throw new PrematureCodeException(
"A SlimefunItemStack must never be be created before your Plugin was enabled.");
"A SlimefunItemStack must never be be created before your Plugin was enabled.");
}

this.id = id;
Expand All @@ -85,7 +85,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nonnull Co
}

public SlimefunItemStack(
@Nonnull String id, @Nonnull Material type, @Nullable String name, @Nonnull Consumer<ItemMeta> consumer) {
@Nonnull String id, @Nonnull Material type, @Nullable String name, @Nonnull Consumer<ItemMeta> consumer) {
this(id, type, meta -> {
if (name != null) {
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
Expand Down Expand Up @@ -117,7 +117,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull Material type, @Nullable S
}

public SlimefunItemStack(
@Nonnull String id, @Nonnull Material type, @Nonnull Color color, @Nullable String name, String... lore) {
@Nonnull String id, @Nonnull Material type, @Nonnull Color color, @Nullable String name, String... lore) {
this(id, type, im -> {
if (name != null) {
im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
Expand All @@ -144,11 +144,11 @@ public SlimefunItemStack(
}

public SlimefunItemStack(
@Nonnull String id,
@Nonnull Color color,
@Nonnull PotionEffect effect,
@Nullable String name,
String... lore) {
@Nonnull String id,
@Nonnull Color color,
@Nonnull PotionEffect effect,
@Nullable String name,
String... lore) {
this(id, Material.POTION, im -> {
if (name != null) {
im.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
Expand Down Expand Up @@ -190,7 +190,7 @@ public SlimefunItemStack(@Nonnull String id, @Nonnull HeadTexture head, @Nullabl
}

public SlimefunItemStack(
@Nonnull String id, @Nonnull String texture, @Nullable String name, @Nonnull Consumer<ItemMeta> consumer) {
@Nonnull String id, @Nonnull String texture, @Nullable String name, @Nonnull Consumer<ItemMeta> consumer) {
this(id, getSkull(id, texture), meta -> {
if (name != null) {
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
Expand Down Expand Up @@ -309,11 +309,11 @@ public void lock() {
return texture;
} else if (CommonPatterns.HEXADECIMAL.matcher(texture).matches()) {
String value =
"{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}";
"{\"textures\":{\"SKIN\":{\"url\":\"http://textures.minecraft.net/texture/" + texture + "\"}}}";
return Base64.getEncoder().encodeToString(value.getBytes(StandardCharsets.UTF_8));
} else {
throw new IllegalArgumentException(
"The provided texture for Item \"" + id + "\" does not seem to be a valid texture String!");
"The provided texture for Item \"" + id + "\" does not seem to be a valid texture String!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import javax.annotation.ParametersAreNonnullByDefault;
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.entity.EntityType;
Expand Down Expand Up @@ -68,11 +67,10 @@ public Optional<EntityType> getEntityType(@Nonnull ItemStack item) {
return Optional.of(type);
}
}
if(meta instanceof BlockStateMeta blockStateMeta){
if(blockStateMeta.hasBlockState()&& blockStateMeta.getBlockState() instanceof CreatureSpawner spawner){
EntityType type=spawner.getSpawnedType();
if(type!=null)
return Optional.of(type);
if (meta instanceof BlockStateMeta blockStateMeta) {
if (blockStateMeta.hasBlockState() && blockStateMeta.getBlockState() instanceof CreatureSpawner spawner) {
EntityType type = spawner.getSpawnedType();
if (type != null) return Optional.of(type);
}
}

Expand All @@ -91,12 +89,12 @@ public Optional<EntityType> getEntityType(@Nonnull ItemStack item) {
*/
@Nonnull
public ItemStack getItemForEntityType(@Nullable EntityType type) {
//Validate.notNull(type, "The EntityType cannot be null");
// Validate.notNull(type, "The EntityType cannot be null");

ItemStack item = getItem().clone();
ItemMeta meta = item.getItemMeta();
//fix: you can't set null type or a not-spawnable type, for example ,player
if(type!=null&&type.isSpawnable()) {
// fix: you can't set null type or a not-spawnable type, for example ,player
if (type != null && type.isSpawnable()) {

// Fixes #2583 - Proper NBT handling of Spawners
if (meta instanceof BlockStateMeta stateMeta) {
Expand All @@ -115,7 +113,7 @@ public ItemStack getItemForEntityType(@Nullable 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 = type == null ? "空" : ChatUtils.humanize(type.name());
lore.set(i, currentLine.replace("<Type>", typeName).replace("<类型>", typeName));
break;
}
Expand All @@ -125,16 +123,19 @@ public ItemStack getItemForEntityType(@Nullable EntityType type) {
item.setItemMeta(meta);
return item;
}
//to fix the bug of stacking two BROKEN_SPAWNER/REINFORCED_SPAWNER containing different EntityType using cargo or machine
public boolean canStack(@Nonnull ItemMeta itemMetaOne, @Nonnull ItemMeta itemMetaTwo){
if(itemMetaOne instanceof BlockStateMeta blockStateMeta1&& itemMetaTwo instanceof BlockStateMeta blockStateMeta2){
if(blockStateMeta1.hasBlockState()&&blockStateMeta2.hasBlockState()){
//BlockState.equals do not compare these data
if(blockStateMeta1.getBlockState() instanceof CreatureSpawner spawner1&& blockStateMeta2.getBlockState() instanceof CreatureSpawner spawner2){
return spawner1.getSpawnedType()==spawner2.getSpawnedType();
// to fix the bug of stacking two BROKEN_SPAWNER/REINFORCED_SPAWNER containing different EntityType using cargo or
// machine
public boolean canStack(@Nonnull ItemMeta itemMetaOne, @Nonnull ItemMeta itemMetaTwo) {
if (itemMetaOne instanceof BlockStateMeta blockStateMeta1
&& itemMetaTwo instanceof BlockStateMeta blockStateMeta2) {
if (blockStateMeta1.hasBlockState() && blockStateMeta2.hasBlockState()) {
// BlockState.equals do not compare these data
if (blockStateMeta1.getBlockState() instanceof CreatureSpawner spawner1
&& blockStateMeta2.getBlockState() instanceof CreatureSpawner spawner2) {
return spawner1.getSpawnedType() == spawner2.getSpawnedType();
}
}else{
return blockStateMeta1.hasBlockState()==blockStateMeta2.hasBlockState();
} else {
return blockStateMeta1.hasBlockState() == blockStateMeta2.hasBlockState();
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public PickaxeOfContainment(

if (b.getType() == Material.SPAWNER) {
ItemStack spawner = breakSpawner(b);
if(spawner!=null){
if (spawner != null) {
SlimefunUtils.spawnItem(
b.getLocation(), spawner, ItemSpawnReason.BROKEN_SPAWNER_DROP, true, e.getPlayer());

Expand All @@ -69,13 +69,13 @@ public PickaxeOfContainment(
If the spawner's BlockStorage has BlockInfo, then it's not a vanilla spawner
and should not give a broken spawner but a repaired one instead.
*/
SlimefunItem item=StorageCacheUtils.getSfItem(b.getLocation());
SlimefunItem item = StorageCacheUtils.getSfItem(b.getLocation());
if (item instanceof RepairedSpawner) {
spawner = (AbstractMonsterSpawner) SlimefunItems.REPAIRED_SPAWNER.getItem();
} else if (item ==null) {
} else if (item == null) {
spawner = (AbstractMonsterSpawner) SlimefunItems.BROKEN_SPAWNER.getItem();
}else{
//do not drop anything when mining other addon's spawner-material machine
} else {
// do not drop anything when mining other addon's spawner-material machine
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public SmeltersPickaxe(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r
drops.add(drop);
}
}
//fix issue #967
// fix issue #967
e.setDropItems(false);
damageItem(e.getPlayer(), tool);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.Cooler;
import io.github.thebusybiscuit.slimefun4.implementation.items.backpacks.SlimefunBackpack;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
Expand Down Expand Up @@ -208,7 +205,7 @@ private void openBackpack(Player p, ItemStack item, PlayerProfile profile, int s
PlayerBackpack.getAsync(
item,
backpack -> {
//fix the issue #978 dupe with fast-click backpack
// fix the issue #978 dupe with fast-click backpack
backpack.open(p);
backpacks.put(p.getUniqueId(), item);
invSnapshot.put(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,15 @@ public void onDamage(PlayerDeathEvent e) {
}

// There shouldn't even be any items in there, but let's be extra safe!
// Map<Integer, ItemStack> existingItems = soulbound.get(p.getUniqueId());
//fix issue #964 dupe using soulbound
//
// if (existingItems == null) {
// } else {
// existingItems.putAll(items);
// }
// Map<Integer, ItemStack> existingItems = soulbound.get(p.getUniqueId());
// fix issue #964 dupe using soulbound
//
// if (existingItems == null) {
// } else {
// existingItems.putAll(items);
// }
soulbound.put(p.getUniqueId(), items);


// Remove soulbound items from our drops
e.getDrops().removeIf(itemStack -> SlimefunUtils.isSoulbound(itemStack, p.getWorld()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ public void onAnvil(InventoryClickEvent e) {
}
}
}

@EventHandler(ignoreCancelled = true)
public void onAnvilCraft(PrepareAnvilEvent e){
//fix issue #958
if(e.getInventory().getType() == InventoryType.ANVIL&&e.getInventory().getSize()>=2){
public void onAnvilCraft(PrepareAnvilEvent e) {
// fix issue #958
if (e.getInventory().getType() == InventoryType.ANVIL
&& e.getInventory().getSize() >= 2) {
ItemStack item1 = e.getInventory().getContents()[0];
ItemStack item2 = e.getInventory().getContents()[1];
if (hasUnallowedItems(item1, item2)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ public static boolean isItemSimilar(
String id = Slimefun.getItemDataService().getItemData(itemMeta).orElse(null);

if (id != null) {
//to fix issue #976
if(id.equals(sfItemStack.getItemId())) {
// to fix issue #976
if (id.equals(sfItemStack.getItemId())) {
if (checkDistinctiveItem) {
/*
* PR #3417
Expand Down Expand Up @@ -373,9 +373,9 @@ public static boolean isItemSimilar(
* Some items can't rely on just IDs matching and will implement Distinctive Item
* in which case we want to use the method provided to compare
*/
//to fix issue #976
// to fix issue #976
var match = id.equals(possibleItemId);
if(match) {
if (match) {
Optional<DistinctiveItem> optionalDistinctive = getDistinctiveItem(id);
if (optionalDistinctive.isPresent()) {
return optionalDistinctive.get().canStack(possibleSfItemMeta, itemMeta);
Expand Down
Loading