From 282130f0626541d0b2fe8883520517a2cb696423 Mon Sep 17 00:00:00 2001 From: Brianna Date: Mon, 5 Aug 2019 15:28:32 -0400 Subject: [PATCH] Fixes --- .gitlab-ci.yml | 2 +- .../com/songoda/epicenchants/enums/TriggerType.java | 3 +++ .../songoda/epicenchants/listeners/PlayerListener.java | 10 ++++++++-- .../songoda/epicenchants/objects/LeveledModifier.java | 3 ++- src/main/resources/enchants/simple/Lightning.yml | 4 ++-- src/main/resources/enchants/simple/Oxygenate.yml | 4 ++-- src/main/resources/enchants/unique/FeatherWeight.yml | 2 +- .../resources/enchants/unique/ObsidianDestroyer.yml | 4 ++-- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57374bb..e7942e2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ stages: variables: name: "EpicEnchants" path: "/builds/$CI_PROJECT_PATH" - version: "1_B3" + version: "1_B4" build: stage: build diff --git a/src/main/java/com/songoda/epicenchants/enums/TriggerType.java b/src/main/java/com/songoda/epicenchants/enums/TriggerType.java index 65de86f..e904bf5 100644 --- a/src/main/java/com/songoda/epicenchants/enums/TriggerType.java +++ b/src/main/java/com/songoda/epicenchants/enums/TriggerType.java @@ -27,6 +27,9 @@ public enum TriggerType { BLOCK_BREAK, EXPERIENCE_BLOCK_BREAK, + + RIGHT_CLICK_BLOCK, + LEFT_CLICK_BLOCK, REPEATING, //TODO: Figure out what this is. RIGHT_CLICK, LEFT_CLICK diff --git a/src/main/java/com/songoda/epicenchants/listeners/PlayerListener.java b/src/main/java/com/songoda/epicenchants/listeners/PlayerListener.java index d0e570a..4391609 100644 --- a/src/main/java/com/songoda/epicenchants/listeners/PlayerListener.java +++ b/src/main/java/com/songoda/epicenchants/listeners/PlayerListener.java @@ -57,11 +57,17 @@ public class PlayerListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST) public void onPlayerInteract(PlayerInteractEvent event) { - if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) { + if (event.getAction() == Action.RIGHT_CLICK_AIR) { instance.getEnchantUtils().handlePlayer(event.getPlayer(), null, event, RIGHT_CLICK); - } else if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) { + } else if (event.getAction() == Action.LEFT_CLICK_AIR) { instance.getEnchantUtils().handlePlayer(event.getPlayer(), null, event, LEFT_CLICK); } + if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { + instance.getEnchantUtils().handlePlayer(event.getPlayer(), null, event, RIGHT_CLICK_BLOCK); + } else if (event.getAction() == Action.LEFT_CLICK_BLOCK) { + instance.getEnchantUtils().handlePlayer(event.getPlayer(), null, event, LEFT_CLICK_BLOCK); + + } } @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST) diff --git a/src/main/java/com/songoda/epicenchants/objects/LeveledModifier.java b/src/main/java/com/songoda/epicenchants/objects/LeveledModifier.java index 4901dfd..79f401b 100644 --- a/src/main/java/com/songoda/epicenchants/objects/LeveledModifier.java +++ b/src/main/java/com/songoda/epicenchants/objects/LeveledModifier.java @@ -27,6 +27,7 @@ public class LeveledModifier { String toTest = Placeholders.setPlaceholders(string, user, opponent, level); - return (double) (int) GeneralUtils.parseJS(toTest, "LeveledModifier", def); + Object value = GeneralUtils.parseJS(toTest, "LeveledModifier", def); + return value instanceof Double ? (double)value : (int)value; } } diff --git a/src/main/resources/enchants/simple/Lightning.yml b/src/main/resources/enchants/simple/Lightning.yml index ec61fa1..db495af 100644 --- a/src/main/resources/enchants/simple/Lightning.yml +++ b/src/main/resources/enchants/simple/Lightning.yml @@ -7,7 +7,7 @@ max-level: 3 # The group of this enchant. Configure the groups in the groups.yml file. group: SIMPLE -#Description +# Description description: - "A chance to strike lightning" - "at your opponents location." @@ -22,6 +22,6 @@ effects: # Chance that this will happen chance: "5 * {level}" # The trigger that will fire this effect - trigger: ATTACK_PLAYER_MELEE + trigger: ATTACK_PLAYER_RANGE # What player should the effect be ran on: USER/OPPONENT. who: OPPONENT \ No newline at end of file diff --git a/src/main/resources/enchants/simple/Oxygenate.yml b/src/main/resources/enchants/simple/Oxygenate.yml index fe44621..49735f9 100644 --- a/src/main/resources/enchants/simple/Oxygenate.yml +++ b/src/main/resources/enchants/simple/Oxygenate.yml @@ -7,7 +7,7 @@ max-level: 1 # The group of this enchant. Configure the groups in the groups.yml file. group: SIMPLE -#Description +# Description description: - "A chance to refill your oxygen" - "levels when breaking blocks." @@ -18,7 +18,7 @@ item-whitelist: # For a full list of effects, please visit: https://wiki.songoda.com/display/SON/EpicEnchants effects: - MODIFY_OXYGEN: + POTION: # The trigger that will fire this effect trigger: BLOCK_BREAK # Potion Effect that should be applied. diff --git a/src/main/resources/enchants/unique/FeatherWeight.yml b/src/main/resources/enchants/unique/FeatherWeight.yml index 5ae0391..ec3a1a7 100644 --- a/src/main/resources/enchants/unique/FeatherWeight.yml +++ b/src/main/resources/enchants/unique/FeatherWeight.yml @@ -1,5 +1,5 @@ # The enchant identifier must be unique. -identifier: Featherweight +identifier: FeatherWeight # The max level for this enchant. max-level: 3 diff --git a/src/main/resources/enchants/unique/ObsidianDestroyer.yml b/src/main/resources/enchants/unique/ObsidianDestroyer.yml index 6c8476a..0e55c22 100644 --- a/src/main/resources/enchants/unique/ObsidianDestroyer.yml +++ b/src/main/resources/enchants/unique/ObsidianDestroyer.yml @@ -19,11 +19,11 @@ item-whitelist: effects: MODIFY_BLOCK: # The trigger that will fire this effect - trigger: LEFT_CLICK + trigger: LEFT_CLICK_BLOCK # Chance that this will happen chance: "10 * {level}" # Check if clicked block is obsidian - condition: "{clicked_block} === 'OBSIDIAN'" + condition: "{block_type} === 'OBSIDIAN'" # Set the block to air material: AIR \ No newline at end of file