0.5.0 bis
Some world management system with multiverse. Also beginning to use dungeons/gates. Need to build maps to use in dungeons.
This commit is contained in:
parent
10c66d6fa4
commit
26cf701494
20 changed files with 300 additions and 77 deletions
25
build.gradle
25
build.gradle
|
@ -13,7 +13,6 @@ repositories {
|
||||||
maven {
|
maven {
|
||||||
url = uri('https://jitpack.io')
|
url = uri('https://jitpack.io')
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
url = uri('https://papermc.io/repo/repository/maven-public/')
|
url = uri('https://papermc.io/repo/repository/maven-public/')
|
||||||
}
|
}
|
||||||
|
@ -48,20 +47,23 @@ repositories {
|
||||||
maven {
|
maven {
|
||||||
url = 'https://repo.citizensnpcs.co/'
|
url = 'https://repo.citizensnpcs.co/'
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url = "https://repo.onarandombox.com/content/groups/public/"
|
||||||
|
}
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//lombok stuff
|
// lombok stuff
|
||||||
implementation 'org.projectlombok:lombok:1.18.22'
|
implementation 'org.projectlombok:lombok:1.18.22'
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
annotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
testCompileOnly 'org.projectlombok:lombok:1.18.22'
|
testCompileOnly 'org.projectlombok:lombok:1.18.22'
|
||||||
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
testAnnotationProcessor 'org.projectlombok:lombok:1.18.22'
|
||||||
|
|
||||||
//mongo stuff
|
// mongo stuff
|
||||||
implementation 'org.mongodb:mongodb-driver-sync:4.5.0'
|
implementation 'org.mongodb:mongodb-driver-sync:4.5.1'
|
||||||
implementation 'org.mongodb:bson:4.5.0'
|
implementation 'org.mongodb:bson:4.5.1'
|
||||||
implementation 'org.mongodb:mongodb-driver-core:4.5.0'
|
implementation 'org.mongodb:mongodb-driver-core:4.5.1'
|
||||||
|
|
||||||
implementation 'de.tr7zw:item-nbt-api-plugin:2.9.2'
|
implementation 'de.tr7zw:item-nbt-api-plugin:2.9.2'
|
||||||
compileOnly 'io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT'
|
compileOnly 'io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT'
|
||||||
|
@ -69,10 +71,11 @@ dependencies {
|
||||||
compileOnly 'net.luckperms:api:5.4'
|
compileOnly 'net.luckperms:api:5.4'
|
||||||
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
|
compileOnly 'com.github.MilkBowl:VaultAPI:1.7.1'
|
||||||
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
|
compileOnly 'net.essentialsx:EssentialsX:2.19.4'
|
||||||
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.0.1'
|
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Core:2.1.0'
|
||||||
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.0.1'
|
compileOnly 'com.fastasyncworldedit:FastAsyncWorldEdit-Bukkit:2.1.0'
|
||||||
compileOnly 'me.clip:placeholderapi:2.11.1'
|
compileOnly 'me.clip:placeholderapi:2.11.1'
|
||||||
compileOnly 'net.citizensnpcs:citizens-main:2.0.29-SNAPSHOT'
|
compileOnly 'net.citizensnpcs:citizens-main:2.0.29-SNAPSHOT'
|
||||||
|
compileOnly 'com.onarandombox.multiversecore:Multiverse-Core:4.3.1'
|
||||||
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
compileOnly fileTree(dir: 'libs', include: '*.jar')
|
||||||
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.2-R0.1-SNAPSHOT")
|
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:1.18.2-R0.1-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
@ -103,9 +106,9 @@ tasks {
|
||||||
shadowJar {
|
shadowJar {
|
||||||
dependencies {
|
dependencies {
|
||||||
include dependency('de.tr7zw:item-nbt-api-plugin:2.9.2')
|
include dependency('de.tr7zw:item-nbt-api-plugin:2.9.2')
|
||||||
include dependency('org.mongodb:mongodb-driver-sync:4.5.0')
|
include dependency('org.mongodb:mongodb-driver-sync:4.5.1')
|
||||||
include dependency('org.mongodb:bson:4.5.0')
|
include dependency('org.mongodb:bson:4.5.1')
|
||||||
include dependency('org.mongodb:mongodb-driver-core:4.5.0')
|
include dependency('org.mongodb:mongodb-driver-core:4.5.1')
|
||||||
}
|
}
|
||||||
relocate("de.tr7zw.changeme", "gq.unurled.libs.de.tr7zw")
|
relocate("de.tr7zw.changeme", "gq.unurled.libs.de.tr7zw")
|
||||||
relocate("de.tr7zw", "gq.unurled.libs.de.tr7zw")
|
relocate("de.tr7zw", "gq.unurled.libs.de.tr7zw")
|
||||||
|
|
|
@ -22,5 +22,5 @@ Some RPG thing :
|
||||||
- basic isekai manga sort of monster and also high leveled op monster king of something => bosses
|
- basic isekai manga sort of monster and also high leveled op monster king of something => bosses
|
||||||
- outbreak if gate isn't closed in time
|
- outbreak if gate isn't closed in time
|
||||||
- loots:
|
- loots:
|
||||||
- items of different rarities with multiple purpose => medicinal, combat related type, defensive etc...
|
- items of different rarities with multiple purpose => medicinal, combat related types, defensive etc...
|
||||||
- leveling system for the player
|
- leveling system for the player
|
|
@ -5,3 +5,4 @@
|
||||||
- [ ] make custom mods (hard coded)
|
- [ ] make custom mods (hard coded)
|
||||||
- [ ] make gates
|
- [ ] make gates
|
||||||
- [ ] a map
|
- [ ] a map
|
||||||
|
- [ ] a leveling system
|
|
@ -39,8 +39,8 @@ public class SpawnEntity implements TabExecutor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//example command : /entityspawn ZOMBIE "&cHello folks" 50 200
|
//example command : /entityspawn ZOMBIE "&cHello folks" 50 200
|
||||||
EntityType type = EntityType.valueOf(args[0]);
|
EntityType types = EntityType.valueOf(args[0]);
|
||||||
Entity e = player.getWorld().spawnEntity(player.getLocation(), type, false);
|
Entity e = player.getWorld().spawnEntity(player.getLocation(), types, false);
|
||||||
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
|
setNameSpacedKeys(e, "<red>Name", 100, 100,0,50,0,100,0,100,0);
|
||||||
e.customName(colorTextComp(args[1]));
|
e.customName(colorTextComp(args[1]));
|
||||||
e.setCustomNameVisible(true);
|
e.setCustomNameVisible(true);
|
||||||
|
@ -50,8 +50,8 @@ public class SpawnEntity implements TabExecutor {
|
||||||
@Override
|
@Override
|
||||||
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
|
||||||
List<String> list = new ArrayList<>();
|
List<String> list = new ArrayList<>();
|
||||||
for (EntityType type : EntityType.values()) {
|
for (EntityType types : EntityType.values()) {
|
||||||
list.add(type.name());
|
list.add(types.name());
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
package gq.unurled.raxen.components.dungeons;
|
package gq.unurled.raxen.components.dungeons;
|
||||||
|
|
||||||
|
import gq.unurled.raxen.components.entity.other.RaxenEntity;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import static gq.unurled.raxen.utils.DungeonUtils.getRadiusFromRank;
|
import static gq.unurled.raxen.utils.DungeonUtils.getRadiusFromRank;
|
||||||
|
@ -15,18 +18,20 @@ public class Dungeon {
|
||||||
|
|
||||||
private Gate gate;
|
private Gate gate;
|
||||||
|
|
||||||
|
private Map<UUID, RaxenEntity> monster = new HashMap();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Type of the Dungeon
|
* The Type of the Dungeon
|
||||||
*/
|
*/
|
||||||
private Type type;
|
private Types types;
|
||||||
|
|
||||||
private Location location;
|
private Location location;
|
||||||
private Integer radius;
|
private Integer radius;
|
||||||
|
|
||||||
public Dungeon(UUID uuid, Rank rank, Type type) {
|
public Dungeon(UUID uuid, Rank rank, Types types) {
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.rank = rank;
|
this.rank = rank;
|
||||||
this.type = type;
|
this.types = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,13 +39,20 @@ public class Dungeon {
|
||||||
* TODO: Place the gate at a random place.
|
* TODO: Place the gate at a random place.
|
||||||
*/
|
*/
|
||||||
public void generateGate() {
|
public void generateGate() {
|
||||||
// -281.50 36.00 187.50 0.90 10.80
|
// -281.50 36.00 187.50
|
||||||
Location loc = new Location(Bukkit.getWorld("Liberty_City"), -284.0, 36.00, 187.50);
|
Location loc = new Location(Bukkit.getWorld("Liberty_City"), -284.0, 45.00, 187.50);
|
||||||
Integer radius = getRadiusFromRank(this.rank);
|
Integer radius = getRadiusFromRank(this.rank);
|
||||||
this.gate = new Gate(uuid, loc, radius);
|
this.gate = new Gate(uuid, loc, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO: Terrain Generation of the inside of the Dungeons
|
||||||
|
*/
|
||||||
public void generate() {
|
public void generate() {
|
||||||
|
genMonster();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void genMonster() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package gq.unurled.raxen.components.dungeons;
|
package gq.unurled.raxen.components.dungeons;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class Gate {
|
public class Gate {
|
||||||
|
@ -23,6 +25,42 @@ public class Gate {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void genGate() {
|
||||||
|
// get which side it's gonna expand with radius
|
||||||
|
Random r = new Random();
|
||||||
|
Boolean xExpend = false;
|
||||||
|
if (r.nextInt(2) == 0) {
|
||||||
|
xExpend = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// place blocks
|
||||||
|
for (double i = 0; i <= Math.PI; i += Math.PI / portalRadius) {
|
||||||
|
double radius = Math.sin(i);
|
||||||
|
double y = Math.cos(i);
|
||||||
|
for (double a = 0; a < Math.PI * 2; a+= Math.PI / portalRadius) {
|
||||||
|
double x = Math.cos(a) * radius;
|
||||||
|
double z = Math.sin(a) * radius;
|
||||||
|
Location locc = new Location(loc.getWorld(), x, y, z);
|
||||||
|
loc.getBlock().setType(Material.NETHER_PORTAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
for (int n=0; n<portalRadius ; n++) {
|
||||||
|
Double x = loc.getX();
|
||||||
|
Double y = loc.getY();
|
||||||
|
Double z = loc.getZ();
|
||||||
|
if (xExpend) {
|
||||||
|
Location locc = new Location(loc.getWorld(), x + n, y + n, z);
|
||||||
|
locc.getBlock().setType(Material.NETHER_PORTAL);
|
||||||
|
locc = new Location(loc.getWorld(), loc.getX() - n, y-n, z);
|
||||||
|
locc.getBlock().setType(Material.NETHER_PORTAL);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Location getLoc() {
|
public Location getLoc() {
|
||||||
return loc;
|
return loc;
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
package gq.unurled.raxen.components.dungeons;
|
package gq.unurled.raxen.components.dungeons;
|
||||||
|
|
||||||
public enum Type {
|
import gq.unurled.raxen.components.entity.other.RaxenEntity;
|
||||||
JUNGLE,
|
import gq.unurled.raxen.components.lootchest.loots.LootItem;
|
||||||
TROPICAL_JUNGLE,
|
|
||||||
PLAINS,
|
import java.util.HashMap;
|
||||||
GRAVES,
|
import java.util.Map;
|
||||||
CASTLE,
|
|
||||||
ABANDONED_CASTLE,
|
public class Type {
|
||||||
FIELD,
|
|
||||||
ICE_FOREST,
|
public String name;
|
||||||
FOREST,
|
|
||||||
VOLCANO,
|
public Map<String, RaxenEntity> monster = new HashMap<>();
|
||||||
MOUNTAINS,
|
|
||||||
HIGH_MOUNTAINS,
|
public Map<String, LootItem> lootItem = new HashMap<>();
|
||||||
CAVES,
|
|
||||||
LABYRINTH,
|
// public Map<String, > chest
|
||||||
UNDERGROUND_LABYRINTH,
|
|
||||||
FOREST_LABYRINTH
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package gq.unurled.raxen.components.dungeons;
|
||||||
|
|
||||||
|
public enum Types {
|
||||||
|
JUNGLE,
|
||||||
|
TROPICAL_JUNGLE,
|
||||||
|
PLAINS,
|
||||||
|
GRAVES,
|
||||||
|
CASTLE,
|
||||||
|
ABANDONED_CASTLE,
|
||||||
|
FIELD,
|
||||||
|
ICE_FOREST,
|
||||||
|
FOREST,
|
||||||
|
VOLCANO,
|
||||||
|
MOUNTAINS,
|
||||||
|
HIGH_MOUNTAINS,
|
||||||
|
CAVES,
|
||||||
|
LABYRINTH,
|
||||||
|
UNDERGROUND_LABYRINTH,
|
||||||
|
FOREST_LABYRINTH
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package gq.unurled.raxen.components.dungeons;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||||
|
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||||
|
import gq.unurled.raxen.Raxen;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static gq.unurled.raxen.utils.Utils.*;
|
||||||
|
|
||||||
|
public class WorldManagement {
|
||||||
|
|
||||||
|
private Raxen main;
|
||||||
|
|
||||||
|
MVWorldManager worldManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String : name
|
||||||
|
* MultiverseWorld : a world that need to be registered
|
||||||
|
*/
|
||||||
|
private Map<String, MultiverseWorld> loadedWorlds = new HashMap<>();
|
||||||
|
|
||||||
|
private List<String> worlds = new ArrayList<>();
|
||||||
|
|
||||||
|
private File pluginFolder;
|
||||||
|
private File worldFolder;
|
||||||
|
|
||||||
|
|
||||||
|
public WorldManagement(Raxen main) {
|
||||||
|
this.main = main;
|
||||||
|
this.pluginFolder = new File(main.getDataFolder() + "/worlds/");
|
||||||
|
this.worldFolder = new File("worlds/");
|
||||||
|
this.worldManager = main.getManager().getMultiverse().getWorldManager();
|
||||||
|
worlds.add("Forest");
|
||||||
|
log(pluginFolder.getAbsolutePath(), "" + pluginFolder.isDirectory());
|
||||||
|
log(worldFolder.getAbsolutePath(), "" + worldFolder.isDirectory());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load() {
|
||||||
|
if (!pluginFolder.exists()) {
|
||||||
|
pluginFolder.mkdirs();
|
||||||
|
error("Please put in the folder " + pluginFolder.getAbsolutePath() + " all the needed worlds :");
|
||||||
|
for (String s : worlds) {
|
||||||
|
error(" - " + s + ",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadWorld(String name) {
|
||||||
|
File world = new File(pluginFolder + name + "/");
|
||||||
|
if (!world.exists() || !world.isDirectory()) {
|
||||||
|
error("Loading world " + name + ". Folder don't exists.");
|
||||||
|
}
|
||||||
|
File newWorld = new File(worldFolder + name);
|
||||||
|
try {
|
||||||
|
copyDirectory(world.getAbsolutePath(), newWorld.getAbsolutePath());
|
||||||
|
} catch (IOException e) {
|
||||||
|
error("Error while Loading world " + name + " at coping data.");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
worldManager.loadWorld(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package gq.unurled.raxen.components.dungeons.types.forest;
|
||||||
|
|
||||||
|
public enum ForestMonster {
|
||||||
|
ELF,
|
||||||
|
WOLF
|
||||||
|
}
|
|
@ -15,16 +15,15 @@ public class RaxenEntity {
|
||||||
|
|
||||||
private final Raxen main;
|
private final Raxen main;
|
||||||
|
|
||||||
@Getter
|
@Getter private final String name;
|
||||||
private final String name;
|
|
||||||
@Getter
|
@Getter private Integer level;
|
||||||
private Integer level;
|
|
||||||
@Getter
|
@Getter @Setter private Double health;
|
||||||
@Setter
|
|
||||||
private Double health;
|
@Getter @Setter private Double strength;
|
||||||
@Getter
|
|
||||||
@Setter
|
@Getter @Setter Boolean isAlive = false;
|
||||||
private Double strength;
|
|
||||||
|
|
||||||
public RaxenEntity(Raxen main, String name, Integer level, Double health, Double strength) {
|
public RaxenEntity(Raxen main, String name, Integer level, Double health, Double strength) {
|
||||||
this.main = main;
|
this.main = main;
|
||||||
|
@ -34,8 +33,8 @@ public class RaxenEntity {
|
||||||
this.strength = strength;
|
this.strength = strength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Entity createEntity(EntityType type, String name, Location location) {
|
public Entity createEntity(EntityType types, String name, Location location) {
|
||||||
Entity e = location.getWorld().spawnEntity(location, type);
|
Entity e = location.getWorld().spawnEntity(location, types);
|
||||||
e.setCustomNameVisible(true);
|
e.setCustomNameVisible(true);
|
||||||
e.customName(Component.text(name));
|
e.customName(Component.text(name));
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.PlayerInventory;
|
import org.bukkit.inventory.PlayerInventory;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -32,7 +34,6 @@ import java.util.List;
|
||||||
import static gq.unurled.raxen.utils.Items.listItemStackDeserilize;
|
import static gq.unurled.raxen.utils.Items.listItemStackDeserilize;
|
||||||
import static gq.unurled.raxen.utils.Items.setItemsToInventory;
|
import static gq.unurled.raxen.utils.Items.setItemsToInventory;
|
||||||
import static gq.unurled.raxen.utils.Utils.debug;
|
import static gq.unurled.raxen.utils.Utils.debug;
|
||||||
import static gq.unurled.raxen.utils.Utils.warn;
|
|
||||||
|
|
||||||
public class PlayerConfig {
|
public class PlayerConfig {
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ public class PlayerConfig {
|
||||||
private Attributes attributes;
|
private Attributes attributes;
|
||||||
|
|
||||||
public PlayerConfig(Raxen main) {
|
public PlayerConfig(Raxen main) {
|
||||||
PlayerConfig.main = main;
|
this.main = main;
|
||||||
sto = main.getManager().getStorageManager();
|
sto = main.getManager().getStorageManager();
|
||||||
this.mongoDB = main.getManager().getLibsManager().getMongoDB();
|
this.mongoDB = main.getManager().getLibsManager().getMongoDB();
|
||||||
this.mongoCollection = mongoDB.getMongoCollection();
|
this.mongoCollection = mongoDB.getMongoCollection();
|
||||||
|
@ -56,7 +57,7 @@ public class PlayerConfig {
|
||||||
mongoDB.close();
|
mongoDB.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveUsingMongoDB(Player player, Attributes attributes, String invstr, Integer reverse) {
|
public void saveUsingMongoDB(@NotNull Player player, Attributes attributes, String invstr, Integer reverse) {
|
||||||
debug(main, "Saving " + player.getName() + "'s data!");
|
debug(main, "Saving " + player.getName() + "'s data!");
|
||||||
Document doc = new Document("uuid", player.getUniqueId().toString())
|
Document doc = new Document("uuid", player.getUniqueId().toString())
|
||||||
.append("name", player.getName())
|
.append("name", player.getName())
|
||||||
|
@ -125,7 +126,7 @@ public class PlayerConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadUsingMongoDB(Player player) {
|
public void loadUsingMongoDB(@NotNull Player player) {
|
||||||
Document playerDoc = mongoCollection.find(Filters.eq("uuid", player.getUniqueId().toString())).first();
|
Document playerDoc = mongoCollection.find(Filters.eq("uuid", player.getUniqueId().toString())).first();
|
||||||
if(playerDoc == null) {
|
if(playerDoc == null) {
|
||||||
debug(main, "Intiatilising Data for Player: " + player.getName());
|
debug(main, "Intiatilising Data for Player: " + player.getName());
|
||||||
|
@ -182,7 +183,7 @@ public class PlayerConfig {
|
||||||
playerManager.getRaxenPlayer(player).setInventory(inv);
|
playerManager.getRaxenPlayer(player).setInventory(inv);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void savePlayerConfig(Player player) {
|
public void savePlayerConfig(@NotNull Player player) {
|
||||||
Attributes attributes = new Attributes(main);
|
Attributes attributes = new Attributes(main);
|
||||||
Inventory inv = player.getInventory();
|
Inventory inv = player.getInventory();
|
||||||
List<String> listInv = new ArrayList<String>();
|
List<String> listInv = new ArrayList<String>();
|
||||||
|
@ -200,10 +201,24 @@ public class PlayerConfig {
|
||||||
}
|
}
|
||||||
debug(main, "saving...");
|
debug(main, "saving...");
|
||||||
String storage = sto.getConfig().getString("storage");
|
String storage = sto.getConfig().getString("storage");
|
||||||
saveUsingMongoDB(player, attributes, invstr, reverse);
|
Integer finalReverse = reverse;
|
||||||
|
String finalInvstr = invstr;
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
saveUsingMongoDB(player, attributes, finalInvstr, finalReverse);
|
||||||
|
}
|
||||||
|
}.runTaskAsynchronously(main);
|
||||||
debug(main, "using mongo");
|
debug(main, "using mongo");
|
||||||
if (storage == "MYSQL" || storage == "YML") {
|
if (storage == "MYSQL" || storage == "YML") {
|
||||||
saveUsingYml(player, attributes, invstr, reverse);
|
String finalInvstr1 = invstr;
|
||||||
|
Integer finalReverse1 = reverse;
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
saveUsingYml(player, attributes, finalInvstr1, finalReverse1);
|
||||||
|
}
|
||||||
|
}.runTaskAsynchronously(main);
|
||||||
debug(main, "using yml");
|
debug(main, "using yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,19 +229,26 @@ public class PlayerConfig {
|
||||||
String st = StorageManager.getConfig().getString("storage");
|
String st = StorageManager.getConfig().getString("storage");
|
||||||
String value = "";
|
String value = "";
|
||||||
if (st.equals("MONGODB")) {
|
if (st.equals("MONGODB")) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
loadUsingMongoDB(player);
|
loadUsingMongoDB(player);
|
||||||
value = "mongodb";
|
|
||||||
warn(main, "'" + st + "'");
|
|
||||||
}
|
}
|
||||||
else {
|
}.runTaskAsynchronously(main);
|
||||||
warn(main, "'" + st + "'");
|
value = "mongodb";
|
||||||
|
} else {
|
||||||
value = "yml";
|
value = "yml";
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
try {
|
try {
|
||||||
loadUsingYml(player);
|
loadUsingYml(player);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.runTaskAsynchronously(main);
|
||||||
|
}
|
||||||
debug(main, "Player: " + player.getName() + " data successfully loaded using " + value);
|
debug(main, "Player: " + player.getName() + " data successfully loaded using " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package gq.unurled.raxen.manager;
|
||||||
import gq.unurled.raxen.Raxen;
|
import gq.unurled.raxen.Raxen;
|
||||||
import gq.unurled.raxen.manager.entity.*;
|
import gq.unurled.raxen.manager.entity.*;
|
||||||
import gq.unurled.raxen.manager.server.*;
|
import gq.unurled.raxen.manager.server.*;
|
||||||
|
import gq.unurled.raxen.utils.libs.Multiverse;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class Manager {
|
public class Manager {
|
||||||
|
@ -28,6 +29,8 @@ public class Manager {
|
||||||
@Getter
|
@Getter
|
||||||
private LibsManager libsManager;
|
private LibsManager libsManager;
|
||||||
|
|
||||||
|
@Getter private Multiverse multiverse;
|
||||||
|
|
||||||
public void set(Raxen main) {
|
public void set(Raxen main) {
|
||||||
libsManager = new LibsManager(main);
|
libsManager = new LibsManager(main);
|
||||||
|
|
||||||
|
@ -42,5 +45,6 @@ public class Manager {
|
||||||
resourcePackManager = new ResourcePackManager(main);
|
resourcePackManager = new ResourcePackManager(main);
|
||||||
entityManager = new EntityManager(main);
|
entityManager = new EntityManager(main);
|
||||||
lootManager = new LootManager(main);
|
lootManager = new LootManager(main);
|
||||||
|
multiverse = new Multiverse();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,4 @@ public class WorldManager {
|
||||||
worlds.put(world.getName(), world);
|
worlds.put(world.getName(), world);
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public World getWorld(String name) {
|
|
||||||
return Bukkit.getWorld(name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
package gq.unurled.raxen.utils;
|
package gq.unurled.raxen.utils;
|
||||||
|
|
||||||
import gq.unurled.raxen.components.dungeons.Rank;
|
import gq.unurled.raxen.components.dungeons.Rank;
|
||||||
|
import gq.unurled.raxen.components.dungeons.Types;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class DungeonUtils {
|
public class DungeonUtils {
|
||||||
|
|
||||||
public static Integer getRadiusFromRank(Rank rank) {
|
public static Integer getRadiusFromRank(@NotNull Rank rank) {
|
||||||
Integer radius = 1;
|
Integer radius = 1;
|
||||||
switch (rank) {
|
switch (rank) {
|
||||||
case F:
|
case F:
|
||||||
|
@ -34,4 +38,9 @@ public class DungeonUtils {
|
||||||
}
|
}
|
||||||
return radius;
|
return radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void fromTypeToMonster(Types types, Rank rank) {
|
||||||
|
Random r = new Random();
|
||||||
|
r.nextInt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class Items {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e) {
|
catch (ClassNotFoundException e) {
|
||||||
throw new IOException("Unable to decode class type.", e);
|
throw new IOException("Unable to decode class types.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,11 @@ import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
public class Utils {
|
public class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -208,6 +213,17 @@ public class Utils {
|
||||||
return colorComp("<red>An Error has occurred. Please retry or contact an Admin.");
|
return colorComp("<red>An Error has occurred. Please retry or contact an Admin.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void copyDirectory(String sourceDirectoryLocation, String destinationDirectoryLocation) throws IOException {
|
||||||
|
Files.walk(Paths.get(sourceDirectoryLocation))
|
||||||
|
.forEach(source -> {
|
||||||
|
Path destination = Paths.get(destinationDirectoryLocation, source.toString()
|
||||||
|
.substring(sourceDirectoryLocation.length()));
|
||||||
|
try {
|
||||||
|
Files.copy(source, destination);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
24
src/main/java/gq/unurled/raxen/utils/libs/Multiverse.java
Normal file
24
src/main/java/gq/unurled/raxen/utils/libs/Multiverse.java
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
package gq.unurled.raxen.utils.libs;
|
||||||
|
|
||||||
|
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||||
|
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
|
public class Multiverse {
|
||||||
|
|
||||||
|
private MultiverseCore core;
|
||||||
|
private MVWorldManager worldManager;
|
||||||
|
|
||||||
|
public Multiverse() {
|
||||||
|
this.worldManager = core.getMVWorldManager();
|
||||||
|
this.core = (MultiverseCore) Bukkit.getServer().getPluginManager().getPlugin("Multiverse-Core");
|
||||||
|
}
|
||||||
|
|
||||||
|
public MVWorldManager getWorldManager() {
|
||||||
|
return worldManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiverseCore getMultiverseCore() {
|
||||||
|
return core;
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,4 +11,9 @@
|
||||||
useResourcePack: false
|
useResourcePack: false
|
||||||
resource_pack_url: "https://mc-packs.net/" # recommend to use https://mc-packs.net/ => free resource pack hoster (will eventually develop one myself but not atm)
|
resource_pack_url: "https://mc-packs.net/" # recommend to use https://mc-packs.net/ => free resource pack hoster (will eventually develop one myself but not atm)
|
||||||
resource_pack_sha1: "sha1hallo" # sha1 hash
|
resource_pack_sha1: "sha1hallo" # sha1 hash
|
||||||
debug: true
|
|
||||||
|
worlds:
|
||||||
|
forest:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
debug: false
|
|
@ -3,7 +3,7 @@ version: '${version}'
|
||||||
main: gq.unurled.raxen.Raxen
|
main: gq.unurled.raxen.Raxen
|
||||||
author: unurled
|
author: unurled
|
||||||
api-version: 1.18
|
api-version: 1.18
|
||||||
depend: [ProtocolLib, PlaceholderAPI]
|
depend: [ProtocolLib, PlaceholderAPI, 'Multiverse-Core']
|
||||||
softdepend: [AureliumSkills, LuckPerms]
|
softdepend: [AureliumSkills, LuckPerms]
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
|
|
Loading…
Reference in a new issue