build a hypixel megawalls clone plugin for minecraft java 1.8.9
I’ll create a playable single-arena MegaWalls MVP: lobby/join flow, balanced teams, preparation countdown, team withers, lives and respawns, build protection, win detection, admin controls, and configurable arena locations.
Implemented a new Minecraft 1.8.9 Hypixel-style MegaWalls plugin MVP.
Included:
/mw join,/mw leave,/mw team <color>/mw start,/mw stop,/mw reload/mw setspawn <red|blue|green|yellow>Four balanced teams: red, blue, green, yellow
Lobby and team spawn locations
Preparation countdown
Walls-down phase and final phase
Team withers
Configurable player lives
Respawning and elimination
Team-based wither protection
Build restrictions during preparation
Configurable arena bounds
Custom messages and configuration files
Gradle setup targeting Java 8 and Spigot 1.8.8 API
XSeries-based cross-version item and sound handling
Configure the arena locations in src/main/resources/config.yml, or use /mw setspawn <team> in-game.
fix
📄
pasted-code-1787153822899.txt
txt
46 lines
▶
[15:35:13 INFO]: Set PluginClassLoader as parallel capable
[15:35:13 ERROR]: Could not load 'plugins/KodariMegaWalls-1.0.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/kodari/megawalls/KodariMegaWalls has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1162) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:997) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_312]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_312]
at net.minecraft.server.v1_8_R3.SystemUtils.a(SourceFile:44) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:715) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Caused by: java.lang.UnsupportedClassVersionError: com/kodari/megawalls/KodariMegaWalls has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_312]
at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_312]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_312]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) ~[?:1.8.0_312]
at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_312]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_312]
at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_312]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_312]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_312]
at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.(PluginClassLoader.java:64) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
... 21 more
[15:35:13 INFO]: Server permissions file permissions.yml is empty, ignoring it
[15:35:13 INFO]: DJBoko: Reload complete.
Force Java 8 bytecode using the compiler’s
--release 8option.Keep the existing Java 8 source/target settings and provide a clean rebuild command.
Fixed the Java compatibility issue by forcing Gradle to compile Java 8 bytecode.
Rebuild the plugin:
./gradlew clean build
Then replace the old JAR with:
build/libs/KodariMegaWalls-1.0.0.jar
The server runs Java 8, which supports class files up to version 52.0; the previous JAR was compiled as version 60.0 (Java 16).
fix errors:
📄
pasted-code-1787153918090.txt
txt
151 lines
▶
[15:38:15 INFO]: Server permissions file permissions.yml is empty, ignoring it
[15:38:15 INFO]: CONSOLE: Reload complete.
pl
[15:38:19 INFO]: Plugins (0):
rl
[15:38:20 INFO]: CONSOLE: Please note that this command is not supported and may cause issues when using some plugins.
[15:38:20 INFO]: CONSOLE: If you encounter any issues please use the /stop command to restart your server.
[15:38:20 INFO]: Debug logging is disabled
[15:38:20 INFO]: Server Ping Player Sample Count: 12
[15:38:20 INFO]: Using 4 threads for Netty based IO
[15:38:20 INFO]: -------- World Settings For [world] --------
[15:38:20 INFO]: Anti X-Ray: true
[15:38:20 INFO]: Engine Mode: 1
[15:38:20 INFO]: Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
[15:38:20 INFO]: Replace Blocks: [1, 5]
[15:38:20 INFO]: Nerfing mobs spawned from spawners: false
[15:38:20 INFO]: Cactus Growth Modifier: 100%
[15:38:20 INFO]: Cane Growth Modifier: 100%
[15:38:20 INFO]: Melon Growth Modifier: 100%
[15:38:20 INFO]: Mushroom Growth Modifier: 100%
[15:38:20 INFO]: Pumpkin Growth Modifier: 100%
[15:38:20 INFO]: Sapling Growth Modifier: 100%
[15:38:20 INFO]: Wheat Growth Modifier: 100%
[15:38:20 INFO]: NetherWart Growth Modifier: 100%
[15:38:20 INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
[15:38:20 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[15:38:20 INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
[15:38:20 INFO]: Random Lighting Updates: false
[15:38:20 INFO]: Structure Info Saving: true
[15:38:20 INFO]: Sending up to 10 chunks per packet
[15:38:20 INFO]: Max Entity Collisions: 8
[15:38:20 INFO]: Custom Map Seeds: Village: 10387312 Feature: 14357617
[15:38:20 INFO]: Max TNT Explosions: 100
[15:38:20 INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[15:38:20 INFO]: Mob Spawn Range: 4
[15:38:20 INFO]: Item Despawn Rate: 6000
[15:38:20 INFO]: Item Merge Radius: 2.5
[15:38:20 INFO]: Arrow Despawn Rate: 1200
[15:38:20 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[15:38:20 INFO]: View Distance: 10
[15:38:20 INFO]: Zombie Aggressive Towards Villager: true
[15:38:20 INFO]: Chunks to Grow per Tick: 650
[15:38:20 INFO]: Clear tick list: false
[15:38:20 INFO]: Experience Merge Radius: 3.0
[15:38:20 INFO]: -------- World Settings For [world_nether] --------
[15:38:20 INFO]: Anti X-Ray: true
[15:38:20 INFO]: Engine Mode: 1
[15:38:20 INFO]: Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
[15:38:20 INFO]: Replace Blocks: [1, 5]
[15:38:20 INFO]: Nerfing mobs spawned from spawners: false
[15:38:20 INFO]: Cactus Growth Modifier: 100%
[15:38:20 INFO]: Cane Growth Modifier: 100%
[15:38:20 INFO]: Melon Growth Modifier: 100%
[15:38:20 INFO]: Mushroom Growth Modifier: 100%
[15:38:20 INFO]: Pumpkin Growth Modifier: 100%
[15:38:20 INFO]: Sapling Growth Modifier: 100%
[15:38:20 INFO]: Wheat Growth Modifier: 100%
[15:38:20 INFO]: NetherWart Growth Modifier: 100%
[15:38:20 INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
[15:38:20 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[15:38:20 INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
[15:38:20 INFO]: Random Lighting Updates: false
[15:38:20 INFO]: Structure Info Saving: true
[15:38:20 INFO]: Sending up to 10 chunks per packet
[15:38:20 INFO]: Max Entity Collisions: 8
[15:38:20 INFO]: Custom Map Seeds: Village: 10387312 Feature: 14357617
[15:38:20 INFO]: Max TNT Explosions: 100
[15:38:20 INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[15:38:20 INFO]: Mob Spawn Range: 4
[15:38:20 INFO]: Item Despawn Rate: 6000
[15:38:20 INFO]: Item Merge Radius: 2.5
[15:38:20 INFO]: Arrow Despawn Rate: 1200
[15:38:20 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[15:38:20 INFO]: View Distance: 10
[15:38:20 INFO]: Zombie Aggressive Towards Villager: true
[15:38:20 INFO]: Chunks to Grow per Tick: 650
[15:38:20 INFO]: Clear tick list: false
[15:38:20 INFO]: Experience Merge Radius: 3.0
[15:38:20 INFO]: -------- World Settings For [world_the_end] --------
[15:38:20 INFO]: Anti X-Ray: true
[15:38:20 INFO]: Engine Mode: 1
[15:38:20 INFO]: Hidden Blocks: [14, 15, 16, 21, 48, 49, 54, 56, 73, 74, 82, 129, 130]
[15:38:20 INFO]: Replace Blocks: [1, 5]
[15:38:20 INFO]: Nerfing mobs spawned from spawners: false
[15:38:20 INFO]: Cactus Growth Modifier: 100%
[15:38:20 INFO]: Cane Growth Modifier: 100%
[15:38:20 INFO]: Melon Growth Modifier: 100%
[15:38:20 INFO]: Mushroom Growth Modifier: 100%
[15:38:20 INFO]: Pumpkin Growth Modifier: 100%
[15:38:20 INFO]: Sapling Growth Modifier: 100%
[15:38:20 INFO]: Wheat Growth Modifier: 100%
[15:38:20 INFO]: NetherWart Growth Modifier: 100%
[15:38:20 INFO]: Entity Activation Range: An 32 / Mo 32 / Mi 16
[15:38:20 INFO]: Entity Tracking Range: Pl 48 / An 48 / Mo 48 / Mi 32 / Other 64
[15:38:20 INFO]: Hopper Transfer: 8 Hopper Check: 8 Hopper Amount: 1
[15:38:20 INFO]: Random Lighting Updates: false
[15:38:20 INFO]: Structure Info Saving: true
[15:38:20 INFO]: Sending up to 10 chunks per packet
[15:38:20 INFO]: Max Entity Collisions: 8
[15:38:20 INFO]: Custom Map Seeds: Village: 10387312 Feature: 14357617
[15:38:20 INFO]: Max TNT Explosions: 100
[15:38:20 INFO]: Tile Max Tick Time: 50ms Entity max Tick Time: 50ms
[15:38:20 INFO]: Mob Spawn Range: 4
[15:38:20 INFO]: Item Despawn Rate: 6000
[15:38:20 INFO]: Item Merge Radius: 2.5
[15:38:20 INFO]: Arrow Despawn Rate: 1200
[15:38:20 INFO]: Allow Zombie Pigmen to spawn from portal blocks: true
[15:38:20 INFO]: View Distance: 10
[15:38:20 INFO]: Zombie Aggressive Towards Villager: true
[15:38:20 INFO]: Chunks to Grow per Tick: 650
[15:38:20 INFO]: Clear tick list: false
[15:38:20 INFO]: Experience Merge Radius: 3.0
[15:38:20 ERROR]: Could not load 'plugins/KodariMegaWalls-1.0.0 (1).jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: com/kodari/megawalls/KodariMegaWalls has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.reload(CraftServer.java:739) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.Bukkit.reload(Bukkit.java:535) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:25) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:641) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchServerCommand(CraftServer.java:627) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.aO(DedicatedServer.java:412) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:375) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
Caused by: java.lang.UnsupportedClassVersionError: com/kodari/megawalls/KodariMegaWalls has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method) ~[?:1.8.0_312]
at java.lang.ClassLoader.defineClass(ClassLoader.java:756) ~[?:1.8.0_312]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[?:1.8.0_312]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) ~[?:1.8.0_312]
at java.net.URLClassLoader.access$100(URLClassLoader.java:74) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:369) ~[?:1.8.0_312]
at java.net.URLClassLoader$1.run(URLClassLoader.java:363) ~[?:1.8.0_312]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_312]
at java.net.URLClassLoader.findClass(URLClassLoader.java:362) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[?:1.8.0_312]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_312]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_312]
at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_312]
at org.bukkit.plugin.java.PluginClassLoader.(PluginClassLoader.java:64) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8.jar:git-Spigot-3c60ece-741a1bd]
... 14 more
[15:38:20 INFO]: Server permissions file permissions.yml is empty, ignoring it
[15:38:20 INFO]: CONSOLE: Reload complete.
The project’s build.gradle is already configured correctly for Java 8:
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
options.release = 8
The error is from an old JAR compiled with Java 16 (class file version 60). The server is loading:
KodariMegaWalls-1.0.0 (1).jar
Delete every old MegaWalls JAR from the server’s plugins folder, then rebuild:
./gradlew clean build
Copy this newly generated file:
build/libs/KodariMegaWalls-1.0.0.jar
into plugins/, then fully restart the server with /stop and start it again. Do not use /reload.
You can verify the JAR before copying it:
javap -verbose -classpath build/libs/KodariMegaWalls-1.0.0.jar \
com.kodari.megawalls.KodariMegaWalls | grep "major version"
It must report:
major version: 52
52 is Java 8 bytecode; 60 is Java 16 bytecode.
keep getting this errors my jdk is spigot-1.8.8
spigot-1.8.8 is your server JAR, not your JDK. The error confirms the server itself is running Java 8:
[?:1.8.0_312]
only recognizes class file versions up to 52.0
But your plugin JAR was built with Java 16:
class file version 60.0
Use one of these fixes:
Recommended: run the 1.8.8 server using Java 16 or Java 17.
Update your start script sojava -versionreports Java 16+.If the server must stay on Java 8: rebuild the plugin with a Java 8 JDK—not merely a Java 8 target setting. Run:
java -version
./gradlew --version
./gradlew clean build
Both Java entries used for the build need to be Java 8, and the resulting plugin class files must be version 52.
Then delete the old duplicate plugin JARs, especially:
plugins/KodariMegaWalls-1.0.0 (1).jar
Copy only the freshly rebuilt JAR into plugins/, and fully stop/start the server. Do not use /reload; Spigot explicitly warns against it and it can retain old plugin class loaders.
package com.kodari.megawalls;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.Map;
public class KodariMegaWalls extends JavaPlugin {
private GameManager gameManager;
private FileConfiguration messages;
@Override
public void onEnable() {
saveDefaultConfig();
saveResource("messages.yml", false);
loadMessages();
gameManager = new GameManager(this);
getServer().getPluginManager().registerEvents(new GameListener(this), this);
getCommand("megawalls").setExecutor(new MegaWallsCommand(this));
getServer().getScheduler().runTaskTimer(this, gameManager::tick, 20L, 20L);
}
@Override
public void onDisable() {
if (gameManager != null) {
gameManager.shutdown();
}
}
public GameManager getGameManager() {
return gameManager;
}
public void reloadMessages() {
loadMessages();
}
private void loadMessages() {
messages = YamlConfiguration.loadConfiguration(new File(getDataFolder(), "messages.yml"));
}
public String message(String key, String... replacements) {
String value = messages.getString(key, key);
String prefix = messages.getString("prefix", "");
if (!"prefix".equals(key)) {
value = prefix + value;
}
for (int i = 0; i + 1 < replacements.length; i += 2) {
value = value.replace("{" + replacements[i] + "}", replacements[i + 1]);
}
return ChatColor.translateAlternateColorCodes('&', value);
}
public LocationData configuredLocation(String path, org.bukkit.World fallback) {
org.bukkit.configuration.ConfigurationSection section = getConfig().getConfigurationSection(path);
if (section == null) {
return null;
}
String worldName = section.getString("world", fallback == null ? "world" : fallback.getName());
org.bukkit.World world = getServer().getWorld(worldName);
if (world == null) {
world = fallback;
}
if (world == null) {
return null;
}
return new LocationData(world, section.getDouble("x"), section.getDouble("y"), section.getDouble("z"),
(float) section.getDouble("yaw", 0), (float) section.getDouble("pitch", 0));
}
public static class LocationData {
private final org.bukkit.World world;
private final double x;
private final double y;
private final double z;
private final float yaw;
private final float pitch;
public LocationData(org.bukkit.World world, double x, double y, double z, float yaw, float pitch) {
this.world = world;
this.x = x;
this.y = y;
this.z = z;
this.yaw = yaw;
this.pitch = pitch;
}
public org.bukkit.Location toLocation() {
return new org.bukkit.Location(world, x, y, z, yaw, pitch);
}
}
}