Skip to content

Commit 78695e7

Browse files
authored
Merge pull request #324 from BentoBoxWorld/develop
Version 1.14.0
2 parents a7e1318 + 2a3e862 commit 78695e7

20 files changed

+806
-237
lines changed

.github/workflows/build.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ jobs:
1111
name: Build
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515
with:
1616
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1717
- name: Set up JDK 17
18-
uses: actions/setup-java@v1
18+
uses: actions/setup-java@v3
1919
with:
20+
distribution: 'adopt'
2021
java-version: 17
2122
- name: Cache SonarCloud packages
22-
uses: actions/cache@v1
23+
uses: actions/cache@v3
2324
with:
2425
path: ~/.sonar/cache
2526
key: ${{ runner.os }}-sonar
2627
restore-keys: ${{ runner.os }}-sonar
2728
- name: Cache Maven packages
28-
uses: actions/cache@v1
29+
uses: actions/cache@v3
2930
with:
3031
path: ~/.m2
3132
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}

README.md

+79-17
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,31 @@ The user command is `/ob`. The admin command is `/oba`.
2424

2525
Q: What phases are there?
2626

27-
A: There are 11 phases: Plains, Underground, Winter, Ocean, Jungle, Swamp, Dungeon, Desert, The Nether, Plenty, Desolation, and The End. Each phase features a set of blocks, items, and mobs appropriate for the setting.
27+
A: There are 12 phases: Plains, Underground, Winter, Ocean, Jungle, Swamp, Dungeon, Desert, The Nether, Plenty, Desolation, Deep Dark, and The End. Each phase features a set of blocks, chests, items, and mobs appropriate for the setting.
2828

29-
Q: How many blocks are there in the 11 phases?
29+
Q: How many blocks are there in the phases?
3030

31-
A: There are currently 11 thousand blocks!
31+
A: There are currently 12 thousand blocks!
3232

3333
Q: What happens after the last phase?
3434

3535
A: The phases repeat.
3636

3737
Q: Why do I keep falling and dying!
3838

39-
A: There are tricks to surviving, but it might be difficult! You need to build defenses.
39+
A: There are tricks to surviving, but it might be difficult! You need to build space so you don't fall.
4040

4141
Q: I can't catch the blocks when I mine them! How do I do that?
4242

43-
A: Yep. It's tough. You can't catch them all, but it *is* an infinite block!
43+
A: You can't catch them all, but it *is* an infinite block!
4444

4545
Q: Why do certain blocks spawn more frequently than others?
4646

47-
A: They just do! You can set the relative probability in the config files in the phases folder.
47+
A: They just do! It's random. You can set the relative probability in the config files in the phases folder. Admins can also set certain blocks to appear at certain times no matter what. Look out for the sponge for example!
4848

4949
Q. How do I know which is the magic block?
5050

51-
A. Hit it and it will give out green particles.
51+
A. Hit it and it will give out green particles. It's also at the center of your island.
5252

5353
Q. My magic block is no longer there! How do I get another one?
5454

@@ -68,15 +68,15 @@ A. Be prepared. Listen carefully when you mine a block and you will hear hostile
6868

6969
Q. When mobs spawn, my defenses are destroyed! Why?
7070

71-
A. Mobs make space to spawn. If there's anything in the way, it'll be broken and dropped. You'll have to build accordingly.
71+
A. Mobs make space to spawn. If there's anything in the way, it'll be broken and dropped. You'll have to build accordingly. This is to prevent suffocation exploits.
7272

7373
Q: Do chests spawn?
7474

7575
A: Yes. Chests spawn with random items in them from the current phase. There are common, uncommon, rare and epic chests. Chests with sparkles are good.
7676

7777
Q: Is it possible to reach the Nether or End in this map?
7878

79-
A: The vanilla Nether exists by default but there is no End world.
79+
A: The vanilla Nether exists by default but there is no End world, just an End Phase.
8080

8181
Q: What is the end goal?
8282

@@ -100,14 +100,81 @@ The config files to make the phases are in the phases folder.
100100
There are two files per phase - a file that contains the blocks and mobs, and a file that contains the chests.
101101

102102
The first number of any file is how many blocks need to be mined to reach that phase. This is the phase's key number.
103-
Each phase also has a name, a biome and the following sections:
104-
103+
Each phase also has a name, an icon, a biome and the following sections:
104+
105+
- name
106+
- icon
107+
- fixedBlocks
108+
- holograms
109+
- biome
110+
- start-commands
111+
- end-commands
112+
- end-commands-first-time
113+
- requirements
105114
- blocks
106115
- mobs
107116

108117
In the chests file, it just has the phase number and a chests section.
109118

110-
119+
### name
120+
Name of the phase
121+
122+
### icon
123+
The material for an icon to show
124+
125+
### fixedBlocks
126+
List of blocks that will generate at these specific block counts. The numbers are relative to the phase and not the overall player's count.
127+
If you define 0 here, then firstBlock is not required and firstBlock will be replaced with this block.
128+
129+
### holograms
130+
131+
Hologram Lines to Display. The key number is the block of the phase to show the hologram. Chat color codes can be used. A hologram plugin is not required for these holograms.
132+
The First (Before Phase 1) Hologram is Located in your Locale.
133+
134+
### Biome
135+
The biomes for this phase.
136+
137+
### Commands
138+
A list of commands can be run at the start and end of a phase. Commands are run as the Console
139+
unless the command is prefixed with [SUDO], then the command is run as the player
140+
triggering the commands.
141+
142+
These placeholders in the command string will be replaced with the appropriate value:
143+
* [island] - Island name
144+
* [owner] - Island owner's name
145+
* [player] - The name of the player who broke the block triggering the commands
146+
* [phase] - the name of this phase
147+
* [blocks] - the number of blocks broken
148+
* [level] - your island level (Requires Levels Addon)
149+
* [bank-balance] - your island bank balance (Requires Bank Addon)
150+
* [eco-balance] - player's economy balance (Requires Vault and an economy plugin)
151+
152+
Examples:
153+
```
154+
start-commands:
155+
- 'give [player] WOODEN_AXE 1'
156+
- 'broadcast [player] just started OneBlock!'
157+
end-commands:
158+
- '[SUDO]summon minecraft:wither'
159+
These are run only the first time a phase is completed
160+
end-commands-first-time:
161+
- 'broadcast &c&l[!] &b[player] &fhas completed the &d&n[phase]&f phase for the first time.'
162+
```
163+
### Requirements
164+
165+
You can stipulate a set of requirements to start the phase:
166+
* economy-balance - the minimum player's economy balance (Requires Vault and an economy plugin)
167+
* bank-balance - the minimum island bank balance (requires Bank Addon)
168+
* level - the island level (Requires Levels Addon)
169+
* permission - a permission string
170+
Example:
171+
```
172+
requirements:
173+
bank-balance: 10000
174+
level: 10
175+
permission: ready.for.battle
176+
```
177+
111178
### blocks
112179

113180
The blocks section list Bukkit Materials followed by a relative probability. All the probability values are added up for the whole phase and the chance of the block being placed is the relative probability divided by the total of all the probabilities.
@@ -130,11 +197,6 @@ OneBlock is an add-on that uses the BentoBox API. Here are some other ones that
130197

131198
You can add all the usual addons to OneBlock, like Challeges, Likes, Level, Warps, etc. but it is not required.
132199

133-
### Other Plugins
134-
135-
* To use the Holographic phase names, you will need to install the [Holographic Displays plugin](https://dev.bukkit.org/projects/holographic-displays)
136-
137-
138200
Bugs and Feature requests
139201
=========================
140202
File bug and feature requests here: https://github.com/BentoBoxWorld/OneBlock/issues

pom.xml

+12-2
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@
5959
<powermock.version>2.0.9</powermock.version>
6060
<!-- More visible way how to change dependency versions -->
6161
<spigot.version>1.19.4-R0.1-SNAPSHOT</spigot.version>
62-
<bentobox.version>1.22.0</bentobox.version>
62+
<bentobox.version>1.24.0-SNAPSHOT</bentobox.version>
6363
<level.version>2.6.2</level.version>
6464
<bank.version>1.3.0</bank.version>
6565
<!-- Revision variable removes warning about dynamic version -->
6666
<revision>${build.version}-SNAPSHOT</revision>
6767
<!-- Do not change unless you want different name for local builds. -->
6868
<build.number>-LOCAL</build.number>
6969
<!-- This allows to change between versions. -->
70-
<build.version>1.13.0</build.version>
70+
<build.version>1.14.0</build.version>
7171
<!-- SonarCloud -->
7272
<sonar.projectKey>BentoBoxWorld_AOneBlock</sonar.projectKey>
7373
<sonar.organization>bentobox-world</sonar.organization>
@@ -141,6 +141,10 @@
141141
<id>codemc-repo</id>
142142
<url>https://repo.codemc.org/repository/maven-public/</url>
143143
</repository>
144+
<repository>
145+
<id>jitpack-repo</id>
146+
<url>https://jitpack.io</url>
147+
</repository>
144148
</repositories>
145149

146150
<dependencies>
@@ -208,6 +212,12 @@
208212
<version>${bank.version}</version>
209213
<scope>provided</scope>
210214
</dependency>
215+
<dependency>
216+
<groupId>com.github.LoneDev6</groupId>
217+
<artifactId>API-ItemsAdder</artifactId>
218+
<version>3.2.5</version>
219+
<scope>provided</scope>
220+
</dependency>
211221

212222
</dependencies>
213223

src/main/java/world/bentobox/aoneblock/AOneBlock.java

+36-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import java.io.IOException;
44
import java.util.Objects;
55

6+
import org.bukkit.Bukkit;
67
import org.bukkit.World;
78
import org.bukkit.World.Environment;
89
import org.bukkit.WorldCreator;
@@ -19,6 +20,8 @@
1920
import world.bentobox.aoneblock.listeners.BlockListener;
2021
import world.bentobox.aoneblock.listeners.BlockProtect;
2122
import world.bentobox.aoneblock.listeners.HoloListener;
23+
import world.bentobox.aoneblock.listeners.InfoListener;
24+
import world.bentobox.aoneblock.listeners.ItemsAdderListener;
2225
import world.bentobox.aoneblock.listeners.JoinLeaveListener;
2326
import world.bentobox.aoneblock.listeners.NoBlockHandler;
2427
import world.bentobox.aoneblock.oneblocks.OneBlocksManager;
@@ -38,6 +41,7 @@ public class AOneBlock extends GameModeAddon {
3841

3942
private static final String NETHER = "_nether";
4043
private static final String THE_END = "_the_end";
44+
public static boolean hasItemsAdder = false;
4145

4246
// Settings
4347
private Settings settings;
@@ -50,6 +54,11 @@ public class AOneBlock extends GameModeAddon {
5054

5155
@Override
5256
public void onLoad() {
57+
// Check if ItemsAdder exists, if yes register listener
58+
if (Bukkit.getPluginManager().getPlugin("ItemsAdder") != null) {
59+
registerListener(new ItemsAdderListener(this));
60+
hasItemsAdder = true;
61+
}
5362
// Save the default config from config.yml
5463
saveDefaultConfig();
5564
// Load settings from config.yml. This will check if there are any issues with it too.
@@ -79,21 +88,12 @@ private boolean loadSettings() {
7988

8089
@Override
8190
public void onEnable() {
82-
try {
83-
oneBlockManager = new OneBlocksManager(this);
84-
oneBlockManager.loadPhases();
85-
blockListener = new BlockListener(this);
86-
} catch (IOException e) {
87-
// Disable
88-
logError("AOneBlock settings could not load (oneblock.yml error)! Addon disabled.");
89-
logError(e.getMessage());
90-
setState(State.DISABLED);
91-
return;
92-
}
93-
registerListener(blockListener);
91+
loadData();
92+
9493
registerListener(new NoBlockHandler(this));
9594
registerListener(new BlockProtect(this));
9695
registerListener(new JoinLeaveListener(this));
96+
registerListener(new InfoListener(this));
9797
// Register placeholders
9898
registerPlaceholders();
9999

@@ -106,6 +106,22 @@ public void onEnable() {
106106
registerListener(holoListener);
107107
}
108108

109+
//Load some of Manager
110+
public void loadData() {
111+
try {
112+
oneBlockManager = new OneBlocksManager(this);
113+
oneBlockManager.loadPhases();
114+
blockListener = new BlockListener(this);
115+
} catch (IOException e) {
116+
// Disable
117+
logError("AOneBlock settings could not load (oneblock.yml error)! Addon disabled.");
118+
logError(e.getMessage());
119+
setState(State.DISABLED);
120+
return;
121+
}
122+
registerListener(blockListener);
123+
}
124+
109125
private void registerPlaceholders() {
110126
phManager = new PlaceholdersManager(this);
111127
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "visited_island_phase", phManager::getPhaseByLocation);
@@ -122,7 +138,7 @@ private void registerPlaceholders() {
122138
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "visited_island_done_scale", phManager::getDoneScaleByLocation);
123139
// Since 1.10
124140
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "visited_island_lifetime_count", phManager::getLifetimeByLocation);
125-
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "my_island_lifetime_count", phManager::getLifetime);
141+
getPlugin().getPlaceholdersManager().registerPlaceholder(this, "my_island_lifetime_count", phManager::getLifetime);
126142
}
127143

128144
@Override
@@ -253,9 +269,6 @@ public void saveDefaultConfig()
253269
public void allLoaded() {
254270
// save settings. This will occur after all addons have loaded
255271
this.saveWorldSettings();
256-
257-
// Manage Old Holograms
258-
holoListener.setUp();
259272
}
260273

261274
/**
@@ -293,4 +306,11 @@ public PlaceholdersManager getPlaceholdersManager() {
293306
public HoloListener getHoloListener() {
294307
return holoListener;
295308
}
309+
310+
/**
311+
* @return true if ItemsAdder is on the server
312+
*/
313+
public boolean hasItemsAdder() {
314+
return hasItemsAdder;
315+
}
296316
}

src/main/java/world/bentobox/aoneblock/Settings.java

+20
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ public class Settings implements WorldSettings {
110110
@ConfigComment("If set to 0, then holograms will persist until cleared some other way.")
111111
@ConfigEntry(path = "world.hologram-duration")
112112
private int hologramDuration = 10;
113+
114+
@ConfigComment("Clear blocks when spawning mobs.")
115+
@ConfigComment("Mobs break blocks when they spawn is to prevent players from building a box around the magic block,")
116+
@ConfigComment("having the mob spawn, and then die by suffocation, i.e., it's a cheat prevention.")
117+
@ConfigEntry(path = "world.mobs-clear-blocks")
118+
private boolean clearBlocks = true;
113119

114120
@ConfigComment("Spawn limits. These override the limits set in bukkit.yml")
115121
@ConfigComment("If set to a negative number, the server defaults will be used")
@@ -2041,4 +2047,18 @@ public boolean isUseHolograms() {
20412047
public void setUseHolograms(boolean useHolograms) {
20422048
this.useHolograms = useHolograms;
20432049
}
2050+
2051+
/**
2052+
* @return the clearBlocks
2053+
*/
2054+
public boolean isClearBlocks() {
2055+
return clearBlocks;
2056+
}
2057+
2058+
/**
2059+
* @param clearBlocks the clearBlocks to set
2060+
*/
2061+
public void setClearBlocks(boolean clearBlocks) {
2062+
this.clearBlocks = clearBlocks;
2063+
}
20442064
}

0 commit comments

Comments
 (0)