Skip to content

Commit a25588d

Browse files
committed
1.21.5に対応(PaperMC向けの修正)
1 parent 6598ec8 commit a25588d

17 files changed

Lines changed: 69 additions & 50 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@ WIKI_JP.md
5151
*.bak
5252

5353
dependency-reduced-pom.xml
54+
55+
.codegpt

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[Java11] ScriptBlockPlus [MC1.9-1.21] [![](https://jitpack.io/v/yuttyann/ScriptBlockPlus.svg)](https://jitpack.io/#yuttyann/ScriptBlockPlus)
1+
[Java11] ScriptBlockPlus [MC1.9-1.21.5] [![](https://jitpack.io/v/yuttyann/ScriptBlockPlus.svg)](https://jitpack.io/#yuttyann/ScriptBlockPlus)
22
==========
33

44
概要
@@ -27,7 +27,8 @@
2727
**== 各バージョンの動作範囲 ==**
2828
| Plugin | Server | Java |
2929
|:---|:---|:---:|
30-
|**`2.3.0-2.3.2`**|**`1.9-1.21`**|**Java11**|
30+
|**`2.3.3`**|**`1.9-1.21.5`**|**Java11**|
31+
|`2.3.0-2.3.2`|`1.9-1.21`|**Java11**|
3132
|`2.2.7-2.2.8`|`1.9-1.20.2`|**Java11**|
3233
|`2.2.6`|`1.9-1.20.1`|**Java11**|
3334
|`2.2.5`|`1.9-1.19.3`|**Java11**|

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>com.github.yuttyann</groupId>
44
<artifactId>ScriptBlockPlus</artifactId>
5-
<version>2.3.2</version>
5+
<version>2.3.3</version>
66

77
<name>ScriptBlockPlus</name>
88
<url>https://github.com/yuttyann/ScriptBlockPlus</url>
@@ -134,7 +134,7 @@
134134
<dependency>
135135
<groupId>org.spigotmc</groupId>
136136
<artifactId>spigot-api</artifactId>
137-
<version>1.20.1-R0.1-SNAPSHOT</version>
137+
<version>1.21.1-R0.1-SNAPSHOT</version>
138138
<scope>provided</scope>
139139
</dependency>
140140
<dependency>
@@ -164,7 +164,7 @@
164164
<dependency>
165165
<groupId>com.google.code.gson</groupId>
166166
<artifactId>gson</artifactId>
167-
<version>[2.8.9,)</version>
167+
<version>2.8.9</version>
168168
<scope>provided</scope>
169169
</dependency>
170170
<dependency>

src/main/java/com/github/yuttyann/scriptblockplus/file/Backup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import com.google.common.base.Predicates;
3232

3333
/**
34-
* FBS-Common Backup
34+
* Corelate-Common Backup
3535
* @author yuttyann44581
3636
*/
3737
public class Backup extends SimpleFileVisitor<Path> {

src/main/java/com/github/yuttyann/scriptblockplus/hook/nms/AnvilGUI.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.bukkit.inventory.AnvilInventory;
3939
import org.bukkit.inventory.Inventory;
4040
import org.bukkit.inventory.ItemStack;
41+
import org.bukkit.inventory.view.AnvilView;
4142
import org.jetbrains.annotations.NotNull;
4243
import org.jetbrains.annotations.Nullable;
4344

@@ -210,7 +211,7 @@ private void openInventory() {
210211
* @author yuttyann44581
211212
*/
212213
private class AnvilListener implements Listener {
213-
214+
214215
@EventHandler(priority = EventPriority.LOW)
215216
public void onPrepareAnvil(PrepareAnvilEvent event) {
216217
if (!event.getInventory().equals(inventory)) {
@@ -224,7 +225,9 @@ public void onPrepareAnvil(PrepareAnvilEvent event) {
224225
if (McVersion.V_1_16_2.isUnSupported() && StringUtils.isNotEmpty(text) && text.startsWith("§") && name.length() > 0) {
225226
ItemUtils.setName(output, name.substring(1));
226227
}
227-
if (McVersion.V_1_11.isSupported()) {
228+
if (McVersion.V_1_12.isSupported()) {
229+
ScriptBlock.getScheduler().run(() -> ((AnvilView) inventory).setRepairCost(0));
230+
} else if (McVersion.V_1_11.isSupported()) {
228231
ScriptBlock.getScheduler().run(() -> ((AnvilInventory) inventory).setRepairCost(0));
229232
}
230233
if (update != null) {

src/main/java/com/github/yuttyann/scriptblockplus/item/action/TickRunnable.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@
5555
*/
5656
public class TickRunnable extends BukkitRunnable {
5757

58+
private static Particle DUST;
59+
60+
static {
61+
try {
62+
DUST = Particle.valueOf("REDSTONE");
63+
} catch (Exception ex) {
64+
DUST = Particle.valueOf("DUST");
65+
}
66+
}
67+
5868
private static final int PLAYER_RANGE = 15;
5969
private static final int PARTICLE_RANGE = 10;
6070
private static final int PARTICLE_LIMIT = 800;
@@ -231,26 +241,26 @@ public static void spawnParticlesOnBlock(@NotNull Player player, @NotNull Block
231241
double x = block.getX(), y = block.getY(), z = block.getZ(), a = 1D;
232242
if (V_1_13.isSupported()) {
233243
var dust = new DustOptions(color, 1);
234-
player.spawnParticle(Particle.REDSTONE, x, y, z, 0, 0, 0, 0, dust);
235-
player.spawnParticle(Particle.REDSTONE, x + a, y, z, 0, 0, 0, 0, dust);
236-
player.spawnParticle(Particle.REDSTONE, x + a, y, z + a, 0, 0, 0, 0, dust);
237-
player.spawnParticle(Particle.REDSTONE, x, y, z + a, 0, 0, 0, 0, dust);
238-
player.spawnParticle(Particle.REDSTONE, x, y + a, z, 0, 0, 0, 0, dust);
239-
player.spawnParticle(Particle.REDSTONE, x + a, y + a, z, 0, 0, 0, 0, dust);
240-
player.spawnParticle(Particle.REDSTONE, x + a, y + a, z + a, 0, 0, 0, 0, dust);
241-
player.spawnParticle(Particle.REDSTONE, x, y + a, z + a, 0, 0, 0, 0, dust);
244+
player.spawnParticle(DUST, x, y, z, 0, 0, 0, 0, dust);
245+
player.spawnParticle(DUST, x + a, y, z, 0, 0, 0, 0, dust);
246+
player.spawnParticle(DUST, x + a, y, z + a, 0, 0, 0, 0, dust);
247+
player.spawnParticle(DUST, x, y, z + a, 0, 0, 0, 0, dust);
248+
player.spawnParticle(DUST, x, y + a, z, 0, 0, 0, 0, dust);
249+
player.spawnParticle(DUST, x + a, y + a, z, 0, 0, 0, 0, dust);
250+
player.spawnParticle(DUST, x + a, y + a, z + a, 0, 0, 0, 0, dust);
251+
player.spawnParticle(DUST, x, y + a, z + a, 0, 0, 0, 0, dust);
242252
} else {
243253
double r = (color.getRed() - 0.0001) / 255D;
244254
double g = (color.getGreen() - 0.0001) / 255D;
245255
double b = (color.getBlue() - 0.0001) / 255D;
246-
player.spawnParticle(Particle.REDSTONE, x, y, z, 0, r, g, b, 1);
247-
player.spawnParticle(Particle.REDSTONE, x + a, y, z, 0, r, g, b, 1);
248-
player.spawnParticle(Particle.REDSTONE, x + a, y, z + a, 0, r, g, b, 1);
249-
player.spawnParticle(Particle.REDSTONE, x, y, z + a, 0, r, g, b, 1);
250-
player.spawnParticle(Particle.REDSTONE, x, y + a, z, 0, r, g, b, 1);
251-
player.spawnParticle(Particle.REDSTONE, x + a, y + a, z, 0, r, g, b, 1);
252-
player.spawnParticle(Particle.REDSTONE, x + a, y + a, z + a, 0, r, g, b, 1);
253-
player.spawnParticle(Particle.REDSTONE, x, y + a, z + a, 0, r, g, b, 1);
256+
player.spawnParticle(DUST, x, y, z, 0, r, g, b, 1);
257+
player.spawnParticle(DUST, x + a, y, z, 0, r, g, b, 1);
258+
player.spawnParticle(DUST, x + a, y, z + a, 0, r, g, b, 1);
259+
player.spawnParticle(DUST, x, y, z + a, 0, r, g, b, 1);
260+
player.spawnParticle(DUST, x, y + a, z, 0, r, g, b, 1);
261+
player.spawnParticle(DUST, x + a, y + a, z, 0, r, g, b, 1);
262+
player.spawnParticle(DUST, x + a, y + a, z + a, 0, r, g, b, 1);
263+
player.spawnParticle(DUST, x, y + a, z + a, 0, r, g, b, 1);
254264
}
255265
}
256266
}

src/main/java/com/github/yuttyann/scriptblockplus/item/gui/GUIItem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public GUIItem(final boolean enchant, final int amount, @NotNull Material materi
9898
}
9999
itemMeta.addItemFlags(FLAGS);
100100
if (enchant) {
101-
itemMeta.addEnchant(Enchantment.LOOT_BONUS_BLOCKS, 1, false);
101+
itemMeta.addEnchant(Enchantment.EFFICIENCY, 1, false);
102102
}
103103
if (name != null) {
104104
itemMeta.setDisplayName("§r" + name);
@@ -167,9 +167,9 @@ public TriConsumer<UserWindow, GUIItem, ClickType> getClicked() {
167167
public GUIItem setEnchant(final boolean enchant) {
168168
var itemMeta = item.getItemMeta();
169169
if (enchant) {
170-
itemMeta.addEnchant(Enchantment.LOOT_BONUS_BLOCKS, 1, false);
170+
itemMeta.addEnchant(Enchantment.EFFICIENCY, 1, false);
171171
} else {
172-
itemMeta.removeEnchant(Enchantment.LOOT_BONUS_BLOCKS);
172+
itemMeta.removeEnchant(Enchantment.EFFICIENCY);
173173
}
174174
item.setItemMeta(itemMeta);
175175
return this;

src/main/java/com/github/yuttyann/scriptblockplus/utils/server/CraftBukkit.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import com.github.yuttyann.scriptblockplus.utils.version.McVersion;
2323

2424
/**
25-
* FBS-Bukkit CraftBukkit
25+
* Corelate-Bukkit CraftBukkit
2626
* @see McVersion#V_1_21_1
2727
* @author yuttyann44581
2828
*/

src/main/java/com/github/yuttyann/scriptblockplus/utils/server/NetMinecraft.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import com.github.yuttyann.scriptblockplus.utils.version.McVersion;
2222

2323
/**
24-
* FBS-Bukkit NetMinecraft
24+
* Corelate-Bukkit NetMinecraft
2525
* @see McVersion#V_1_21_1
2626
* @author yuttyann44581
2727
*/

src/main/java/com/github/yuttyann/scriptblockplus/utils/server/minecraft/Minecraft.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import org.springframework.lang.NonNull;
3030

3131
/**
32-
* FBS-Bukkit Minecraft
32+
* Corelate-Bukkit Minecraft
3333
* @author yuttyann44581
3434
*/
3535
public final class Minecraft {
@@ -45,7 +45,7 @@ public static void setAccessor(@NonNull NativeAccessor accessor) {
4545
public static void sendAllPacket(@NotNull Object packet) throws ReflectiveOperationException {
4646
accessor.sendAllPacket(packet);
4747
}
48-
48+
4949
public static void sendAllPackets(@NotNull Object... packets) throws ReflectiveOperationException {
5050
accessor.sendAllPackets(packets);
5151
}
@@ -124,7 +124,7 @@ public static List<Entity> getEntities(@NotNull CommandSender sender, @NotNull V
124124
public static Object newVec3(double x, double y, double z) throws ReflectiveOperationException {
125125
return accessor.newVec3(x, y, z);
126126
}
127-
127+
128128
@NotNull
129129
public static Object newAnvilMenu(@NotNull Object serverPlayer, @NotNull Object serverLevel, @NotNull Object title) throws ReflectiveOperationException {
130130
return accessor.newAnvilMenu(serverPlayer, serverLevel, title);

0 commit comments

Comments
 (0)