Home›Java›Mods›ScratchCards [1.14 - 26.3] | [Customizable] | [Win Conditions] | [Custom Actions]
ScratchCards [1.14 - 26.3] | [Customizable] | [Win Conditions] | [Custom Actions]
ModsJava

ScratchCards [1.14 - 26.3] | [Customizable] | [Win Conditions] | [Custom Actions]

⬇ Download on Spigot
[​IMG]

Introduction
ScratchCards is a plugin that allows you to create fully customizable and interactive scratch cards directly on Minecraft maps, with custom images, weighted results, win conditions, an economy shop and custom Actions.

Features​
Requirements​
  1. Spigot
  2. Vault
  3. Economy Plugin (Essentials, etc..)
  4. PlaceholderAPI (Optional)
How To Install​
  1. Download ScratchCards.jar from this page.
  2. Download Vault and an Economy Plugin (Essentials, etc...).
  3. Download PlaceholderAPI (Optional).
  4. Put ScratchCards, Vault, an Economy Plugin and PlaceholderAPI inside your plugins folder.
  5. Start your server.
Commands
Code (Text):
/scratchcards - Opens the Scratch Card Shop.
/scratchcards help - Sends a message with all commands and permissions.
/scratchcards buy - Opens the Scratch Card Shop.
/scratchcards list - Lists all loaded Scratch Cards.
/scratchcards give <player_name> <card> [amount] - Gives one or more Scratch Cards to a player.
/scratchcards reload | rl - Reloads the configuration, Scratch Cards and images.
Permissions
Code (Text):
scratchcards.* - Allows to execute all commands.
scratchcards.help - Allows to see all commands and permissions.
scratchcards.buy - Allows to open and use the Scratch Card Shop.
scratchcards.list - Allows to list all loaded Scratch Cards.
scratchcards.give - Allows to give Scratch Cards to players.
scratchcards.reload - Allows to reload the configuration, Scratch Cards and images.
Files
​
Spoiler: config.yml
Code (YAML):
messages:
  prefix
: "&eScratchCards &7>>"
  general
:
    noPermission
: "%prefix% &cYou don't have permission to use this command!"
    wrongArguments
: "%prefix% &cWrong arguments. Use &e/%label% help &cfor the command list."
    playerNotFound
: "%prefix% &cPlayer not found."
    cardNotFound
: "%prefix% &cScratch card '&e%card%&c' does not exist."
    invalidAmount
: "%prefix% &cThe amount must be between 1 and 64."
    invalidTicket
: "%prefix% &cThis scratch card is invalid, corrupted, or has been modified."
    alreadyFinished
: "%prefix% &cThis scratch card has already been completed."
    ticketCreateError
: "%prefix% &cThe scratch card could not be created safely."
    ticketUpdateError
: "%prefix% &cThe scratch progress could not be protected safely. Please try again."
  command
:
    configReloaded
: "%prefix% &aConfiguration, scratch cards and images reloaded."
    configReloadError
: "%prefix% &cReload failed. Check the console; the previous runtime state was kept."
    noCards
: "%prefix% &cNo scratch cards are loaded."
    listHeader
: "%prefix% &7Loaded scratch cards: &e%cards%"
    giveSuccess
: "%prefix% &aGiven &e%amount%x %card% &ato &e%player_name%&a."
    received
: "%prefix% &aYou received &e%amount%x %card%&a."
    giveUsage
: "%prefix% &cUsage: /%label% give <player> <card> [amount]"
  shop
:
    insufficientFunds
: "%prefix% &cYou need &e%price% &cto complete this purchase."
    cardNoPermission
: "%prefix% &cYou don't have permission to buy this scratch card."
    purchaseSuccess
: "%prefix% &aYou purchased &e%amount%x %card% &afor &e%price%&a."
    purchaseError
: "%prefix% &cThe purchase could not be completed safely."
  scratch
:
    noPermission
: "%prefix% &cYou don't have permission to use this scratch card."
    start
: "%prefix% &7Hold &eSHIFT &7and move your view to scratch the card."

scratch
:
  # Head rotations smaller than this amount of degrees are ignored.
  # The plugin has no repeating scratch ticker: movement is processed only
  # when Bukkit actually reports a yaw/pitch change for an active session.
  minimumHeadMovement
: 0.10

gui
:
  shop
:
    title
: "&8Scratch Cards"
    items
:
      # Scratch-card slots are fixed to 0-44. Name/lore come directly from
      # each scratch-card file. priceLore is optional; when present, these
      # lines are appended to the card lore shown in the shop/purchase GUI.
      card
:
        material
: "MAP"
        priceLore
:
         - ""
          - "&7Price
: &a%total_price%"
          - ""
          - "&eClick to buy!"
      previousPage
:
        material
: "ARROW"
        name
: "&ePrevious Page"
        lore
:
         - "&7Go to the previous page."
      close
:
        material
: "BARRIER"
        name
: "&cClose"
        lore
:
         - "&7Close the shop."
      nextPage
:
        material
: "ARROW"
        name
: "&eNext Page"
        lore
:
         - "&7Go to the next page."
      filler
:
        material
: "GRAY_STAINED_GLASS_PANE"
        # Optional. Omit it or leave a blank-looking name for a purely decorative filler.
        name
: " "
        lore
: [ ]

  purchase
:
    title
: "&8Buy %scratchcard%"
    maxQuantity
: 64
    items
:
      decrease
:
        material
: "RED_DYE"
        name
: "&c-1"
        lore
:
         - "&7Decrease the quantity."
          - "&7Current
: &e%amount%"
      increase
:
        material
: "LIME_DYE"
        name
: "&a+1"
        lore
:
         - "&7Increase the quantity."
          - "&7Current
: &e%amount%"
      confirm
:
        material
: "EMERALD_BLOCK"
        name
: "&aConfirm Purchase"
        lore
:
          - "&7Quantity
: &e%amount%"
          - "&7Total
: &a%total_price%"
          - ""
          - "&aClick to confirm."
      cancel
:
        material
: "REDSTONE_BLOCK"
        name
: "&cCancel"
        lore
:
         - "&7Return to the card list."
      filler
:
        material
: "GRAY_STAINED_GLASS_PANE"
        # Optional. Omit it or leave a blank-looking name for a purely decorative filler.
        name
: " "
        lore
: [ ]
Spoiler: luckydiamonds.yml
Code (YAML):
#=======================================================================#
#                         luckydiamonds Scratch Card                           #
#=======================================================================#
# Each .yml file inside /scratchcards/ defines one scratch-card type.
# The filename is the ID: luckydiamonds.yml -> "luckydiamonds".
#
# Images are relative to plugins/ScratchCards/. A Minecraft map is 128x128.
#
# IMPORTANT FOR PERFORMANCE:
# Define scratch-areas ONLY around pixels that really need to change.
# Do not make a 128x128 scratch-area when the visible scratch panel is only
# 28x28. Smaller, accurate areas mean fewer pixels to update, smaller BitSet
# masks and a smaller encrypted ItemStack payload.
#=======================================================================#

enabled
: true
price
: 500.0

# Permission required both to purchase and to scratch this card.
# This option is optional: omit it or set it to "" to make the card unrestricted.
permission
: "scratchcards.ticket.luckydiamonds"

# If true, players without the permission do not see this card in the shop.
# If false, they can see it but clicking/buying it is denied.
# This option is optional and defaults to false; it has no effect when permission is empty.
hide-without-permission
: true

item
:
  name
: "&6&lLucky Diamonds"
  lore
:
   - "&7Hold the map in your hand."
    - "&7Hold &eSHIFT &7and move your view to scratch it."
    - ""
    - "&eFind 3 equal symbols to win!"

# Static map textures. background is used while ACTIVE; win/lose replace
# the whole map only after every scratch-area reaches the configured
# completion percentage.
images
:
  background
: "images/luckydiamonds/background.png"
  win
: "images/luckydiamonds/win.png"
  lose
: "images/luckydiamonds/lose.png"

# Cursor shown only during an active SHIFT scratch session.
# Rotations are pre-cached by the plugin.
cursor
:
  image
: "images/luckydiamonds/cursor.png"
  width
: 9
  height
: 9
  rotation-steps
: 16
  start-x
: 64
  start-y
: 64
  sensitivity
: 0.70

# radius is the number of map pixels erased around the cursor.
# The card is evaluated only when EVERY scratch-area reaches this percentage.
scratch
:
  radius
: 4
  completion-percentage
: 70.0

# chance is a RELATIVE weight; values do not need to total 100.
# positive is read only by POSITIVE_COUNT.
results
:
  diamond
:
    image
: "images/luckydiamonds/diamond.png"
    chance
: 25.0
    positive
: true
  emerald
:
    image
: "images/luckydiamonds/emerald.png"
    chance
: 25.0
    positive
: true
  coal
:
    image
: "images/luckydiamonds/coal.png"
    chance
: 50.0
    positive
: false

# These are the ONLY regions whose scratch pixels can change.
# x/y = top-left map pixel; width/height = exact scratchable rectangle.
# cover-image is drawn above the generated result until pixels are erased.
# results is the explicit result pool allowed in that area.
scratch-areas
:
  first
:
    x
: 12
    y
: 48
    width
: 28
    height
: 28
    cover-image
: "images/luckydiamonds/cover.png"
    results
: [diamond, emerald, coal ]
  second
:
    x
: 50
    y
: 48
    width
: 28
    height
: 28
    cover-image
: "images/luckydiamonds/cover.png"
    results
: [diamond, emerald, coal ]
  third
:
    x
: 88
    y
: 48
    width
: 28
    height
: 28
    cover-image
: "images/luckydiamonds/cover.png"
    results
: [diamond, emerald, coal ]

#=======================================================================#
# WIN RULE
#
# This section decides when the scratch card is considered a WIN.
#
# SAME
# Wins when at least "amount" scratch areas contain the SAME generated
# result ID.
#
# Example:
#   win-rule:
#     type: "SAME"
#     amount: 3
#
#   [diamond, diamond, diamond] -> WIN
#   [diamond, diamond, coal]    -> LOSE
#
# POSITIVE_COUNT
# Wins when at least "amount" generated results have positive: true
# in the results section. The result ID itself does not matter: every result
# configured with positive: true counts toward the required amount.
#
# Example result configuration:
#   results:
#     diamond:
#       positive: true
#     emerald:
#       positive: true
#     coal:
#       positive: false
#
# Example rule:
#   win-rule:
#     type: "POSITIVE_COUNT"
#     amount: 2
#
#   [diamond, emerald, coal] -> WIN  (2 positive results)
#   [diamond, coal, coal]    -> LOSE (1 positive result)
#
# CONTAINS
# Wins when one specific result appears at least "amount" times.
#
# Example:
#   win-rule:
#     type: "CONTAINS"
#     result: "diamond"
#     amount: 2
#
# EXACT
# Wins only when the generated result sequence matches exactly, including
# the order of the scratch areas.
#
# Example:
#   win-rule:
#     type: "EXACT"
#     results: [diamond, emerald, diamond]
#
# For SAME, POSITIVE_COUNT and CONTAINS, amount cannot be higher than the
# number of configured scratch-areas. EXACT must contain exactly one result
# entry for every scratch-area.
#=======================================================================#
win-rule
:
  type
: "SAME"
  amount
: 3
#Built In Placeholders:
#%prefix% - Returns the prefix.
#%player_name% - Returns the player's name.
#%scratchcard% - Returns the scratch-card ID.
#%ticket_id% - Returns the map/ticket ID.
#%result_1%
#%result_2%
#%result_3%
#PlaceholderAPI is supported.
#Actions:
#[SOUND] Sound;Volume;Pitch - Sends a sound to the player.
#[MESSAGE] Message - Sends a message to the player.
#[JSON_MESSAGE] Message - Sends a json_message to the player.
#The JSONMessage must be written between ' '.
#[TITLE] Title;SubTitle;FadeIn;Stay;FadeOut - Sends a title to the player.
#[ACTIONBAR] String - Sends an actionbar to the player.
#[COMMAND_CONSOLE] Command - Executes a command as console.
#[COMMAND_PLAYER] Command - Executes a command as player.
#To execute the command the "/" is not needed.
actions
:
  win
:
   - "[SOUND] ENTITY_PLAYER_LEVELUP;1.0;1.0"
    - "[TITLE] &a&lYOU WON!;&7Lucky scratch card!;10;50;10"
    - "[MESSAGE] %prefix% &aYou won with: &e%result_1%, %result_2%, %result_3%&a!"
  lose
:
   - "[SOUND] ENTITY_VILLAGER_NO;1.0;1.0"
    - "[TITLE] &c&lYOU LOST;&7Better luck next time!;10;50;10"
 
​


Built In Placeholders
Code (Text):
%prefix% - Returns the plugin prefix.
%player_name% - Returns the player's name.
%scratchcard% - Returns the Scratch Card ID.
%ticket_id% - Returns the Scratch Card map/ticket ID.
%result_1% - Returns the first generated result.
%result_2% - Returns the second generated result.
%result_3% - Returns the third generated result.

Actions
Code (Text):
[SOUND] Sound;Volume;Pitch - Sends a sound to the player.
[MESSAGE] Message - Sends a message to the player.
[JSON_MESSAGE] Message - Sends a jsonmessage to the player.
The JSONMessage must be written between ' '.
[TITLE] Title;SubTitle;FadeIn;Stay;FadeOut - Sends a title to the player.
[ACTIONBAR] String - Sends an actionbar to the player.
[COMMAND_CONSOLE] Command - Executes a command as console.
[COMMAND_PLAYER] Command - Executes a command as player.
To execute the command the "/" is not needed.
Screenshots
Spoiler: Screenshots
[​IMG]
[​IMG]
[​IMG]

Donation Link: https://www.paypal.me/IVEHydra
If you want, you can donate to me. This would help me a lot to continue work on updates. Thank you.

Terms of Service
By downloading this plugin you agree the following terms:
You are not allowed to sell or redistribute this plugin.
You are not allowed to claim this plugin as your own.
You are only allowed to use this plugin for your own servers/networks.
I can update this terms of service at any time, without notification.

My Other Resources
[​IMG]
[​IMG]
[​IMG]

[​IMG]

If you have any problems or bugs with this plugin, contact me or post in the plugin discussion section.​

Commands

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

ScratchCards [1.14 - 26.3] | [Customizable] | [Win Conditions] | [Custom Actions] is a free Minecraft Java mod. Compatible with Minecraft 1.14, 1.15, 1.16, 1.17 and newer. Downloaded 9 times (via Spigot). Download it and open it directly in the game.

Explore more