Skip to content

Commit ed4ec90

Browse files
committed
Fixed block recreation on bridge on legacy versions (colouring)
1 parent 5f7a4cb commit ed4ec90

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/java/plugily/projects/thebridge/arena/Arena.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import org.bukkit.block.Block;
2626
import org.bukkit.entity.Player;
2727
import org.bukkit.potion.PotionEffect;
28-
import org.bukkit.potion.PotionEffectType;
2928
import org.jetbrains.annotations.Nullable;
3029
import plugily.projects.minigamesbox.api.arena.IArenaState;
3130
import plugily.projects.minigamesbox.classic.arena.PluginArena;
@@ -63,7 +62,7 @@ public class Arena extends PluginArena {
6362
private final ArrayList<Block> placedBlocks = new ArrayList<>();
6463

6564
private List<Cuboid> bridgeCuboid;
66-
private final HashMap<Location, Material> brokenBlocks = new HashMap<>();
65+
private final HashMap<Location, XMaterial> brokenBlocks = new HashMap<>();
6766

6867
private final HashMap<Player, Player> hits = new HashMap<>();
6968
private int resetRound = 0;
@@ -350,10 +349,10 @@ public void addBridgeCuboid(Cuboid cuboid) {
350349
this.bridgeCuboid.add(cuboid);
351350
}
352351

353-
public HashMap<Location, Material> getBrokenBlocks() {
352+
public HashMap<Location, XMaterial> getBrokenBlocks() {
354353
return brokenBlocks;
355354
}
356-
public void addBrokenBlock(Location location, Material material) {
355+
public void addBrokenBlock(Location location, XMaterial material) {
357356
this.brokenBlocks.put(location, material);
358357
}
359358

@@ -365,7 +364,7 @@ public void resetPlacedBlocks() {
365364
}
366365

367366
public void resetBrokenBlocks() {
368-
brokenBlocks.forEach((location, material) -> XBlock.setType(location.getBlock(), XMaterial.matchXMaterial(material)));
367+
brokenBlocks.forEach((location, material) -> XBlock.setType(location.getBlock(), material));
369368
brokenBlocks.clear();
370369
}
371370

src/main/java/plugily/projects/thebridge/arena/ArenaEvents.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
4545
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyEntityPickupItemEvent;
4646
import plugily.projects.minigamesbox.classic.utils.version.events.api.PlugilyPlayerPickupArrow;
47+
import plugily.projects.minigamesbox.classic.utils.version.xseries.XBlock;
4748
import plugily.projects.minigamesbox.classic.utils.version.xseries.XMaterial;
4849
import plugily.projects.minigamesbox.classic.utils.version.xseries.XSound;
4950
import plugily.projects.thebridge.Main;
@@ -114,7 +115,7 @@ public void onBlockBreakEvent(BlockBreakEvent event) {
114115
// Only add blocks to the list if the block is not found to be in the broken blocks list
115116
// Making it so that resetting placed blocks and resetting broken blocks will not tamper with each other
116117
if(!arena.getBrokenBlocks().containsKey(event.getBlock().getLocation())) {
117-
arena.addBrokenBlock(event.getBlock().getLocation(), event.getBlock().getType());
118+
arena.addBrokenBlock(event.getBlock().getLocation(), XBlock.getType(event.getBlock()));
118119
}
119120
} else {
120121
new MessageBuilder("IN_GAME_MESSAGES_ARENA_BUILD_BREAK")

0 commit comments

Comments
 (0)