imDMK / DoubleJump

✨️ Efficient double jump plugin with many features and configuration possibilities.
https://www.spigotmc.org/resources/doublejump-1-17-1-20-1.110632/
GNU General Public License v3.0
13 stars 3 forks source link

CMI incompatibility with /flyc command #40

Open bobhenl opened 6 months ago

bobhenl commented 6 months ago

Describe the bug Hi, does double jump need to work with fly? As now when players double jump on spawn and they have bought flying in CMI using /recharge (for XP or money) and then used /flyc, then when they use double jump it cost them the recharged fly.

Aka Double jumping when /flyc is enabled uses the energy up when you jump

How do you trigger it? Use CMI plugin, and recharge fly using /recharge, then use /flyc, and then when you fly it costs you energy. Then try to jump and it costs you energy as well

Server version [17:26:29 INFO]: Current: git-Purpur-2165 (MC: 1.20.4)* Previous: git-Purpur-2159 (MC: 1.20.4)

Plugin version [17:26:49 INFO]: DoubleJump version 2.1.4

Plugin configuration

#
# Configuration file for the DoubleJump plugin.
#
# If you have a problem with plugin configuration, please create an issue on the project's github.
# However, if you like the plugin, leave a star for the project on GitHub.
# 
# Support site: https://github.com/imDMK/DoubleJump/issues/new/choose
# GitHub: https://github.com/imDMK/DoubleJump
#
# Specifies whether to check for a new plug-in version when the administrator joins the server
# I highly recommend enabling this option
checkForUpdate: true
# Double jump use permission
doubleJumpUsePermission: doublejump.use
# 
# Command settings
# 
commandSettings:
  # Specifies whether "/doublejump" command should be enabled
  doubleJumpEnabled: true
# 
# Jump settings
# 
jumpSettings:
  # Specifies whether to enable double jump mode for the player when he joins the server
  # NOTE: The player must have double jump permission
  enableJumpModeOnJoinForPlayers: true
  # Specifies whether to enable double jump mode for the administrator when he joins the server
  # NOTE: The player must have double jump permission and OP
  enableJumpModeOnJoinForAdmins: true
  # Whether double jump fall damage is enabled or not
  jumpFallDamageEnabled: true
  # Jump multiplier
  jumpMultiple: 1.3
  # The value of how much up the jump is to be made
  jumpUp: 0.6
  #
  # Jump sound settings
  #
  soundSettings:
    # Specifies whether to enable double jump sound
    enabled: false
    # Specifies whether nearby players should hear the jump sound
    playNearbyEnabled: true
    # Specifies the distance in X coordinates at which the jump sound should be played
    playNearbyX: 5.0
    # Specifies the distance in Y coordinates at which the jump sound should be played
    playNearbyY: 5.0
    # Specifies the distance in Z coordinates at which the jump sound should be played
    playNearbyZ: 5.0
    # List of available sounds: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Sound.html
    sounds:
    - sound: ENTITY_EXPERIENCE_BOTTLE_THROW
      volume: 0.2
      pitch: 1.0
    - sound: ENTITY_EXPERIENCE_ORB_PICKUP
      volume: 0.15
      pitch: 1.0
  #
  # Jump particle settings
  #
  particleSettings:
    # Specifies whether particles during a double jump are to be enabled
    enabled: true
    # List of particles during a double jump
    # Available particles: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Particle.html
    # Available colors: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/Color.html
    particles:
    - particle: NOTE
      color: WHITE
      size: 20
      count: 3
      offsetX: 2.0
      offsetY: 0.0
      offsetZ: 0.0
      extra: 0.0
    - particle: REDSTONE
      color: WHITE
      size: 40
      count: 3
      offsetX: 2.0
      offsetY: 0.0
      offsetZ: 0.0
      extra: 0.0
  #
  # Jump restrictions settings
  #
  restrictionSettings:
    # Restriction of regions where the player will not be able to double-jump
    # The WorldGuard plugin is required for this feature to work
    regionRestriction:
      type: WHITELIST
      list:
      - spawn
    # Restriction of worlds where the player will not be able to double-jump
    worldRestriction:
      type: BLACKLIST
      list:
      - example-world
    # The restriction of the game modes during which the player will not be able to double-jump
    gameModeRestriction:
      type: BLACKLIST
      list:
      - CREATIVE
      - SPECTATOR
    #
    # Jump restriction notification settings
    #
    notificationSettings:
      jumpDisabledRegion: "CHAT: "
      jumpDisabledGameMode: "CHAT: <red>You cannot use double jump on this game mode"
      jumpDisabledWorld: "CHAT: <red>You cannot use double jump in this world"
      targetInDisabledRegion: "CHAT: <red>The player is in disabled region"
      targetHasDisabledGameMode: "CHAT: <red>The player has a game mode that is disabled"
      targetInDisabledWorld: "CHAT: <red>The player is in disabled world"
  #
  # Jump item settings
  #
  itemSettings:
    # Specifies whether the item should be enabled
    enabled: false
    # Cancel jump item repair in anvil?
    # If you allow it, the player will be able to repair the item, but will not be able to rename it (renaming will make the item inoperable)
    cancelRepair: false
    # Cancel enchant jump item in enchanting?
    # If you disable this option, the plugin will start ignoring enchantments on items when checking if a player has a jump item
    cancelEnchant: true
    # Jump item
    item:
      material: DIAMOND_BOOTS
      item-meta:
        display-name: "<red>DOUBLE JUMP"
        lore:
        - ""
        - "<red>This is double jump item!"
        - ""
        enchantments:
          unbreaking: 10
        item-flags:
        - HIDE_ATTRIBUTES
    # 
    # Jump item usage settings
    # 
    usageSettings:
      # This specifies the use of a double jump
      # Available usages:
      # HAVE_ITEM - The player must have the jump item in inventory
      # HOLD_ITEM - The player must hold the jump item
      # CLICK_ITEM - The player must right click item
      # WEAR_ITEM - The player must wear item
      usage: CLICK_ITEM
      # Specifies whether to cancel the use of the item
      cancel: false
      # Specifies whether to remove an item after using it
      delete: false
      # Specifies whether to reduce the durability of an item after using it
      # Example: 
      # reduceDurability: 5
      # The durability of the item will be reduced by 5
      # To disable, set the value to 0
      reduceDurability: 0
      # Specifies whether to double jump after using a jump item
      doubleJump: false
      # Specifies whether to cancel double jump mode after using a jump item
      disableDoubleJumpMode: false
      # Specifies whether to toggle double jump mode after using a jump item
      switchDoubleJumpMode: false
    # 
    # Jump item drop settings
    # 
    dropSettings:
      # Specifies whether to cancel the item drop
      cancel: false
      # Specifies whether to remove the item after dropping it
      delete: false
      # Specifies whether to cancel double jump mode after dropping an item
      disableDoubleJumpMode: false
    #
    # Jump item notification settings
    #
    notificationSettings:
      jumpItemDisabled: "CHAT: <red>The jump item is disabled"
      # {PLAYER} - The name of the player for whom the jump item was added
      jumpItemAdded: "CHAT: <green>Added a jump item to player {PLAYER}"
      # {PLAYER} - The name of the player for whom the jump item was removed
      jumpItemRemoved: "CHAT: <green>Removed a jump item from player {PLAYER} inventory and ender chest"
      targetHasNoJumpItem: "CHAT: <red>The player has no jump item in inventory and ender chest"
      targetHasFullInventory: "CHAT: <red>The player has a full inventory"
  # 
  # Jump streak settings
  # 
  streakSettings:
    # Specifies whether to enable double jump series reset
    enabled: true
    # Specifies whether the jump streak will be reset when the player touches the ground
    resetOnGround: false
    # Specifies whether the jump streak will be reset when the player dies
    resetOnDeath: true
    # 
    # Jump streak notification settings
    # 
    notificationSettings:
      # {STREAK} - New number of jump streak
      jumpStreakIncreased: "ACTIONBAR: <green>Yeah! Current streak: <dark_green>{STREAK}"
      jumpStreakHasBeenReset: "CHAT: <red>Ops! Your jump streak has been reset"
  # 
  # Jump delay settings
  # 
  delaySettings:
    # Specifies whether double jump delay should be enabled
    enabled: true
    # Specifies the double jump delay
    # Example value: 1s, 5s, 1m
    delay: 1s
  #
  # Jump limit settings
  #
  limitSettings:
    # Specifies whether the jump limit should be enabled
    enabled: false
    # The default value of the jump limit is if the player does not have permissions listed in limitsByPermission
    limit: 1
    # Jump limits by permissions
    # Example:
    # <PERMISSION: double-jump>: <LIMIT: 2>
    # If a player has the "double-jump" permission, he will be assigned a jump limit of 2
    # If not, he will be assigned a default jump limit value
    limitsByPermissions:
      double-jump: 2
      five-jump: 5
      triple-jump: 3
    # Specifies the delay after which one jump is to be renewed for the player
    # If you want to disable jump regeneration, set the value to 0s
    regenerationDelay: 3s
    #
    # Jump limit notification settings
    #
    notificationSettings:
      jumpLimit: "CHAT: <red>You have no more jumps"
      jumpLimitReceived: "CHAT: <green>You received one jump"
      # {TIME} - Time left until get one double jump
      jumpLimitRegenerationDelay: "CHAT: <red>You must wait {TIME} to get next jump"
  #
  # Jump notification settings
  #
  notificationSettings:
    # {TIME} - Time remaining until double jump can be used
    jumpDelay: "CHAT: <red>You must wait {TIME} before next double jump"
    jumpModeEnabled: "CHAT: <green>Enabled double jump mode!"
    jumpModeDisabled: "CHAT: <red>Disabled double jump mode!"
    # {PLAYER} - The name of the player for whom double jump mode has been enabled
    jumpModeEnabledFor: "CHAT: <green>Enabled double jump mode for player {PLAYER}"
    # {PLAYER} - The name of the player for whom double jump mode has been disabled
    jumpModeDisabledFor: "CHAT: <red>Disabled double jump mode for player {PLAYER}"
# 
# Notification settings
# 
notificationSettings:
  playerNotFound: "CHAT: <red>No player found with the given name"
  # {PERMISSIONS} - Required permissions to use the command
  missingPermissions: "CHAT: <red>Missing permissions: <dark_red>{PERMISSIONS}"
  # {USAGE} - Correct use of the command
  invalidUsage: "CHAT: <red>Invalid usage: <dark_red>{USAGE}"
  # Used when there is more than one option for using a command
  invalidUsageListFirst: "CHAT: <red>Invalid usage:"
  # {USAGE} - Correct use of the command
  # Used when there is more than one option for using a command
  invalidUsageList: "CHAT: <dark_gray>- <red>{USAGE}"
# 
# Placeholder settings
# 
placeholderSettings:
  # Message shown after using the placeholder if it returns true.
  # Example:
  # whenTrueMessage: 'Available'
  # Placeholder 'jump-player-is-delay' will return 'Available' when player doesn't have delay
  whenTrueMessage: 'yes'
  # Message shown after using the placeholder if it returns false.
  # Example:
  # whenFalseMessage: 'Cooldown'
  # Placeholder 'jump-player-is-delay' will return 'Cooldown' when player have delay
  whenFalseMessage: 'no'

Possible solution: may you add a way to trigger command when a player jumps so we can disable their flyc mode This would be probably the best solution so you won't need to hook into the cmi to fix it

imDMK commented 6 months ago

Hello, Thanks for the issue.

Yes, it is required that double-jump work with a fly. Currently, this is the only way to make a double jump in Minecraft.

How would the solution work, because I don't fully understand? When the player uses double jump, does the plugin execute the command for him?

Regards.

bobhenl commented 6 months ago

when you fly, it costs you energy that you recharge (in CMI), and when players jump, it cost them energy too due to this. So maybe if we can add commands on jump that could be set in config, we can disable their fly recharge mode so it won't cost them energy.

So like if you can add: commandsOnJump or something could help image

imDMK commented 6 months ago

I think this is not a very good solution (performance). The only good solution is to use double jump API. More information about its implementation can be found on the project's main page.

bobhenl commented 6 months ago

Wouldn't it be the same as spawning particle or making sound on doublejump?

Or maybe the command on strikes? Like when it's 1st strike, we could add own commands, etc... then I could add this there

imDMK commented 6 months ago

Ok, there will be an update with what you propose in the next few days. It will work on the principle that when the player uses a double jump, according to the configuration, the plugin will execute this command for him. Do I understand your suggestion correctly? Let me know.

bobhenl commented 6 months ago

Yes, may if you want you can implement it for strikes, as well, like we can set various commands for various strikes, and give player rewards, for example when they strike is 25, we could execute some cmd and give them reward.

But yeah, the mentioned solution would be helpful enough, just maybe if you let it work with strikes and I can execute the cmd just on the 1st strike, it will save some performance

So like:

commandsOnStrikes:
   every: # cmd on every strike, or under separate configuration
   - ....
  1:
   - fly %player% false -s
   25:
   - give %player% ...

or just like:

commandsOnJump:
  - ...

but I think the first variant could be more utilized