fix jump slab
This commit is contained in:
parent
d9eb747c1b
commit
978f739045
43 changed files with 5685 additions and 832 deletions
|
|
@ -30,8 +30,6 @@ import org.bstats.charts.SingleLineChart;
|
|||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Main class of LoParkour
|
||||
|
|
@ -112,77 +110,8 @@ public final class LoParkour extends LoPlugin {
|
|||
|
||||
private void loadSchematics() {
|
||||
schematicManager = new LPSchematicManager();
|
||||
|
||||
// Create default island schematic if it doesn't exist
|
||||
File schematicsFolder = getInFolder("schematics-new");
|
||||
File islandFile = new File(schematicsFolder, "island.lpschem");
|
||||
|
||||
if (!islandFile.exists()) {
|
||||
try {
|
||||
createDefaultIslandSchematic(islandFile);
|
||||
getLogger().info("Created default island schematic");
|
||||
} catch (Exception ex) {
|
||||
getLogger().severe("Failed to create default island schematic: " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
schematicManager.loadAll();
|
||||
}
|
||||
|
||||
private void createDefaultIslandSchematic(File file) throws Exception {
|
||||
// Create a larger 9x5x9 island for better visibility and safety
|
||||
List<String> palette = new ArrayList<>();
|
||||
palette.add("minecraft:air");
|
||||
palette.add("minecraft:stone");
|
||||
palette.add("minecraft:diamond_block");
|
||||
palette.add("minecraft:emerald_block");
|
||||
|
||||
int width = 9, height = 5, length = 9;
|
||||
int[] blocks = new int[width * height * length];
|
||||
|
||||
// Fill everything with air first
|
||||
for (int i = 0; i < blocks.length; i++) {
|
||||
blocks[i] = 0;
|
||||
}
|
||||
|
||||
// Create a solid stone platform at y=1 (7x7 platform)
|
||||
for (int z = 1; z < 8; z++) {
|
||||
for (int x = 1; x < 8; x++) {
|
||||
int index = x + (z * width) + (1 * width * length);
|
||||
blocks[index] = 1; // stone
|
||||
}
|
||||
}
|
||||
|
||||
// Place diamond block (player spawn) at center
|
||||
int centerX = 4, centerZ = 4;
|
||||
int diamondIndex = centerX + (centerZ * width) + (1 * width * length);
|
||||
blocks[diamondIndex] = 2; // diamond_block - player spawns here
|
||||
|
||||
// Place emerald block (parkour start) to the right of spawn
|
||||
int emeraldIndex = (centerX + 1) + (centerZ * width) + (1 * width * length);
|
||||
blocks[emeraldIndex] = 3; // emerald_block - parkour starts here
|
||||
|
||||
dev.loki.loparkour.schematic.lpschem.SchematicMetadata metadata =
|
||||
new dev.loki.loparkour.schematic.lpschem.SchematicMetadata("island", "LoParkour", 0.0);
|
||||
metadata.addTag("spawn");
|
||||
metadata.addTag("island");
|
||||
|
||||
dev.loki.loparkour.schematic.lpschem.SchematicDimensions dimensions =
|
||||
new dev.loki.loparkour.schematic.lpschem.SchematicDimensions(width, height, length);
|
||||
|
||||
// Markers point to the blocks where player spawns and parkour begins
|
||||
dev.loki.loparkour.schematic.lpschem.SchematicMarkers markers =
|
||||
new dev.loki.loparkour.schematic.lpschem.SchematicMarkers(
|
||||
new dev.loki.loparkour.schematic.lpschem.SchematicMarkers.Vector3i(centerX, 1, centerZ),
|
||||
new dev.loki.loparkour.schematic.lpschem.SchematicMarkers.Vector3i(centerX + 1, 1, centerZ)
|
||||
);
|
||||
|
||||
dev.loki.loparkour.schematic.lpschem.LPSchematic schematic =
|
||||
new dev.loki.loparkour.schematic.lpschem.LPSchematic(metadata, dimensions, palette, blocks, markers);
|
||||
|
||||
schematic.save(file);
|
||||
}
|
||||
|
||||
private void registerModes() {
|
||||
Registry.register(new DefaultMode());
|
||||
|
|
@ -256,29 +185,14 @@ public final class LoParkour extends LoPlugin {
|
|||
ParkourUser.leave(user);
|
||||
}
|
||||
|
||||
// Save leaderboards for all modes
|
||||
if (Modes.DEFAULT != null && Modes.DEFAULT.getLeaderboard() != null) {
|
||||
Modes.DEFAULT.getLeaderboard().write(false);
|
||||
}
|
||||
if (Modes.SPEEDRUN != null && Modes.SPEEDRUN.getLeaderboard() != null) {
|
||||
Modes.SPEEDRUN.getLeaderboard().write(false);
|
||||
}
|
||||
if (Modes.ELYTRA != null && Modes.ELYTRA.getLeaderboard() != null) {
|
||||
Modes.ELYTRA.getLeaderboard().write(false);
|
||||
}
|
||||
if (Modes.RACE != null && Modes.RACE.getLeaderboard() != null) {
|
||||
Modes.RACE.getLeaderboard().write(false);
|
||||
}
|
||||
if (Modes.COOP != null && Modes.COOP.getLeaderboard() != null) {
|
||||
Modes.COOP.getLeaderboard().write(false);
|
||||
}
|
||||
// write all LoParkour gamemodes
|
||||
Modes.DEFAULT.getLeaderboard().write(false);
|
||||
|
||||
Storage.close();
|
||||
World.delete();
|
||||
} catch (Throwable ex) {
|
||||
// Log errors instead of silently ignoring them
|
||||
getLogger().severe("Error during plugin disable: " + ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} catch (Throwable t) {
|
||||
getLogger().severe("Error during plugin shutdown: " + t.getMessage());
|
||||
t.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue