Skip to content

Introducing Farmer v6: Your virtual assistant for item collection on your island. Buy with in-game currency, add users, manage permissions, and track stock easily.

License

Notifications You must be signed in to change notification settings

Geik-xyz/Farmer-v6

Repository files navigation

Farmer

Collects products of a region or island and store them in inventory of himself.

How it's work?

This plugin creates a virtual assistant that collects items on your behalf within your designated region or island. This assistant, known as the 'Farmer,' can be purchased using in-game currency. Owners have the ability to add users to the assistant and grant them permission to sell items through it. Additionally, the owner can deactivate the collection feature and level up the Farmer via the management GUI. Within the Farmer's GUI, stock availability is displayed using colors and percentage indicators.

As an administrator, you can control the Farmers just as if you were the owner. You can configure items, levels, and more through the configuration settings.

Simultaneously, this plugin enforces automatic updates to the language file, eliminating the need for a reload command to update itself. (Please note that configuration changes still require a reload due to potentially sensitive settings.) You can design your menus using the language file.

Modules

  • Voucher - Egg module for farmer. When use, spawns farmer.
  • SpawnerKiller - Automatically kills spawner creatures.
  • SellCommand - Sell stocked items with command.
  • AutoSell - AutoSells stocked items.
  • AutoHarvest - Auto Harvest crop items.
  • ProductionCalc - Automatically calculates (Hour, Min, Sec) production for an item. (Built in)

Supported Languages

  • English (Full)
  • Turkish (Full)
  • German (Only Modules)

You can write your language keyword in config. (Format: en, tr, de)

Configuration and Lang File

(Maybe OUTDATED version of config and lang file)

config.yml # Main settings of farmer settings: # if you want to give farmer with economy leave it true buyFarmer: true # price of farmer necessary if buyFarmer is true farmerPrice: 1000 # crates farmer automatically (If plugin supports) # also bypass money requirement autoCreateFarmer: false # default farmer user value # you can give farmer.user. perm to owner of farmer defaultMaxFarmerUser: 3 # language from lang file lang: en # farmer ignore collecting if item dropped by player ignorePlayerDrop: false # Allowed worlds allowedWorlds: - ASkyBlock - Island - SuperiorWorld - bskyblock_world
# Tax rate
# If you set it 0 then it useless
# If you want to deposit tax amount to a player
# use depositUser and set true the deposit settings
tax:
rate: 20
deposit: false
depositUser: Geyik

# Farmer levels
# Each level must has capacity and reqMoney
# First level must has capacity only
# Other settings are optional like reqPerm and tax
# If you want to make custom tax for a level then add tax: 1 etc.
# If you want to set a perm for level to purchase then add reqPerm: "my.perm"
levels:
first:
    capacity: 1000
second:
    capacity: 2000
    reqMoney: 5000
third:
    capacity: 10000
    reqMoney: 8000
    reqPerm: "my.custom.perm"
    tax: 15
lang.yml # placeholders: {money} money which deposited to player {tax} tax amount. sellComplete: "&6Farmer &8▸ &aItems sold. &6Profit: &e{money}&f, &6Tax: &e{tax}" wrongWorld: "&6Farmer &8▸ &cYou cannot do this in this world." noPerm: "&6Farmer &8▸ &cYou don't have permission!" noRegion: "&6Farmer &8▸ &cThere is no region for bound a farmer." removedFarmer: "&6Farmer &8▸ &aRemoved farmer successfully." noFarmer: "&6Farmer &8▸ &cThere is no farmer bound here." mustBeOwner: "&6Farmer &8▸ &cYou must to be Region Owner for this." inventoryFull: "&6Farmer &8▸ &cInventory full!" # placeholders: {money} players money {req_money} required money. notEnoughMoney: "&6Farmer &8▸ &cDon't have enough money! Required: &4{req_money}" # placeholders: {level} new upgraded level {capacity} new upgraded capacity. levelUpgraded: "&6Farmer &8▸ &aFarmer upgraded to &6{level}&a level. &2New Capacity: &e{capacity}" # placeholders: {status} shows status of farmer status. (#toggledON, #toggledOFF) toggleFarmer: "&6Farmer &8▸ &aFarmers collection settings changed to: &e{status}" toggleON: "&aActive" toggleOFF: "&cDisabled" featureDisabled: "&6Farmer &8▸ &cThis feature disallowed." reloadSuccess: "&6Farmer &8▸ &aConfig reloaded successfully. It took %ms%" boughtFarmer: "&6Farmer &8▸ &aFarmer bought successfully." # placeholders: {time} left for do it again. inCooldown: "&6Farmer &8▸ &cYou should wait {time}s for do it again." inputCancelWord: "cancel" waitingInput: "&6Farmer &8▸ &aType input to chat in 6sec and type &c{cancel} &afor cancel." notOwner: "&6Farmer &8▸ &cYou must be the owner of the region to use this command." inputCancel: "&6Farmer &8▸ &cNo longer waiting for input." userAdded: "&6Farmer &8▸ &2{player} &aAdded successfully." userAlreadyExist: "&6Farmer &8▸ &4{player} &cAlready added." userCouldntFound: "&6Farmer &8▸ &cUser has not played before!" reachedMaxUser: "&6Farmer &8▸ &cYou have reached max user capacity." percentBar: "▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪" buyDisabled: title: "&6Farmer" subtitle: "&cVisit our website for farmer"
# Farmer roles
roles:
  owner: "&cOwner"
  member: "&aMember"
  coop: "&eCoop"

nextPage:
  # Placeholder: %nextpage% shows next page index.
  name: "&eNext Page (%nextpage%)"
previousPage:
  # Placeholder: %prevpage% shows previous page index.
  name: "&ePrevious Page (%prevpage%)"
guiFiller:
  use: true
  material: GRAY_STAINED_GLASS_PANE
# MAIN GUI
Gui:
  # m -> Management Panel item
  # g -> Item Group element item
  # p -> Previous Page item
  # n -> Next Page item
  # h -> Help item
  interface:
    - "    m    "
    - " ggggggg "
    - " ggggggg "
    - " ggggggg "
    - " ggggggg "
    - "p   h   n"
  guiName: "&8Farmer Storage"
  manage:
    # If you don't want skull you can remove "skull" and create "material: (YOUR_MATERIAL_HERE)"
    skull: "ewogICJ0aW1lc3RhbXAiIDogMTYyMDM5NzA2MjE1MSwKICAicHJvZmlsZUlkIiA6ICI0ZGI2MWRkOTM0Mzk0M2M0YjhhOTZiNDQwMWM3MDM1MCIsCiAgInByb2ZpbGVOYW1lIiA6ICJiZWVyYmVsbHltYW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2MyZTgxOTkwNmViMTc5NDM5YjhkZDU1NTExMzJlNTRlYjQ3MTczZTBmNDU4ODYxYWQyYThjOTM3OTE4Mzg5MSIKICAgIH0KICB9Cn0="
    name: "&eManagement Panel"
    lore:
      - '&7Only region owner can'
      - '&7open this panel.'
      - ''
      - '&dFarmer Stats:'
      - ' &8▪ &7Level: &6{level}'
      - ' &8▪ &7Capacity: &6{capacity}'
      - ' &8▪ &7Tax Rate: &6{tax}'
      - ''
      - '&aClick for management panel!'
  help:
    # If you don't want skull you can remove "skull" and create "material: (YOUR_MATERIAL_HERE)"
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjE2Y2M1NzU1Y2RkMjYwZjdiNGI1YzFhMWYxZjNiZDMxODUxZmMxZDk4Yjc0NDM3YjJmYjRiZDZlYjhkMiJ9fX0="
    name: "&eInformation"
    lore:
      - '&7This is inventory of Farmer.'
      - '&7Farmer stores items here.'
      - '&7What you can do here:'
      - ' &8▪ &6Sell items'
      - ' &8▪ &6Take items to inventory'
      - ' &8▪ &6Management panel (Only Leader)'
      - ''
      - '&cIf you are coop you can'
      - '&conly see this menu.'
  # Placeholders:
  # {stock} Shows how many item farmer have.
  # {maxstock} Shows maximum stock of farmer.
  # {percent} Shows stock fullness percent.
  # {bar} Shows percent in bar format. Uses #percentBar.
  # {price} Shows item price (each).
  # {stack_price} Shows item stack price (Basically multiplies price x64)
  groupItem:
    lore:
      - ""
      - " &8▪ &7Stock: &f{stock}&8/&c{maxstock}"
      - " &8▪ &7Price: &f{price}$ each"
      - "&8&l  [{bar}&8&l] &r{percent}%"
      - ""
      - "&7Average Production (min): &f{prod_min}"
      - "&7Average Production (hour): &f{prod_hour}"
      - "&7Average Production (day): &f{prod_day}"
      - "{prod_blank}"
      - "&7Withdraw Stack &8[&eLeft Click&8]"
      - "&7Withdraw Max &8[&eRight Click&8]"
      - "&7Sell All &8[&eShift+Right Click&8]"
      - ""
      - "&4DANG: &cSell all feature takes"
      - "&4%{tax} &ctax.!"

# Management Gui
manageGui:
  # t -> taking situation icon
  # l -> level up icon
  # u -> user management icon
  interface:
    - "    m    "
    - " t  l  u "
    - "         "
  guiName: "&8Manager Panel"
  # Placeholders:
  # {level} Shows level of farmer.
  # {max_level} Shows maximum level farmer can be.
  # {next_level} Shows next level of farmer.
  # {capacity} Shows farmer capacity.
  # {next_capacity} Shows the farmer's capacity at the next level.
  # {req_money} Shows required money of next level.
  upgradeNext:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNWZjNmVjM2I3NTM1NGI0OTIyMmE4OWM2NjNjNGFjYWQ1MjY0ZmI5NzdjYWUyNmYwYjU0ODNhNTk5YzQ2NCJ9fX0="
    name: '&6{level}. &eLevel Farmer'
    lore:
      - ''
      - ' &8▪ &7New Level: &6{next_level}&7/&c{max_level}'
      - ' &8▪ &7New Capacity: &e{next_capacity}'
      - ' &8▪ &7Required Money: &6{req_money}'
      - ''
      - '&aClick for upgrade level!'
  # Placeholders:
  # {level} Shows level of farmer.
  # {capacity} Shows farmer capacity.
  inMaxLevel:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWQ3OGNjMzkxYWZmYjgwYjJiMzVlYjczNjRmZjc2MmQzODQyNGMwN2U3MjRiOTkzOTZkZWU5MjFmYmJjOWNmIn19fQ=="
    name: '&6{level}. &eLevel Farmer'
    lore:
      - '&7Farmer is in max level.'
      - '&7You cannot upgrade much more.'
      - ''
      - ' &8▪ &7Capacity: &6{capacity}'
  closeFarmer:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDVjNmRjMmJiZjUxYzM2Y2ZjNzcxNDU4NWE2YTU2ODNlZjJiMTRkNDdkOGZmNzE0NjU0YTg5M2Y1ZGE2MjIifX19"
    name: '&eClose Collecting'
    lore:
      - '&7Closes farmer and it will be'
      - '&7useless until reopen.'
      - ''
      - ' &8▪ &7Status: &6{status}'
      - ''
      - '&aClick for change!'
  users:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjg1NDA2MGFhNTc3NmI3MzY2OGM4OTg2NTkwOWQxMmQwNjIyNDgzZTYwMGI2NDZmOTBjMTg2YzY1Yjc1ZmY0NSJ9fX0="
    name: "&eUser Management"
    lore:
      - '&7You can add/remove/modify'
      - '&7users in here.'
      - ''
      - '&aClick for open.'
  modules:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTZlZmM4NmRiOTIyMTdjNWEzODk2NzJiMjgyNDI3NWU3YTIwNmQ3ZWMwZjJjN2U0Y2E0ODNjNmUxN2M5ZjZkNSJ9fX0="
    name: "&eModules"
    lore:
      - '&7You can modify farmer'
      - '&7modules in here.'
      - ''
      - '&aClick for open.'

# Buy Gui (Farmer)
buyGui:
  interface:
    - "         "
    - "    b    "
    - "         "
  guiName: "&8Buy Farmer"
  item:
    skull: "ewogICJ0aW1lc3RhbXAiIDogMTYyMDM5NzA2MjE1MSwKICAicHJvZmlsZUlkIiA6ICI0ZGI2MWRkOTM0Mzk0M2M0YjhhOTZiNDQwMWM3MDM1MCIsCiAgInByb2ZpbGVOYW1lIiA6ICJiZWVyYmVsbHltYW4iLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2MyZTgxOTkwNmViMTc5NDM5YjhkZDU1NTExMzJlNTRlYjQ3MTczZTBmNDU4ODYxYWQyYThjOTM3OTE4Mzg5MSIKICAgIH0KICB9Cn0="
    name: "&eBuy Farmer"
    lore:
      - '&7You can buy farmer by'
      - '&7clicking this item.'
      - ''
      - ' &8▪ &7Price: &6{price}'
      - ''
      - '&aClick for buy!'

# User gui for farmer
usersGui:
  # h -> help
  # u -> user
  # p -> previous page
  # a -> add
  # n -> next page
  interface:
    - "    h    "
    - "uuuuuuuuu"
    - "uuuuuuuuu"
    - "p   a   n"
  guiName: "&8Farmer Users"
  user:
    lore:
      - ''
      - ' &8▪ &7Role: &6{role}'
      - ''
      - '&aLeft or Right click for promote/demote'
      - '&4Shift+Right click for delete'
  help:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjE2Y2M1NzU1Y2RkMjYwZjdiNGI1YzFhMWYxZjNiZDMxODUxZmMxZDk4Yjc0NDM3YjJmYjRiZDZlYjhkMiJ9fX0="
    name: "&eInformation"
    lore:
      - '&7You can promote/demote/remove'
      - '&7and add user here.'
      - ''
      - '&7Perm Graph:'
      - ' &8▪ &eCoop can only look farmer.'
      - ' &8▪ &6Member can sell and take items.'
      - ' &8▪ &cOwner can do everything.'
  addUser:
    skull: "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjA1NmJjMTI0NGZjZmY5OTM0NGYxMmFiYTQyYWMyM2ZlZTZlZjZlMzM1MWQyN2QyNzNjMTU3MjUzMWYifX19"
    name: "&eAdd user"
    lore:
      - ''
      - '&aClick for add user.'

moduleGui:
  interface:
    - "         "
    - " s  k  h "
    - "         "
  guiName: "&8Farmer Modules"

Commands

  • /farmer - Open buy or farmer gui depends on do you have it or not
  • /farmer manage - Management gui (Perm: farmer.admin or owner of farmer)
  • /farmer about - Prints all info about farmer (Perm: farmer.admin)
  • /farmer info - Info of farmer which stand on (Perm: farmer.admin)
  • /farmer reload - Reloads plugin (Perm: farmer.admin)

Images

Average Production Calculator

This is a module of Farmer which calculates average of items which farmer collects and shows it in gui. You can disable in module settings.

Screenshot_1.png Screenshot_2.png

Main Farmer Gui

Screenshot_3.png

Farmer Management Gui

(You can see stock, level, collecting status, users and modules if exists)

Screenshot_4.png Screenshot_5.png Screenshot_6.png Screenshot_7.png

Modules Gui (If exists and enabled)

Screenshot_8.png

User Gui

Screenshot_9.png Screenshot_10.png

API

Farmer JavaDoc Java CI with Maven

Maven:

Add this to your pom.xml if you use in maven.

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>
<dependency>
    <groupId>com.github.Geik-xyz</groupId>
    <artifactId>Farmer-v6</artifactId>
    <version>{RELEASE-VERSION}</version>
</dependency>

Gradle:

Add this to your build.gradle if you use in gradle.

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.Geik-xyz:Farmer-v6:{RELEASE-VERSION}'
}

How to use?

FarmerAPI has good javadoc.

You can check it out the farmer javadoc Java-Doc

public class Main extends JavaPlugin {
    // Returns Main class of plugin
    // You can get most thing on main!
    Main farmerMain = FarmerAPI.getInstance();
    // Gets farmer manager
    FarmerManager farmerManager = FarmerAPI.getFarmerManager();
}

Listeners

  • FarmerBoughtEvent
  • FarmerItemCollectEvent
  • FarmerItemProductionEvent
  • FarmerItemSellEvent
  • FarmerMainGuiOpenEvent
  • FarmerModuleGuiCreateEvent
  • FarmerRemoveEvent
  • FarmerStorageFullEvent

Used Libraries

Integration Libraries (Optional)

★ Big Contributions (Many Thanks) ★

  • Economy System Developed by @amownyy
  • Added IridiumSkyblock & UltimateClaims support by @Khontrom
  • MySQL System Developed by @amownyy
  • Fabledskyblock Integration by @mehmet-27
  • Added Towny Advanced support by @amownyy
  • New Module system big helps by @amownyy

And also thanks for @WaterArchery, @Justman100, @efekurbann, @rudde0, @Heron4gf, @adabugra for improvement and bug fixes!

Contributing

We welcome contributions from the community! If you would like to contribute, please follow these guidelines:

  1. Fork the repository and clone it to your local machine.
  2. Make your changes, and ensure that your code is well-tested.
  3. Create a pull request with a detailed description of your changes.

By contributing to this project, you agree to abide by the Code of Conduct.

License

This project is licensed under the MIT License.