Skip to content

Commit

Permalink
v3.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
getplusm committed Apr 11, 2024
1 parent 608a496 commit 0e72069
Show file tree
Hide file tree
Showing 114 changed files with 2,932 additions and 2,587 deletions.
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
plugins {
id 'java'
id "com.github.johnrengelman.shadow" version "7.1.2"
}

group = 'plazmer'
version = '2.1.2'
version = '3.0.0'

repositories {
mavenCentral()
Expand Down Expand Up @@ -70,7 +69,7 @@ dependencies {
compileOnly group: 'com.griefdefender', name: 'api', version: '2.1.0-SNAPSHOT'
compileOnly 'com.sk89q.worldguard:worldguard-bukkit:7.0.2-SNAPSHOT'
compileOnly 'com.github.cryptomorin:kingdoms:1.16.8.1.1'
compileOnly 'com.github.getplusm:ProtectionBlocks:1.0.6R1'
compileOnly 'com.github.getplusm:ProtectionBlocks:1.0.7'

compileOnly 'com.github.TechFortress:GriefPrevention:16.18'
compileOnly 'com.github.angeschossen:LandsAPI:6.33.10'
Expand All @@ -92,7 +91,12 @@ dependencies {
// Vault
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'

// Engine
compileOnly 'com.github.getplusm:Engine:2.4.4'

// Libs
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
}

def targetJavaVersion = 17
Expand All @@ -119,11 +123,7 @@ processResources {
expand props
}
}
shadowJar {
archivesBaseName = "TheDungeons"
jar{
archiveClassifier.set ""
destinationDirectory.set(rootProject.buildDir)
}
assemble.dependsOn(shadowJar)
// you can change broadcast settings in editor
// all dungeons messages send only for world players
}
18 changes: 15 additions & 3 deletions src/main/java/t/me/p1azmer/plugin/dungeons/DungeonAPI.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
package t.me.p1azmer.plugin.dungeons;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import t.me.p1azmer.plugin.dungeons.dungeon.DungeonManager;
import t.me.p1azmer.plugin.dungeons.dungeon.impl.Dungeon;
import t.me.p1azmer.plugin.dungeons.dungeon.modules.AbstractModule;
import t.me.p1azmer.plugin.dungeons.dungeon.modules.ModuleManager;

public class DungeonAPI {
import java.util.Optional;

public class DungeonAPI {
public static final DungeonPlugin PLUGIN = DungeonPlugin.getPlugin(DungeonPlugin.class);


@NotNull
public static DungeonManager getDungeonManager(){
return PLUGIN.getDungeonManager();
}

@NotNull
public static ModuleManager getDungeonModule(@NotNull Dungeon dungeon){
public static ModuleManager getModuleManager(@NotNull Dungeon dungeon){
return dungeon.getModuleManager();
}

public static Optional<AbstractModule> getModule(@NotNull Dungeon dungeon, @NotNull String name){
ModuleManager moduleManager = getModuleManager(dungeon);
return Optional.ofNullable(moduleManager.getModule(name));
}

public static <C extends AbstractModule> Optional<C> getModule(@NotNull Dungeon dungeon, @NotNull Class<C> clazz){
ModuleManager moduleManager = getModuleManager(dungeon);
return moduleManager.getModule(clazz);
}
}
68 changes: 17 additions & 51 deletions src/main/java/t/me/p1azmer/plugin/dungeons/DungeonPlugin.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
package t.me.p1azmer.plugin.dungeons;

import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import t.me.p1azmer.engine.NexPlugin;
import t.me.p1azmer.engine.api.command.GeneralCommand;
import t.me.p1azmer.engine.command.list.ReloadSubCommand;
import t.me.p1azmer.engine.utils.EngineUtils;
import t.me.p1azmer.plugin.dungeons.announce.AnnounceManager;
import t.me.p1azmer.plugin.dungeons.api.hologram.HologramHandler;
import t.me.p1azmer.plugin.dungeons.api.party.PartyHandler;
import t.me.p1azmer.plugin.dungeons.api.region.RegionHandler;
import t.me.p1azmer.plugin.dungeons.api.schematic.SchematicHandler;
import t.me.p1azmer.plugin.dungeons.api.handler.hologram.HologramHandler;
import t.me.p1azmer.plugin.dungeons.api.handler.party.PartyHandler;
import t.me.p1azmer.plugin.dungeons.api.handler.region.RegionHandler;
import t.me.p1azmer.plugin.dungeons.api.handler.schematic.SchematicHandler;
import t.me.p1azmer.plugin.dungeons.commands.EditorCommand;
import t.me.p1azmer.plugin.dungeons.commands.dungeon.DeleteCommand;
import t.me.p1azmer.plugin.dungeons.commands.dungeon.SpawnCommand;
import t.me.p1azmer.plugin.dungeons.commands.key.KeyCommand;
import t.me.p1azmer.plugin.dungeons.config.Config;
import t.me.p1azmer.plugin.dungeons.dungeon.DungeonManager;
import t.me.p1azmer.plugin.dungeons.dungeon.chest.DungeonChestState;
import t.me.p1azmer.plugin.dungeons.dungeon.chest.state.ChestState;
import t.me.p1azmer.plugin.dungeons.dungeon.generation.GenerationType;
import t.me.p1azmer.plugin.dungeons.dungeon.stage.DungeonStage;
import t.me.p1azmer.plugin.dungeons.dungeon.stage.StageLang;
import t.me.p1azmer.plugin.dungeons.editor.EditorLocales;
import t.me.p1azmer.plugin.dungeons.editor.EditorMainMenu;
import t.me.p1azmer.plugin.dungeons.integration.holograms.HologramDecentHandler;
Expand All @@ -33,6 +36,7 @@
import t.me.p1azmer.plugin.dungeons.placeholders.DungeonPlaceholder;
import t.me.p1azmer.plugin.dungeons.utils.SessionConsole;

@Getter
public final class DungeonPlugin extends NexPlugin<DungeonPlugin> {
private DungeonManager dungeonManager;
private KeyManager keyManager;
Expand All @@ -41,6 +45,7 @@ public final class DungeonPlugin extends NexPlugin<DungeonPlugin> {

private EditorMainMenu editor;
private SessionConsole sessionConsole;

private HologramHandler hologramHandler;
private SchematicHandler schematicHandler;
private RegionHandler regionHandler;
Expand Down Expand Up @@ -122,15 +127,21 @@ public void loadConfig() {
@Override
public void loadLang() {
this.getLangManager().loadMissing(Lang.class);
this.getLangManager().loadMissing(StageLang.class);
this.getLangManager().loadEditor(EditorLocales.class);
this.getLangManager().loadEnum(MobStyleType.class);
this.getLangManager().loadEnum(DungeonStage.class);
this.getLangManager().loadEnum(DungeonChestState.class);
this.getLangManager().loadEnum(ChestState.class);
this.getLangManager().loadEnum(GenerationType.class);
this.getLang().saveChanges();
}

@Override
public void registerHooks() {
initialIntegrations();
}

private void initialIntegrations() {
if (EngineUtils.hasPlugin("HolographicDisplays")) {
this.hologramHandler = new HologramDisplaysHandler(this);
this.hologramHandler.setup();
Expand Down Expand Up @@ -195,26 +206,6 @@ public void registerPermissions() {
this.registerPermissions(Perms.class);
}

@NotNull
public DungeonManager getDungeonManager() {
return dungeonManager;
}

@NotNull
public KeyManager getKeyManager() {
return keyManager;
}

@NotNull
public MobManager getMobManager() {
return mobManager;
}

@NotNull
public AnnounceManager getAnnounceManager() {
return announceManager;
}

@NotNull
public EditorMainMenu getEditor() {
if (this.editor == null) {
Expand All @@ -223,31 +214,6 @@ public EditorMainMenu getEditor() {
return this.editor;
}

@NotNull
public SessionConsole getSessionConsole() {
return sessionConsole;
}

@Nullable
public HologramHandler getHologramHandler() {
return hologramHandler;
}

@Nullable
public SchematicHandler getSchematicHandler() {
return schematicHandler;
}

@Nullable
public RegionHandler getRegionHandler() {
return regionHandler;
}

@Nullable
public PartyHandler getPartyHandler() {
return partyHandler;
}

public void sendDebug(@NotNull String text) {
if (Config.DEBUG.get()) this.debug(text);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/t/me/p1azmer/plugin/dungeons/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ public class Keys {

public static final NamespacedKey ENTITY_MOB_ID = new NamespacedKey(DungeonAPI.PLUGIN, "entity.mob_id");
public static final NamespacedKey ENTITY_MOB_LEVEL = new NamespacedKey(DungeonAPI.PLUGIN, "entity.mob_level");
public static final NamespacedKey ENTITY_MOB_DUNGEON_ID = new NamespacedKey(DungeonAPI.PLUGIN, "entity.dungeon_id");
}
52 changes: 41 additions & 11 deletions src/main/java/t/me/p1azmer/plugin/dungeons/Perms.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,50 @@
import t.me.p1azmer.engine.api.server.JPermission;

public class Perms {
private static final String PREFIX = "dungeons.";
private static final String PREFIX = "dungeons.";
private static final String PREFIX_COMMAND = PREFIX + "command.";

public static final JPermission PLUGIN = new JPermission(PREFIX + Placeholders.WILDCARD, "Access to all the plugin functions.");
public static final JPermission COMMAND = new JPermission(PREFIX_COMMAND + Placeholders.WILDCARD, "Access to all the plugin commands.");
public static final JPermission PLUGIN = new JPermission(
PREFIX + Placeholders.WILDCARD,
"Access to all the plugin functions."
);
public static final JPermission COMMAND = new JPermission(
PREFIX_COMMAND + Placeholders.WILDCARD,
"Access to all the plugin commands."
);

public static final JPermission COMMAND_RELOAD = new JPermission(PREFIX_COMMAND + "reload", "Access to the 'reload' sub-command.");
public static final JPermission COMMAND_EDITOR = new JPermission(PREFIX_COMMAND + "editor", "Access to the 'editor' sub-command.");
public static final JPermission COMMAND_DROP = new JPermission(PREFIX_COMMAND + "drop", "Access to the 'drop' sub-command.");
public static final JPermission COMMAND_DESPAWN = new JPermission(PREFIX_COMMAND + "despawn", "Access to the 'despawn' sub-command.");
public static final JPermission COMMAND_KEY = new JPermission(PREFIX_COMMAND + "key", "Access to the 'key' sub-command (without sub-commands).");
public static final JPermission COMMAND_KEY_GIVE = new JPermission(PREFIX_COMMAND + "key.give", "Access to the 'key give' command.");
public static final JPermission COMMAND_KEY_TAKE = new JPermission(PREFIX_COMMAND + "key.take", "Access to the 'key take' command.");
public static final JPermission COMMAND_KEY_SET = new JPermission(PREFIX_COMMAND + "key.set", "Access to the 'key set' command.");
public static final JPermission COMMAND_RELOAD = new JPermission(
PREFIX_COMMAND + "reload",
"Access to the 'reload' sub-command."
);
public static final JPermission COMMAND_EDITOR = new JPermission(
PREFIX_COMMAND + "editor",
"Access to the 'editor' sub-command."
);
public static final JPermission COMMAND_DROP = new JPermission(
PREFIX_COMMAND + "drop",
"Access to the 'drop' sub-command."
);
public static final JPermission COMMAND_DESPAWN = new JPermission(
PREFIX_COMMAND + "despawn",
"Access to the 'despawn' sub-command."
);
public static final JPermission COMMAND_KEY = new JPermission(
PREFIX_COMMAND + "key",
"Access to the 'key' sub-command (without sub-commands)."
);
public static final JPermission COMMAND_KEY_GIVE = new JPermission(
PREFIX_COMMAND + "key.give",
"Access to the 'key give' command."
);
public static final JPermission COMMAND_KEY_TAKE = new JPermission(
PREFIX_COMMAND + "key.take",
"Access to the 'key take' command."
);
public static final JPermission COMMAND_KEY_SET = new JPermission(
PREFIX_COMMAND + "key.set",
"Access to the 'key set' command."
);

static {
PLUGIN.addChildren(COMMAND);
Expand Down
105 changes: 0 additions & 105 deletions src/main/java/t/me/p1azmer/plugin/dungeons/Placeholders.java
Original file line number Diff line number Diff line change
@@ -1,110 +1,5 @@
package t.me.p1azmer.plugin.dungeons;

import t.me.p1azmer.plugin.dungeons.dungeon.chest.DungeonChestState;

import java.util.function.Function;

public class Placeholders extends t.me.p1azmer.engine.utils.Placeholders {

public static final String GENERIC_AMOUNT = "%amount%";
public static final String GENERIC_TIME = "%time%";
public static final String GENERIC_HANDLER = "%handler%";

public static final String DUNGEON_NAME = "%dungeon_name%";
public static final String DUNGEON_ID = "%dungeon_id%";
public static final String DUNGEON_WORLD = "%dungeon_world%";
public static final String DUNGEON_KEY_IDS = "%dungeon_key_ids%";
public static final String DUNGEON_KEY_NAMES = "%dungeon_key_names%";
public static final String DUNGEON_NEXT_STAGE_IN = "%dungeon_next_stage_in%";
public static final String EDITOR_HOLOGRAM_TEXT = "%dungeon_editor_hologram_text%";
public static final Function<DungeonChestState, String> DUNGEON_HOLOGRAM_MESSAGES = var -> "%dungeon_hologram_" + var + "_messages%";
public static final String DUNGEON_HOLOGRAM_CHEST_OFFSET_Y = "%dungeon_hologram_chest_offset_y%";

// schematics
public static final String SCHEMATICS_LIST = "%schematics_list%";
public static final String SCHEMATICS_IGNORE_AIR = "%schematics_ignore_air%";
public static final String SCHEMATICS_UNDERGROUND = "%schematics_underground%";

// settings
public static final String DUNGEON_SETTINGS_ENABLED = "%dungeon_enabled%";
public static final String DUNGEON_SETTINGS_MINIMAL_ONLINE = "%dungeon_minimal_online%";
public static final String DUNGEON_SETTINGS_CLICK_TIMER = "%dungeon_click_timer%";
public static final String DUNGEON_SETTINGS_BIG_CHEST = "%dungeon_big_chest%";
public static final String DUNGEON_SETTINGS_CHEST_BLOCK_LIMIT = "%dungeon_chest_block_limit%";
public static final String DUNGEON_SETTINGS_SEPARATE_CHEST_BLOCK = "%dungeon_separate_chest_block_gui%";
public static final String DUNGEON_SETTINGS_RANDOM_SLOTS = "%dungeon_random_slots%";
public static final String DUNGEON_SETTINGS_OPEN_TYPE = "%dungeon_open_type%";
public static final String DUNGEON_SETTINGS_CHEST_MATERIAL = "%dungeon_chest_block%";
public static final String DUNGEON_SETTINGS_LET_PLAYERS_WHEN_CLOSE = "%dungeon_let_players_when_close%";
public static final String DUNGEON_SETTINGS_USE_ONE_KEY_FOR_CHEST = "%dungeon_use_one_key_for_chest%";
public static final String DUNGEON_SETTINGS_MOBS = "%dungeon_settings_mobs%";

// chest states
public static final Function<DungeonChestState, String> DUNGEON_CHEST_STATE_TIME = var -> "%dungeon_chest_state_" + var + "_time%";
public static final String DUNGEON_CHEST_STATE_NAME = "%dungeon_state_name%";
public static final String DUNGEON_CHEST_NEXT_STATE_IN = "%dungeon_chest_next_state_in%";
public static final String EDITOR_STATE_TIME = "%dungeon_editor_state_time%";

// modules
public static final String MODULE_ID = "%module_id%";
public static final String EDITOR_MODULE_ENABLED = "%editor_module_enabled%";

// stages
public static final String EDITOR_STAGE_COMMANDS = "%dungeon_editor_stage_commands%";
public static final String EDITOR_STAGE_ANNOUNCES = "%dungeon_editor_stage_announces%";
public static final String EDITOR_STAGE_TIME = "%dungeon_editor_stage_time%";
public static final String EDITOR_STAGE_NAME = "%dungeon_editor_stage_name%";

// key
public static final String KEY_ID = "%key_id%";
public static final String KEY_NAME = "%key_name%";
public static final String KEY_ITEM_NAME = "%key_item_name%";


// reward
public static final String REWARD_ID = "%reward_id%";
public static final String REWARD_CHANCE = "%reward_chance%";
public static final String REWARD_MAX_AMOUNT = "%reward_amount_max%";
public static final String REWARD_MIN_AMOUNT = "%reward_amount_min%";
public static final String REWARD_LIMIT_MAX = "%reward_limit_max%";
public static final String REWARD_LIMIT_MIN = "%reward_limit_min%";
public static final String REWARD_COMMANDS = "%reward_commands%";


// region
public static final String REGION_ENABLED = "%region_enabled%";
public static final String REGION_NAME = "%region_name%";
public static final String REGION_RADIUS = "%region_radius%";
public static final String REGION_FLAGS = "%region_flags%";


// effect
public static final String EFFECT_NAME = "%effect_name%";
public static final String EFFECT_DURATION = "%effect_duration%";
public static final String EFFECT_AMPLIFIER = "%effect_amplifier%";

// mobs
public static final String MOB_ID = "%mob_id%";
public static final String MOB_NAME = "%mob_name%";
public static final String MOB_NAME_VISIBLE = "%mob_name_visible%";
public static final String MOB_ENTITY_TYPE = "%mob_entity_type%";
public static final String MOB_ATTRIBUTES_BASE = "%mob_attributes_base%";
public static final String MOB_SPAWN_CHANCE = "%mob_spawn_chance%";
public static final String MOB_ENABLED_SPAWN = "%mob_spawn_enabled%";
public static final String MOB_SILENT = "%mob_silent%";
public static final String MOB_RIDER_ID = "%mob_rider_id%";

public static final String MOB_POTION_EFFECT_VALUE = "%mob_potion_effect_value%";
public static final String MOB_POTION_EFFECT_DURATION = "%mob_potion_effect_duration%";
public static final String MOB_STYLE_TYPE = "%mob_style_type%";
public static final String MOB_STYLE_VALUE = "%mob_style_value%";

// party
public static final String PARTY_ENABLED = "%party_enabled%";
public static final String PARTY_SIZE = "%party_size%";

// announce
public static final String ANNOUNCE_ID = "%announce_id%";
public static final String ANNOUNCE_MESSAGES = "%announce_messages%";
public static final String ANNOUNCE_GLOBAL = "%announce_global%";
}
Loading

0 comments on commit 0e72069

Please sign in to comment.