mirror of
https://github.com/simon987/Much-Assembly-Required.git
synced 2025-04-19 02:36:41 +00:00
Added Radioactive Obstacle to map with WorldCreationListener
This commit is contained in:
parent
678b56c2dd
commit
a92256008c
@ -0,0 +1,32 @@
|
|||||||
|
package net.simon987.pluginradioactivecloud.event;
|
||||||
|
|
||||||
|
import net.simon987.pluginradioactivecloud.RadioactiveObstacle;
|
||||||
|
import net.simon987.pluginradioactivecloud.RadioactiveWorldUtils;
|
||||||
|
import net.simon987.server.GameServer;
|
||||||
|
import net.simon987.server.event.GameEvent;
|
||||||
|
import net.simon987.server.event.GameEventListener;
|
||||||
|
import net.simon987.server.event.WorldGenerationEvent;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class WorldCreationListener implements GameEventListener {
|
||||||
|
@Override
|
||||||
|
public Class getListenedEventType() {
|
||||||
|
return WorldGenerationEvent.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(GameEvent event) {
|
||||||
|
|
||||||
|
int minCount = GameServer.INSTANCE.getConfig().getInt("min_radioactive_obstacle_count");
|
||||||
|
int maxCount = GameServer.INSTANCE.getConfig().getInt("max_radioactive_obstacle_count");
|
||||||
|
|
||||||
|
ArrayList<RadioactiveObstacle> radioactiveObstacles = RadioactiveWorldUtils
|
||||||
|
.generateRadioactiveObstacles(((WorldGenerationEvent) event).getWorld(), minCount, maxCount);
|
||||||
|
|
||||||
|
for (RadioactiveObstacle radioactiveObstacle : radioactiveObstacles) {
|
||||||
|
((WorldGenerationEvent) event).getWorld().addObject(radioactiveObstacle);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -94,6 +94,8 @@ electric_box_energy_given=70
|
|||||||
#RadioactiveObstacle
|
#RadioactiveObstacle
|
||||||
radioactive_obstacle_corruption_block_size=10
|
radioactive_obstacle_corruption_block_size=10
|
||||||
radioactive_cloud_corruption_block_size=40
|
radioactive_cloud_corruption_block_size=40
|
||||||
|
min_radioactive_obstacle_count=0
|
||||||
|
max_radioactive_obstacle_count=1
|
||||||
|
|
||||||
#SecretKey
|
#SecretKey
|
||||||
secret_key=<your_secret_key>
|
secret_key=<your_secret_key>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user