Multiverse 4.5 -> MyWorlds
This commit is contained in:
1 parent
023f42d47c
commit
acbc9bc3e4
7 files changed
+54
-140
No files matched your search
+3
-5
@@ -26,7 +26,7 @@ kotlin { jvmToolchain(17) }
|
||||
/* ----------------------------- Metadata ------------------------------ */
|
||||
group = "uk.hotten.herobrine"
|
||||
|
||||
version = "1.4"
|
||||
version = "1.5"
|
||||
|
||||
val apiVersion = "1.19" // Minecraft server target version.
|
||||
|
||||
@@ -60,6 +60,7 @@ repositories {
|
||||
maven { url = uri("https://jitpack.io") } // Import the Jitpack repository.
|
||||
maven { url = uri("https://repo.dmulloy2.net/repository/public/") }
|
||||
maven { url = uri("https://repo.onarandombox.com/content/groups/public/") } // Import the Multiverse 5 repository.
|
||||
maven { url = uri("https://ci.mg-dev.eu/plugin/repository/everything") } // Import BKCommonLib repository.
|
||||
}
|
||||
|
||||
/* ---------------------- Java project deps ---------------------------- */
|
||||
@@ -74,11 +75,8 @@ dependencies {
|
||||
compileOnlyApi(project(":libs:Utilities-OG")) // Import TrueOG Network Utilities-OG Java API (from source).
|
||||
compileOnly("org.purpurmc.purpur:purpur-api:1.19.4-R0.1-SNAPSHOT") // Declare Purpur API version to be packaged.
|
||||
compileOnly("io.github.miniplaceholders:miniplaceholders-api:2.2.3") // Import MiniPlaceholders API.
|
||||
compileOnly("org.mvplugins.multiverse.core:multiverse-core:5.0.0-SNAPSHOT") // Import Multiverse 5 API.
|
||||
compileOnly(files("libs/ProtocolLib/ProtocolLib-5.0.jar")) // Import Legacy ProtocolLib API.
|
||||
compileOnly(
|
||||
files("libs/Multiverse-Legacy-API/Multiverse-Legacy-API-1.1.0.jar")
|
||||
) // Import Legacy Multiverse 4 API SHIM.
|
||||
compileOnly("com.github.regix1:MyWorlds:master-SNAPSHOT") // Import MyWorlds API from JitPack.
|
||||
implementation(project(":libs:GxUI-OG")) // Import TrueOG Network GxUI-OG Java API (from source).
|
||||
implementation(files("libs/ScoreboardLib/ScoreboardLib-1.1.0-SNAPSHOT.jar")) // Import ScoreboardLib API.
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2025, The Multiverse Team
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
package uk.hotten.herobrine.game;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.bergerkiller.bukkit.mw.MyWorlds;
|
||||
import io.papermc.paper.event.player.AsyncChatEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -43,7 +43,6 @@ import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
import uk.hotten.herobrine.kit.KitGui;
|
||||
import uk.hotten.herobrine.lobby.GameLobby;
|
||||
import uk.hotten.herobrine.lobby.LobbyManager;
|
||||
import uk.hotten.herobrine.stat.GameRank;
|
||||
import uk.hotten.herobrine.stat.StatManager;
|
||||
import uk.hotten.herobrine.utils.GameState;
|
||||
@@ -57,14 +56,12 @@ public class GMListener implements Listener {
|
||||
|
||||
private GameManager gameManager;
|
||||
private GameLobby gameLobby;
|
||||
private MVWorldManager mvWorldManager;
|
||||
private ArrayList<Player> kitCooldown = new ArrayList<>();
|
||||
|
||||
public GMListener(GameManager gm, GameLobby gl) {
|
||||
|
||||
this.gameManager = gm;
|
||||
this.gameLobby = gl;
|
||||
mvWorldManager = LobbyManager.getInstance().getMultiverseCore().getMVWorldManager();
|
||||
|
||||
}
|
||||
|
||||
@@ -96,7 +93,7 @@ public class GMListener implements Listener {
|
||||
|
||||
if (!gameManager.canJoin(player)) {
|
||||
|
||||
player.teleport(mvWorldManager.getSpawnWorld().getSpawnLocation());
|
||||
player.teleport(MyWorlds.getMainWorld().getSpawnLocation());
|
||||
Message.send(player, Message.format("&cThis lobby is full."));
|
||||
return;
|
||||
|
||||
|
||||
@@ -17,12 +17,10 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.bergerkiller.bukkit.mw.MyWorlds;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLGenerator;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.Core;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
@@ -42,10 +40,7 @@ public class LobbyManager {
|
||||
private static LobbyManager instance;
|
||||
|
||||
@Getter
|
||||
private MultiverseCore multiverseCore;
|
||||
|
||||
@Getter
|
||||
private MVWorldManager mvWorldManager;
|
||||
private MyWorlds myWorlds;
|
||||
|
||||
private final HashMap<String, LobbyConfig> lobbyConfigs;
|
||||
private final HashMap<String, GameLobby> gameLobbies;
|
||||
@@ -58,7 +53,7 @@ public class LobbyManager {
|
||||
lobbyConfigs = new HashMap<>();
|
||||
gameLobbies = new HashMap<>();
|
||||
|
||||
hookMultiverse();
|
||||
hookMyWorlds();
|
||||
|
||||
try {
|
||||
|
||||
@@ -73,62 +68,25 @@ public class LobbyManager {
|
||||
|
||||
}
|
||||
|
||||
private void hookMultiverse() {
|
||||
private void hookMyWorlds() {
|
||||
|
||||
Plugin mvPlugin = Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Core");
|
||||
if (mvPlugin == null || !mvPlugin.isEnabled()) {
|
||||
Plugin mwPlugin = Bukkit.getServer().getPluginManager().getPlugin("MyWorlds");
|
||||
if (mwPlugin == null || !mwPlugin.isEnabled()) {
|
||||
|
||||
Console.error("Multiverse-Core is not installed or not enabled.");
|
||||
mvWorldManager = null;
|
||||
multiverseCore = null;
|
||||
Console.error("MyWorlds is not installed or not enabled.");
|
||||
myWorlds = null;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (mvPlugin instanceof MultiverseCore) {
|
||||
if (mwPlugin instanceof MyWorlds) {
|
||||
|
||||
multiverseCore = (MultiverseCore) mvPlugin;
|
||||
mvWorldManager = multiverseCore.getMVWorldManager();
|
||||
myWorlds = (MyWorlds) mwPlugin;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
Core core = Bukkit.getServicesManager().load(Core.class);
|
||||
if (core != null) {
|
||||
|
||||
mvWorldManager = core.getMVWorldManager();
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
if (mvWorldManager == null) {
|
||||
|
||||
try {
|
||||
|
||||
var m = mvPlugin.getClass().getMethod("getMVWorldManager");
|
||||
Object res = m.invoke(mvPlugin);
|
||||
if (res instanceof MVWorldManager) {
|
||||
|
||||
mvWorldManager = (MVWorldManager) res;
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ignored) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (mvWorldManager == null) {
|
||||
|
||||
Console.error("Failed to hook Multiverse MVWorldManager (unexpected Multiverse-Core implementation).");
|
||||
|
||||
}
|
||||
Console.error("Failed to hook MyWorlds (unexpected implementation).");
|
||||
|
||||
}
|
||||
|
||||
@@ -361,4 +319,4 @@ public class LobbyManager {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -14,17 +14,15 @@ import org.bukkit.Difficulty;
|
||||
import org.bukkit.GameRule;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.bergerkiller.bukkit.mw.WorldConfig;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.kyori.adventure.text.TextComponent;
|
||||
@@ -33,7 +31,6 @@ import net.kyori.adventure.text.event.HoverEvent;
|
||||
import uk.hotten.herobrine.events.GameStateUpdateEvent;
|
||||
import uk.hotten.herobrine.game.runnables.MapVotingRunnable;
|
||||
import uk.hotten.herobrine.lobby.GameLobby;
|
||||
import uk.hotten.herobrine.lobby.LobbyManager;
|
||||
import uk.hotten.herobrine.utils.Console;
|
||||
import uk.hotten.herobrine.utils.GameState;
|
||||
import uk.hotten.herobrine.utils.Message;
|
||||
@@ -47,9 +44,6 @@ public class WorldManager implements Listener {
|
||||
private JavaPlugin plugin;
|
||||
private GameLobby gameLobby;
|
||||
|
||||
@Getter
|
||||
private MVWorldManager mvWorldManager;
|
||||
|
||||
private String fileBase;
|
||||
|
||||
@Getter
|
||||
@@ -59,10 +53,10 @@ public class WorldManager implements Listener {
|
||||
private MapData gameMapData;
|
||||
|
||||
@Getter
|
||||
private MultiverseWorld gameWorld;
|
||||
private World gameWorld;
|
||||
|
||||
@Getter
|
||||
private MultiverseWorld hubWorld;
|
||||
private World hubWorld;
|
||||
|
||||
@Getter
|
||||
private HashMap<Integer, VotingMap> votingMaps;
|
||||
@@ -90,7 +84,6 @@ public class WorldManager implements Listener {
|
||||
Console.info(gameLobby, "Loading World Manager...");
|
||||
this.plugin = plugin;
|
||||
this.gameLobby = gameLobby;
|
||||
mvWorldManager = LobbyManager.getInstance().getMultiverseCore().getMVWorldManager();
|
||||
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
|
||||
@@ -358,35 +351,32 @@ public class WorldManager implements Listener {
|
||||
}
|
||||
|
||||
String worldName = gameLobby.getLobbyId() + "-" + map.getInternalName();
|
||||
boolean ok = mvWorldManager.addWorld(worldName, World.Environment.NORMAL, null, WorldType.NORMAL, false, null);
|
||||
if (!ok) {
|
||||
WorldConfig wc = WorldConfig.get(worldName);
|
||||
World world = wc.loadWorld();
|
||||
if (world == null) {
|
||||
|
||||
Console.error(gameLobby, "Failed to register/load MV game world: " + worldName);
|
||||
Console.error(gameLobby, "Failed to load MyWorlds game world: " + worldName);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
gameWorld = mvWorldManager.getMVWorld(worldName);
|
||||
if (gameWorld == null || gameWorld.getCBWorld() == null) {
|
||||
gameWorld = world;
|
||||
|
||||
Console.error(gameLobby, "MV returned null world after addWorld: " + worldName);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
gameWorld.setAllowAnimalSpawn(false);
|
||||
gameWorld.setAllowMonsterSpawn(false);
|
||||
gameWorld.setDifficulty(Difficulty.NORMAL);
|
||||
gameWorld.setTime("midnight");
|
||||
gameWorld.getCBWorld().setGameRule(GameRule.DO_FIRE_TICK, false);
|
||||
gameWorld.getCBWorld().setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false);
|
||||
gameWorld.getCBWorld().setGameRule(GameRule.SHOW_DEATH_MESSAGES, false);
|
||||
wc.spawnControl.setAnimals(true);
|
||||
wc.spawnControl.setMonsters(true);
|
||||
wc.difficulty = Difficulty.NORMAL;
|
||||
wc.updateDifficulty(world);
|
||||
wc.timeControl.setTime(18000);
|
||||
wc.timeControl.setLocking(true);
|
||||
world.setGameRule(GameRule.DO_FIRE_TICK, false);
|
||||
world.setGameRule(GameRule.DO_DAYLIGHT_CYCLE, false);
|
||||
world.setGameRule(GameRule.SHOW_DEATH_MESSAGES, false);
|
||||
|
||||
gameMapData = map.getMapData();
|
||||
|
||||
for (Datapoint dp : gameMapData.getDatapoints()) {
|
||||
|
||||
Location dLoc = new Location(gameWorld.getCBWorld(), dp.getX(), dp.getY(), dp.getZ());
|
||||
Location dLoc = new Location(gameWorld, dp.getX(), dp.getY(), dp.getZ());
|
||||
switch (dp.getType()) {
|
||||
|
||||
case SURVIVOR_SPAWN -> {
|
||||
@@ -461,26 +451,23 @@ public class WorldManager implements Listener {
|
||||
}
|
||||
|
||||
String worldName = gameLobby.getLobbyId() + "-hub";
|
||||
boolean ok = mvWorldManager.addWorld(worldName, World.Environment.NORMAL, null, WorldType.NORMAL, false, null);
|
||||
if (!ok) {
|
||||
WorldConfig wc = WorldConfig.get(worldName);
|
||||
World world = wc.loadWorld();
|
||||
if (world == null) {
|
||||
|
||||
Console.error(gameLobby, "Failed to register/load MV hub world: " + worldName);
|
||||
Console.error(gameLobby, "Failed to load MyWorlds hub world: " + worldName);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
hubWorld = mvWorldManager.getMVWorld(worldName);
|
||||
if (hubWorld == null || hubWorld.getCBWorld() == null) {
|
||||
hubWorld = world;
|
||||
|
||||
Console.error(gameLobby, "MV returned null hub world after addWorld: " + worldName);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
hubWorld.setAllowAnimalSpawn(false);
|
||||
hubWorld.setAllowMonsterSpawn(false);
|
||||
hubWorld.setDifficulty(Difficulty.PEACEFUL);
|
||||
hubWorld.setTime("midnight");
|
||||
wc.spawnControl.setAnimals(true);
|
||||
wc.spawnControl.setMonsters(true);
|
||||
wc.difficulty = Difficulty.PEACEFUL;
|
||||
wc.updateDifficulty(world);
|
||||
wc.timeControl.setTime(18000);
|
||||
wc.timeControl.setLocking(true);
|
||||
Console.info(gameLobby, "Finished loading!");
|
||||
|
||||
}
|
||||
@@ -515,9 +502,10 @@ public class WorldManager implements Listener {
|
||||
|
||||
Console.info(gameLobby, "Cleaning the map...");
|
||||
|
||||
String gameWorldName = gameWorld.getName();
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getWorld() != null && p.getWorld().getName().equals(gameWorld.getName())) {
|
||||
if (p.getWorld() != null && p.getWorld().getName().equals(gameWorldName)) {
|
||||
|
||||
World main = Bukkit.getServer().getWorld("world");
|
||||
if (main == null)
|
||||
@@ -529,7 +517,7 @@ public class WorldManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
mvWorldManager.deleteWorld(gameWorld.getName());
|
||||
WorldConfig.get(gameWorldName).deleteWorld();
|
||||
|
||||
gameWorld = null;
|
||||
gameMapData = null;
|
||||
@@ -564,9 +552,10 @@ public class WorldManager implements Listener {
|
||||
if (hubWorld == null)
|
||||
return;
|
||||
|
||||
String hubWorldName = hubWorld.getName();
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
|
||||
if (p.getWorld() != null && p.getWorld().getName().equals(hubWorld.getName())) {
|
||||
if (p.getWorld() != null && p.getWorld().getName().equals(hubWorldName)) {
|
||||
|
||||
World main = Bukkit.getServer().getWorld("world");
|
||||
if (main == null)
|
||||
@@ -578,9 +567,9 @@ public class WorldManager implements Listener {
|
||||
|
||||
}
|
||||
|
||||
mvWorldManager.deleteWorld(hubWorld.getName());
|
||||
WorldConfig.get(hubWorldName).deleteWorld();
|
||||
hubWorld = null;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ author: Gxorge
|
||||
description: Remake of "The Herobrine!" v2 from HiveMC.
|
||||
depend:
|
||||
- ProtocolLib
|
||||
- Multiverse-Core
|
||||
- MyWorlds
|
||||
|
||||
commands:
|
||||
hbsetherobrine:
|
||||
|
||||
Reference in new issue
Block a user