# Advanced Ore Gen
**A simple way of changing the default cobblestone generator**

# Features
* The whole configuration is made using the GUI
* No config.yml needed
* Inbuilt generator selector
* Offline owner caching
* AFK feature
* Multiple generator presets for different **permissions** or **levels**
* Toggleable fence generator setup
* Support for sub ids, so all block types are supported
* Placeholders
* Works with most Skyblock plugins: ASkyBlock, AcidIsland, uSkyBlock, IslandWorld, SuperiorSkyblock2, FabledSkyblock and Bentobox.

# Installation

### Choose a SkyBlock plugin

Before getting started, you need to have one of these plugins installed on your server:

* BentoBox (by Poslovitch and tastybento, required the Level Addon)
* FabledSkyBlock (by Songoda)
* SuperiorSkyblock2 (by Ome_R)
* ASkyBlock (by tastybento)
* AcidIsland (by tastybento)
* uSkyBlock (by R4zorax)
* IslandWorld (by Gnacik)
* PlotSquared (by IntellectualSites)

Note: Any skyblock not on this list is NOT supported.

### Installation of the .jar file

1. Download the plugin .jar file that can be found at the following link:  https://www.spigotmc.org/resources/advancedoregen.40527/
2. Drop the .jar file in your plugin folder
3. Restart your server

# Setting up a generator

The whole configuration is made through the GUI or alternatively by modifying the config.yml.

### Migrating from CustomOreGen

If you come from CustomOreGen, and want to use your config.yml from it, just place the CustomOreGen config.yml in the AdvancedOreGen folder and start the plugin.

### Understanding the generator mechanics

The plugin allows you to customize different generator presets for certain permission, thus, for instance, you're able to create a default generator generating cobblestone and a vip generator creating cobblestone and gold:

![](/media/AoC_generator_menue.png)


Generator #1 was set up with the permission `oregen.default` and Generator #2 with `oregen.vip`, therefor you need to provide the respective permission to your players.

Assuming the island owner has the permission `oregen.vip` and mines at a cobblestone generator, then the player will get the last configuration preset for which the player has permission for.
That means the plugin basically iterates from left to the right and checks if the player has permission and stops at the last generator the player has permission for.

Moreover, the plugin chooses the generator by the island owner's permission, not by the player that is mining.

When clicking the repeater (4), the plugin will turn into **level mode**. Level mode means that the corresponding generator is choosen by the corresponding island level of the owner.

Your players are also able to choose between generators, see generator selector.

### Creating new generator presets

You can add new generators and it's permission by typing the following exemplary commands, or by selecting the wooden button item in the main GUI(3).

```yaml
/oregen generator add default oregen.default
/oregen generator add vip oregen.vip
```


where `default` and `vip` are the name of the generator preset and `oregen.default` and `oregen.vip` the permission.

After that, you may edit both generators by typing this command:

```yaml
/oregen edit
```

Now the GUI where you can choose the generator which you want to edit appears. (See last image).

Another GUI will pop up if you select a generator where you can put the blocks you want to be generated:

![](/media/generator_items.png)

The emerald indicates the current percentage, which should always be at 100.0, otherwise the plugin wouldn't work correctly.

Let's say we want this generator to create 50% cobblestone and 50% iron ore, we need to proceed the following steps:
1. select a cobblestone block and an iron ore block from your inventory (Add it before editing).
2. click on each block in order to change the percentage; an anvil will be opened, put 50 in it
3. voila, your percentage should now be at 100.0.

![](/media/anvil.png)

![](/media/generator_item.png)

Now you're ready to use the generator and you should now be able proceeding the same steps for the VIP generator!

### Reordering generators

Typing the command `/oregen order` will bring up the default editing GUI, but in ordering mode. Ordering mode means that the clicked generator will moved by one position to the right, simply swapping two generators. In this way, you can reorder your generators. Typing `/oregen edit` again will exit the ordering mode.

### Default config.yml

```yml
# Here you can define worlds where the generator should not work
disabled-worlds:
- "world_nether"

# AFK mode: Players who stay more than 20 minutes afk would get the defined afk generator
# remove the '#' to enable this feature.
#afk-generator-name: afk
#afk-after-x-seconds: 1200

# command for players that shows the current generator on an island (permission: advancedoregen.showgenerator)
show-generator-command: generator

# water <-> lava fix
# the water-lava-fix avoid generating ores when water is poured on lava directly and vice-versa
# set it to false for using custom ore gen's generator behavior
water-lava-fix: true

# fence generator, allows you to generate cobblestone by placing a fence block instead of lava.
fence-generator-enabled: false


... (your generators)
```

# Misc
### Generator selector

![](/media/spigot_pages/advanced_ore_gen/generator_command.gif)

This generator menu gives your players the opportunity to select a generator they've already unlocked. This is useful when using differnt kinds of generators, for example an overworld ore generator and a nether generator which are unlocked on the same island level / player permission.

The default command is `/generator`, which can also changed in the config.yml. (permission is `advancedoregen.showgenerator`)

### AFK feature

Since version 1.3.2, AdvancedOreGen includes a nice anti afk feature that allows you to give players who are mining AFK another generator.
AFK means, that the player doesn't change his position during mining.
You can enable this by uncommenting the following lines in your config.yml:

```yaml
#afk-generator-name: afk
#afk-after-x-seconds: 1200
```

By default, the player is handled as AFK after 20 minutes. Keep in mind that you need to set up an AFK - Generator, which should have the afk-generator-name, the permission is inconsequential.

![](https://github.com/mastercake10/wiki/raw/master/uploads/afk-generator-example.png)

### Offline owner support

AdvancedOreGen caches the player permissions for keeping the same cobblestone generator after an owner of an island leaves the server. You can see an example here:

[filename](/media/offline-owner-showcase.mp4 ':include :type=video')

### Placeholders

The plugin uses the PlaceholderAPI and registers three different identifiers that display the current specifiations from a player's generator.



| Name | Placeholder | Description |
| -------- | -------- | -------- |
| Generator name     | %oregen_generator.label%     | Displays the generator name     |
| Unlock island level     | %oregen_generator.level%     | Displays the island level needed to unlock this generator     |
| Unlock permission     | %oregen_generator.permission%     | Displays the permission needed to unlock this generator     |

Reference: Current generator config of a player



# Commands

There're some commands for managing and editing different generators, but as already said, you can purely use the GUI!

| Command                                                  | Permission           | Description                                                                                                                        |
|----------------------------------------------------------|----------------------|------------------------------------------------------------------------------------------------------------------------------------|
| /oregen edit                                             | advancedoregen.admin | main GUI, lets you add new generators and edit other generators                                                                    |
| /oregen order                                             | advancedoregen.admin | main GUI in ordering mode, lets you reorder your generators                                                                    |
| /oregen edit name>                                       | advancedoregen.admin | directly edits a generator                                                                                                         |
| /oregen generator add <name> <permission> [level]        | advancedoregen.admin | adds a new generator                                                                                                               |
| /oregen generator remove <name>                          | advancedoregen.admin | removes a generator                                                                                                                |
| /oregen generator set <name> <permission> [island level] | advancedoregen.admin | modifies an existing generator                                                                                                     |
| /oregen setmode [permission/islandlevel]                 | advancedoregen.admin | sets the criteria for choosing a generator regarding the permission of the island leader, or the island level. Default: permission |

# FAQ

Q: Does this plugin need a skyblock plugin?
A: Yes it does. The plugin is used to obtain the permssion (or level) of the owner, in order to choose a generator. In a plain vanilla world, there is no way to fetch directly the player permissions mining on the generator. What if two players are mining at one generator, but both have access to different generators?