Compare commits

..

5 Commits
v1.0 ... master

Author SHA1 Message Date
Ruakij c3da1003b1 Fixed spelling 3 years ago
Ruakij 13dc4f9ca2 Added explanation 3 years ago
Alexander B 9532f59125 Changed version 4 years ago
Alexander B 3fe40117c6 Added option to prerequisite for always fail 4 years ago
Alexander B a2e4ba1c9d Fixed spelling 4 years ago

@ -1 +1,111 @@
# SpawnerDrops # SpawnerDrops
Bukkit-Plugin for Spawner Place&Block configs.
Can differenciate between generated and placed blocks by admins or users.
Supports custom messages for all actions.
<br>
## Features
- Who can break spawners from
- World (Generated/Worldedit)
- Admin (Placed by amdin)
- Other players
- When the block actually drops an item
- Who can place spawners
- Messages for each action of success/fail
<br>
## Usage
1. The break-prerequisite is the first stage and will determine if the spawner will break or not break at all.
2. Then the drop-prerequisite is checked and if met will actually drop the spawner as item.
<br>
## Setup
1. Place the plugin in your plugins folder and resatart the server
2. Set necessary and additional permissions if needed
<br>
### Permissions
- **minecraft.nbt.place** has to be set for players to be able to place spawners (does not allow placing in protected zones)
- **spawnerDrops.admin** to allow placing spawners as source "ADMIN"
<br>
## Examples
### 1
```yaml
break:
break-prerequisite:
UNKNOWN:
canBreak: true
allowed-items:
- 'diamond_pickaxe'
silktouch: false
msg:
success: ''
fail: '§7§oNothing happens, it seems you need a diamond-pickaxe'
# [..]
drop:
drop-prerequisite:
UNKNOWN:
canDrop: true
allowed-items: null
silktouch: false
msg:
success: '§7§oThe spawner breaks with a loud *Pop* and falls to the ground to be picked up'
# As canDrop is true and allowed-items is every item, the fail-message is never used
fail: ''
# [..]
```
break-prerequisite is a diamond-pickaxe, but an iron-one is used, then the block **will not break**.
drop-prerequisite is anything, including a diamond-pickaxe, then the **block will drop**.
<br>
### 2
```yaml
break:
break-prerequisite:
UNKNOWN:
canBreak: true
allowed-items: null
silktouch: false
msg:
success: ''
# As canBreak is true and allowed-items is every item, the fail-message is never used
fail: ''
# [..]
drop:
drop-prerequisite:
UNKNOWN:
canDrop: true
allowed-items:
- 'diamond_pickaxe'
silktouch: false
msg:
success: '§7§oThe spawner breaks with a loud *Pop* and falls to the ground to be picked up'
fail: '§7§o*Poof* The spawner breaks into many pieces and is lost'
# [..]
```
break-prerequisite is anything, the block **will break** with any tool used.
drop-prerequisite is a diamond-pickaxe, but an iron-one is used, then the item **will not drop**, but the **block will be broken** -> **spawner is lost**

@ -12,6 +12,8 @@ break:
break-prerequisite: break-prerequisite:
# 'unknown' means we dont know where the spawner came from (usually a generated one or e.g. using worldedit) # 'unknown' means we dont know where the spawner came from (usually a generated one or e.g. using worldedit)
UNKNOWN: UNKNOWN:
# If a spawner can be broken at all (displays fail-message if set)
canBreak: true
# Which items are allowed to break a spawner (null to allow everything) # Which items are allowed to break a spawner (null to allow everything)
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
@ -24,6 +26,7 @@ break:
fail: '§7§oNothing happens, it seems you need a diamond-pickaxe with silktouch' fail: '§7§oNothing happens, it seems you need a diamond-pickaxe with silktouch'
PLAYER: PLAYER:
canBreak: true
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
silktouch: true silktouch: true
@ -32,6 +35,7 @@ break:
fail: '§7§oNothing happens, it seems you need a diamond-pickaxe with silktouch' fail: '§7§oNothing happens, it seems you need a diamond-pickaxe with silktouch'
ADMIN: ADMIN:
canBreak: true
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
silktouch: true silktouch: true
@ -45,10 +49,12 @@ break:
name: '{mob-type}-Spawner' name: '{mob-type}-Spawner'
# Prerequisites for a successful drop of the spawner-item AFTER (and only if) it was broken # Prerequisites for a successful drop of the spawner-item AFTER (and only if) it was broken
# (if a player can break it, but the drop prerequisite is not met, the block is broken, but not item will drop -> Its lost) # (if a player can break it, but the drop prerequisite is not met, the block is broken, but no item will drop -> Its lost)
drop-prerequisite: drop-prerequisite:
UNKNOWN: UNKNOWN:
# If a spawner ever drops the item (displays fail-message if set)
willDrop: true
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
silktouch: true silktouch: true
@ -57,6 +63,7 @@ break:
fail: '§7§o*Poof* The spawner breaks into many pieces and is lost' fail: '§7§o*Poof* The spawner breaks into many pieces and is lost'
PLAYER: PLAYER:
willDrop: true
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
silktouch: true silktouch: true
@ -65,6 +72,7 @@ break:
fail: '§7§o*Poof* The spawner breaks into many pieces and is lost' fail: '§7§o*Poof* The spawner breaks into many pieces and is lost'
ADMIN: ADMIN:
willDrop: true
allowed-items: allowed-items:
- 'diamond_pickaxe' - 'diamond_pickaxe'
silktouch: true silktouch: true

@ -47,9 +47,14 @@ public class OnBlockBreak implements Listener {
// # Break-Prerequisite // # Break-Prerequisite
ConfigurationSection breakPreConfig = Main.config.getConfigurationSection("break.break-prerequisite."+ bSource); ConfigurationSection breakPreConfig = Main.config.getConfigurationSection("break.break-prerequisite."+ bSource);
boolean success = true; boolean success = true;
// CanBreak
if(!breakPreConfig.getBoolean("canBreak"))
success = false;
// Allowed-items // Allowed-items
List<String> allowed_items = (List<String>) breakPreConfig.getList("allowed-items"); List<String> allowed_items = (List<String>) breakPreConfig.getList("allowed-items");
if(allowed_items != null){ if(success && allowed_items != null){
boolean found = false; boolean found = false;
for(String allowed_item : allowed_items){ for(String allowed_item : allowed_items){
if(p.getItemInHand().getType().name().equalsIgnoreCase(allowed_item)){ if(p.getItemInHand().getType().name().equalsIgnoreCase(allowed_item)){
@ -95,6 +100,11 @@ public class OnBlockBreak implements Listener {
// # Drop-Prerequisite // # Drop-Prerequisite
ConfigurationSection dropPreConfig = Main.config.getConfigurationSection("break.drop-prerequisite."+ bSource); ConfigurationSection dropPreConfig = Main.config.getConfigurationSection("break.drop-prerequisite."+ bSource);
boolean success = true; boolean success = true;
// WillDrop
if(!dropPreConfig.getBoolean("willDrop"))
success = false;
// Allowed-items // Allowed-items
List<String> allowed_items = (List<String>) dropPreConfig.getList("allowed-items"); List<String> allowed_items = (List<String>) dropPreConfig.getList("allowed-items");
if(allowed_items != null){ if(allowed_items != null){

@ -1,4 +1,4 @@
name: SpawnerDrops name: SpawnerDrops
version: 1.0 version: 1.1
author: Ruakij author: Ruakij
main: eu.railduction.ruakij.spawnerDrops.Main main: eu.railduction.ruakij.spawnerDrops.Main

Loading…
Cancel
Save