mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-28 03:09:14 +00:00
Allow MythicMob regenerating entities, Temporarily remove MiniMessage
This commit is contained in:
@@ -5,24 +5,34 @@ import org.bukkit.entity.EntityType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RegeneratingEntity {
|
||||
public final class RegeneratingEntity {
|
||||
|
||||
private final EntityType entityType;
|
||||
private final String entityType;
|
||||
private final List<Material> validSpawnSurfaces;
|
||||
private final int maxPerChunk;
|
||||
private final int rarity;
|
||||
private final boolean isMythicEntity;
|
||||
|
||||
public RegeneratingEntity(EntityType entityType, List<Material> validSpawnSurfaces, int maxPerChunk, int rarity) {
|
||||
public RegeneratingEntity(String entityType, List<Material> validSpawnSurfaces, int maxPerChunk, int rarity) {
|
||||
this.entityType = entityType;
|
||||
this.validSpawnSurfaces = validSpawnSurfaces;
|
||||
this.maxPerChunk = maxPerChunk;
|
||||
this.rarity = rarity;
|
||||
this.isMythicEntity = false;
|
||||
}
|
||||
|
||||
public EntityType getEntityType() {
|
||||
public RegeneratingEntity(EntityType entityType, List<Material> validSpawnSurfaces, int maxPerChunk, int rarity) {
|
||||
this(entityType.toString(), validSpawnSurfaces, maxPerChunk, rarity);
|
||||
}
|
||||
|
||||
public String getEntity() {
|
||||
return entityType;
|
||||
}
|
||||
|
||||
public boolean isMythicEntity() {
|
||||
return isMythicEntity;
|
||||
}
|
||||
|
||||
public List<Material> getValidSpawnSurfaces() {
|
||||
return validSpawnSurfaces;
|
||||
}
|
||||
|
||||
@@ -43,6 +43,11 @@ repositories {
|
||||
}
|
||||
|
||||
maven { url 'https://jitpack.io' }
|
||||
|
||||
// MythicMobs
|
||||
maven {
|
||||
url = 'https://mvn.lumine.io/repository/maven-public/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -52,6 +52,10 @@ repositories {
|
||||
|
||||
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/public/' }
|
||||
|
||||
// MythicMobs
|
||||
maven {
|
||||
url = 'https://mvn.lumine.io/repository/maven-public/'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -59,8 +63,8 @@ dependencies {
|
||||
testImplementation 'com.github.seeseemelk:MockBukkit-v1.15:0.3.0-SNAPSHOT'
|
||||
testImplementation 'org.reflections:reflections:0.9.12'
|
||||
|
||||
implementation 'net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT' // minimessage
|
||||
implementation 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' // minimessage
|
||||
//implementation 'net.kyori:adventure-text-minimessage:4.0.0-SNAPSHOT'
|
||||
//implementation 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT'
|
||||
implementation 'net.islandearth:languagy-api:2.0.2-SNAPSHOT' // languagy
|
||||
implementation 'co.aikar:acf-paper:0.5.0-SNAPSHOT' // commands
|
||||
implementation 'co.aikar:idb-core:1.0.0-SNAPSHOT' // database
|
||||
@@ -84,6 +88,7 @@ dependencies {
|
||||
compileOnly 'me.clip:placeholderapi:2.10.4' // PAPI
|
||||
compileOnly 'com.github.shynixn.headdatabase:hdb-api:1.0' // head database
|
||||
compileOnly 'com.djrapitops:Plan-api:5.1-R0.4' // plan
|
||||
compileOnly 'io.lumine.xikage:MythicMobs:4.9.1'
|
||||
compileOnly 'org.jetbrains:annotations:19.0.0'
|
||||
|
||||
compileOnly project(':api')
|
||||
|
||||
@@ -59,6 +59,12 @@ public final class RPGRegions extends JavaPlugin implements RPGRegionsAPI, Langu
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (translator != null) {
|
||||
getLogger().severe("RPGRegions does not support reloading. The plugin will now disable. Please use /rpgregions reload or restart your server instead.");
|
||||
Bukkit.getPluginManager().disablePlugin(this);
|
||||
return;
|
||||
}
|
||||
|
||||
plugin = this;
|
||||
this.createConfig();
|
||||
this.generateLang();
|
||||
@@ -178,6 +184,7 @@ public final class RPGRegions extends JavaPlugin implements RPGRegionsAPI, Langu
|
||||
config.addDefault("settings.server.gui.exit.exit", XMaterial.BARRIER.name());
|
||||
config.addDefault("settings.server.gui.outlinePane.outlinePane", XMaterial.GRAY_STAINED_GLASS_PANE.name());
|
||||
config.addDefault("settings.server.gui.innerPane.innerPane", XMaterial.WHITE_STAINED_GLASS_PANE.name());
|
||||
config.addDefault("settings.server.worlds.forceload", false);
|
||||
config.options().copyDefaults(true);
|
||||
saveConfig();
|
||||
}
|
||||
@@ -191,6 +198,7 @@ public final class RPGRegions extends JavaPlugin implements RPGRegionsAPI, Langu
|
||||
|
||||
private void registerCommands() {
|
||||
PaperCommandManager manager = new PaperCommandManager(this);
|
||||
manager.enableUnstableAPI("help");
|
||||
manager.getCommandCompletions().registerAsyncCompletion("regions", context -> ImmutableList.copyOf(getManagers().getRegionsCache().getConfiguredRegions().keySet()));
|
||||
manager.getCommandCompletions().registerAsyncCompletion("integration-regions", context -> ImmutableList.copyOf(this.getManagers().getIntegrationManager().getAllRegionNames(context.getPlayer().getWorld())));
|
||||
manager.getCommandCompletions().registerAsyncCompletion("schematics", context -> {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package net.islandearth.rpgregions.commands;
|
||||
|
||||
import co.aikar.commands.BaseCommand;
|
||||
import co.aikar.commands.CommandHelp;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
import co.aikar.commands.annotation.Default;
|
||||
import co.aikar.commands.annotation.HelpCommand;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.islandearth.rpgregions.api.integrations.IntegrationType;
|
||||
@@ -56,6 +58,12 @@ public class RPGRegionsCommand extends BaseCommand {
|
||||
+ " regions are loaded with " + rewards + " rewards.");
|
||||
}
|
||||
|
||||
@HelpCommand
|
||||
@Subcommand("help")
|
||||
public void onHelp(final CommandHelp commandHelp) {
|
||||
commandHelp.showHelp();
|
||||
}
|
||||
|
||||
@Subcommand("about")
|
||||
public void onAbout(CommandSender sender) {
|
||||
sender.sendMessage(StringUtils.colour("&eRPGRegions v" + plugin.getDescription().getVersion() + "."));
|
||||
|
||||
@@ -3,14 +3,10 @@ package net.islandearth.rpgregions.translation;
|
||||
import me.clip.placeholderapi.PlaceholderAPI;
|
||||
import net.islandearth.languagy.api.language.Language;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
@@ -63,22 +59,25 @@ public enum Translations {
|
||||
|
||||
public void send(Player player) {
|
||||
String message = RPGRegions.getAPI().getTranslator().getTranslationFor(player, this.getPath());
|
||||
Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
player.sendMessage(message);
|
||||
//Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
//BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
}
|
||||
|
||||
public void send(Player player, String... values) {
|
||||
String message = RPGRegions.getAPI().getTranslator().getTranslationFor(player, this.getPath());
|
||||
message = this.setPapi(player, replaceVariables(message, values));
|
||||
Component component = MiniMessage.markdown().parse(message);
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
player.sendMessage(message);
|
||||
//Component component = MiniMessage.markdown().parse(message);
|
||||
//BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
}
|
||||
|
||||
public void sendList(Player player) {
|
||||
List<String> messages = RPGRegions.getAPI().getTranslator().getTranslationListFor(player, this.getPath());
|
||||
messages.forEach(message -> {
|
||||
Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
//Component component = MiniMessage.markdown().parse(this.setPapi(player, message));
|
||||
//BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
player.sendMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,8 +85,9 @@ public enum Translations {
|
||||
List<String> messages = RPGRegions.getAPI().getTranslator().getTranslationListFor(player, this.getPath());
|
||||
messages.forEach(message -> {
|
||||
message = this.setPapi(player, replaceVariables(message, values));
|
||||
Component component = MiniMessage.markdown().parse(message);
|
||||
BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
//Component component = MiniMessage.markdown().parse(message);
|
||||
//BukkitAudiences.create(JavaPlugin.getPlugin(RPGRegions.class)).player(player).sendMessage(component);
|
||||
player.sendMessage(message);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldguard.WorldGuard;
|
||||
import com.sk89q.worldguard.protection.regions.ProtectedRegion;
|
||||
import io.lumine.xikage.mythicmobs.MythicMobs;
|
||||
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
|
||||
import net.islandearth.rpgregions.RPGRegions;
|
||||
import net.islandearth.rpgregions.api.integrations.IntegrationType;
|
||||
import net.islandearth.rpgregions.managers.data.region.ConfiguredRegion;
|
||||
@@ -23,6 +25,7 @@ import net.islandearth.rpgregions.regenerate.entity.RegeneratingEntity;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
@@ -101,15 +104,23 @@ public class RegenUtils {
|
||||
for (RegeneratingEntity regeneratingEntity : regenerate.getRegeneratingEntities()) {
|
||||
Block block = configuredRegion.getWorld().getBlockAt(x, y, z);
|
||||
Block blockUnder = configuredRegion.getWorld().getBlockAt(x, y - 1, z);
|
||||
if (!block.getType().toString().contains("AIR") && blockUnder.getType().toString().contains("PURPUR")) {
|
||||
if (regeneratingEntity.getValidSpawnSurfaces().contains(blockUnder.getType())) {
|
||||
int entityCount = 0;
|
||||
for (Entity entity : block.getChunk().getEntities()) {
|
||||
if (entity.getType() == regeneratingEntity.getEntityType()) entityCount++;
|
||||
if (regeneratingEntity.isMythicEntity()
|
||||
&& MythicMobs.inst().getMobManager().isActiveMob(io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitAdapter.adapt(entity))) entityCount++;
|
||||
else if (!regeneratingEntity.isMythicEntity()
|
||||
&& entity.getType() == EntityType.valueOf(regeneratingEntity.getEntity())) entityCount++;
|
||||
}
|
||||
|
||||
if (entityCount < regeneratingEntity.getMaxPerChunk()) {
|
||||
if (random.nextInt(regeneratingEntity.getRarity() - 1) == 1) {
|
||||
configuredRegion.getWorld().spawnEntity(block.getLocation(), regeneratingEntity.getEntityType());
|
||||
if (regeneratingEntity.isMythicEntity()) {
|
||||
MythicMob mythicMob = MythicMobs.inst().getMobManager().getMythicMob(regeneratingEntity.getEntity());
|
||||
mythicMob.spawn(io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitAdapter.adapt(block.getLocation()), 1);
|
||||
} else {
|
||||
configuredRegion.getWorld().spawnEntity(block.getLocation(), EntityType.valueOf(regeneratingEntity.getEntity()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ teleport: "&aClick to teleport"
|
||||
cannot_teleport: "&cWe can't teleport you because that world doesn't exist!"
|
||||
unknown_region: "Unknown Realm"
|
||||
exit: "&cExit"
|
||||
cannot_enter: "<red>You require %0 to enter this area.</red>"
|
||||
cannot_enter: "&cYou require %0 to enter this area."
|
||||
previous_page_lore:
|
||||
- "&fGo to the previous page"
|
||||
next_page_lore:
|
||||
|
||||
@@ -2,7 +2,7 @@ name: RPGRegions
|
||||
version: @version@
|
||||
main: net.islandearth.rpgregions.RPGRegions
|
||||
api-version: '1.13'
|
||||
softdepend: [Languagy, UltraRegions, WorldGuard, PlaceholderAPI, HeadDatabase, Residence, Plan, GriefPrevention, Vault]
|
||||
softdepend: [Languagy, UltraRegions, WorldGuard, PlaceholderAPI, HeadDatabase, Residence, Plan, GriefPrevention, Vault, MythicMobs]
|
||||
authors: [SamB440]
|
||||
description: Discoverable regions
|
||||
website: https://fortitude.islandearth.net
|
||||
|
||||
Reference in New Issue
Block a user