Merge pull request #3 from Combustible/merge_part_1

Merge part 1
This commit is contained in:
NotMyFault 2018-12-21 22:30:04 +01:00 committed by GitHub
commit 74fade22a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 370 additions and 66 deletions

1
.gitignore vendored
View File

@ -10,7 +10,6 @@ eclipse
bin
build
target
gradle
.gradle
forge-download
out

16
HEADER.txt Normal file
View File

@ -0,0 +1,16 @@
WorldEdit, a Minecraft world manipulation toolkit
Copyright (C) sk89q <http://www.sk89q.com>
Copyright (C) WorldEdit team and contributors
This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

View File

@ -1,5 +1,3 @@
print new File('splash.txt').text
buildscript {
repositories {
mavenLocal()
@ -16,15 +14,21 @@ buildscript {
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.3.0'
classpath 'org.ajoberstar:gradle-git:1.5.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.4'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.7.5'
classpath 'org.ajoberstar:gradle-git:1.7.2'
}
}
plugins {
id 'net.minecrell.licenser' version '0.4.1' apply false
}
apply plugin: 'java'
clean { delete "target" }
print new File('splash.txt').text
group = 'com.boydti.fawe'
def revision = ""
def buildNumber = ""
@ -57,9 +61,8 @@ subprojects {
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = 1.8
targetCompatibility = 1.8
// Enable this requires putting license header files in many, many FAWE files
//apply plugin: 'net.minecrell.licenser'
ext.internalVersion = version
@ -70,10 +73,11 @@ subprojects {
repositories {
mavenCentral()
maven { url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/" }
maven { url "http://repo.bukkit.org/content/groups/public" }
maven { url "http://maven.sk89q.com/repo/" }
maven { url "http://repo.maven.apache.org/maven2" }
// Fawe
maven {url "http://ci.athion.net/job/FAWE-WorldGuard-1.13/ws/mvn/"}
maven {url "https://mvnrepository.com/artifact/"}
maven {url "http://repo.dmulloy2.net/content/groups/public/"}
maven {url "https://repo.destroystokyo.com/repository/maven-public//"}
@ -88,6 +92,13 @@ subprojects {
maven {url "http://ci.emc.gs/nexus/content/groups/aikar/" }
}
if (JavaVersion.current().isJava8Compatible()) {
// Java 8 turns on doclint which we fail
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
@ -95,6 +106,7 @@ subprojects {
artifacts {
archives jar
archives javadocJar
}
if (!(name.equals('worldedit-forge') || name.equals('worldedit-sponge'))) {
@ -122,4 +134,10 @@ subprojects {
exclude '.cache'
exclude 'LICENSE*'
}
// Enable this requires putting license header files in many, many FAWE files
//license {
// header = rootProject.file("HEADER.txt")
// include '**/*.java'
//}
}

View File

@ -53,11 +53,4 @@
<module name="ParameterName"/>
<!-- <module name="TypeName"/> Unlikely that we would miss this in a PR -->
</module>
<!-- Require the header, something that many people forget and we hate to fix -->
<!-- You should configure the header in your IDE -->
<module name="Header">
<property name="headerFile" value="${basedir}/config/checkstyle/header.txt"/>
<property name="fileExtensions" value="java"/>
</module>
</module>

View File

@ -1,18 +0,0 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

Binary file not shown.

View File

@ -1,6 +1,5 @@
#Thu Jul 26 14:29:48 AEST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -0,0 +1,91 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.bukkit;
/**
* Adds methods to test if different API methods are possible based on implementation.
*/
public class BukkitImplementationTester {
private BukkitImplementationTester() {
}
/**
* Known Bukkit implementations
*/
public enum BukkitImplementation {
CRAFTBUKKIT,
SPIGOT,
PAPER,
}
private static final String implementationMessage = "************************************************" +
"* Note: PaperMC (https://papermc.io/) is *" +
"* recommended for optimal performance with *" +
"* WorldEdit, WorldGuard, or CraftBook. *" +
"************************************************";
private static BukkitImplementation implementation;
/**
* Gets the implementation currently in use on the server.
*
* @return The server implementation
*/
public static BukkitImplementation getImplementation() {
if (implementation == null) {
try {
Class.forName("com.destroystokyo.paper.PaperConfig");
implementation = BukkitImplementation.PAPER;
} catch (Exception e) {
try {
Class.forName("org.spigotmc.SpigotConfig");
implementation = BukkitImplementation.SPIGOT;
} catch (Exception e2) {
implementation = BukkitImplementation.CRAFTBUKKIT;
}
}
if (implementation != BukkitImplementation.PAPER) {
// Bukkit.getServer().getConsoleSender().sendMessage(implementationMessage); // TODO Decide if good idea.
}
}
return implementation;
}
/**
* Check if this implementation is compatible with Spigot APIs
*
* @return If compatible with Spigot APIs
*/
public static boolean isSpigotCompatible() {
return getImplementation() == BukkitImplementation.SPIGOT || getImplementation() == BukkitImplementation.PAPER;
}
/**
* Check if this implementation is compatible with Paper APIs
*
* @return If compatible with Paper APIs
*/
public static boolean isPaperCompatible() {
return getImplementation() == BukkitImplementation.PAPER;
}
}

View File

@ -177,6 +177,9 @@ public class WorldEditPlugin extends JavaPlugin //implements TabCompleter
// platforms to be worried about... at the current time of writing
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
// Setup the BukkitImplementationTester.
BukkitImplementationTester.getImplementation();
{ // Register 1.13 Material ids with LegacyMapper
LegacyMapper legacyMapper = LegacyMapper.getInstance();
for (Material m : Material.values()) {

View File

@ -94,7 +94,7 @@ public interface BukkitImplAdapter<T> extends IBukkitAdapter {
Entity createEntity(Location location, BaseEntity state);
/**
* Get a map of string -> properties
* Get a map of {@code string -> property}.
*
* @param blockType The block type
* @return The properties map

View File

@ -41,7 +41,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent {
* Create a new instance.
*
* @param extent the extent
* @param limit the limit (>= 0) or -1 for no limit
* @param limit the limit (&gt;= 0) or -1 for no limit
*/
public BlockChangeLimiter(Extent extent, int limit) {
super(extent);
@ -51,7 +51,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent {
/**
* Get the limit.
*
* @return the limit (>= 0) or -1 for no limit
* @return the limit (&gt;= 0) or -1 for no limit
*/
public int getLimit() {
return limit;
@ -60,7 +60,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent {
/**
* Set the limit.
*
* @param limit the limit (>= 0) or -1 for no limit
* @param limit the limit (&gt;= 0) or -1 for no limit
*/
public void setLimit(int limit) {
checkArgument(limit >= -1, "limit >= -1 required");

View File

@ -17,7 +17,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.internal.annotation;
import com.sk89q.worldedit.Vector;

View File

@ -40,7 +40,7 @@ import java.util.Map;
* <p>Supported operators:</p>
* <p>
* <ul>
* <li>Logical: &&, ||, ! (unary)</li>
* <li>Logical: &amp;&amp;, ||, ! (unary)</li>
* <li>Bitwise: ~ (unary), &gt;&gt;, &lt;&lt;</li>
* <li>Arithmetic: +, -, *, /, % (modulo), ^ (power), - (unary), --, ++ (prefix only)</li>
* <li>Comparison: &lt;=, &gt;=, &gt;, &lt;, ==, !=, ~= (near)</li>

View File

@ -112,7 +112,7 @@ public class SimpleDispatcher implements Dispatcher {
@Override
public Object call(String arguments, CommandLocals locals, String[] parentCommands) throws CommandException {
// We have permission for this command if we have permissions for subcommands
if (!testPermission(locals)) {
if (parentCommands.length != 0 && !testPermission(locals)) {
throw new CommandPermissionsException();
}

View File

@ -201,7 +201,7 @@ public class ParametricCallable extends AParametricCallable {
@Override
public Object call(String stringArguments, CommandLocals locals, String[] parentCommands) throws CommandException {
// Test permission
if (!testPermission(locals)) {
if (parentCommands.length != 0 && !testPermission(locals)) {
throw new CommandPermissionsException();
}
locals.putIfAbsent(CommandCallable.class, this);

View File

@ -221,7 +221,7 @@ public enum Style {
* ChatColor.COLOR_CODE color code character. The alternate color code character will only be replaced
* if it is immediately followed by 0-9, A-F, a-f, K-O, k-o, R or r.
*
* @param altColorChar The alternate color code character to replace. Ex: &
* @param altColorChar The alternate color code character to replace. Ex: &amp;
* @param textToTranslate Text containing the alternate color code character.
* @return Text containing the ChatColor.COLOR_CODE color code character.
*/

View File

@ -99,7 +99,7 @@ public interface BlockType extends FawePattern, Comparable<BlockTypes> {
}
/**
* Gets the properties of this BlockType in a key->property mapping.
* Gets the properties of this BlockType in a {@code key->property} mapping.
*
* @return The properties map
*/

View File

@ -219,19 +219,24 @@ public enum BlockTypes implements BlockType {
DARK_PRISMARINE_SLAB,
DARK_PRISMARINE_STAIRS,
DAYLIGHT_DETECTOR,
DEAD_BRAIN_CORAL,
DEAD_BRAIN_CORAL_BLOCK,
DEAD_BRAIN_CORAL_FAN,
DEAD_BRAIN_CORAL_WALL_FAN,
DEAD_BUBBLE_CORAL,
DEAD_BUBBLE_CORAL_BLOCK,
DEAD_BUBBLE_CORAL_FAN,
DEAD_BUBBLE_CORAL_WALL_FAN,
DEAD_BUSH,
DEAD_FIRE_CORAL,
DEAD_FIRE_CORAL_BLOCK,
DEAD_FIRE_CORAL_FAN,
DEAD_FIRE_CORAL_WALL_FAN,
DEAD_HORN_CORAL,
DEAD_HORN_CORAL_BLOCK,
DEAD_HORN_CORAL_FAN,
DEAD_HORN_CORAL_WALL_FAN,
DEAD_TUBE_CORAL,
DEAD_TUBE_CORAL_BLOCK,
DEAD_TUBE_CORAL_FAN,
DEAD_TUBE_CORAL_WALL_FAN,
@ -654,11 +659,6 @@ public enum BlockTypes implements BlockType {
YELLOW_WOOL,
ZOMBIE_HEAD,
ZOMBIE_WALL_HEAD,
DEAD_BRAIN_CORAL,
DEAD_BUBBLE_CORAL,
DEAD_FIRE_CORAL,
DEAD_HORN_CORAL,
DEAD_TUBE_CORAL,
;

View File

@ -245,15 +245,20 @@ public enum ItemTypes implements ItemType {
DARK_PRISMARINE_SLAB,
DARK_PRISMARINE_STAIRS,
DAYLIGHT_DETECTOR,
DEAD_BRAIN_CORAL,
DEAD_BRAIN_CORAL_BLOCK,
DEAD_BRAIN_CORAL_FAN,
DEAD_BUBBLE_CORAL,
DEAD_BUBBLE_CORAL_BLOCK,
DEAD_BUBBLE_CORAL_FAN,
DEAD_BUSH,
DEAD_FIRE_CORAL,
DEAD_FIRE_CORAL_BLOCK,
DEAD_FIRE_CORAL_FAN,
DEAD_HORN_CORAL,
DEAD_HORN_CORAL_BLOCK,
DEAD_HORN_CORAL_FAN,
DEAD_TUBE_CORAL,
DEAD_TUBE_CORAL_BLOCK,
DEAD_TUBE_CORAL_FAN,
DEBUG_STICK,

View File

@ -46,8 +46,8 @@ public abstract class ChunkStore implements Closeable {
public static final int DATA_VERSION_MC_1_13 = 1519;
/**
* >> to chunk
* << from chunk
* {@code >>} - to chunk
* {@code <<} - from chunk
*/
public static final int CHUNK_SHIFTS = 4;

View File

@ -3949,6 +3949,31 @@
"hasContainer": true
}
},
{
"id": "minecraft:dead_brain_coral",
"localizedName": "Dead Brain Coral",
"material": {
"powerSource": false,
"lightValue": 0,
"hardness": 0.0,
"resistance": 0.0,
"ticksRandomly": false,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
"movementBlocker": true,
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#707070",
"isTranslucent": false,
"hasContainer": false
}
},
{
"id": "minecraft:dead_brain_coral_block",
"localizedName": "Dead Brain Coral Block",
@ -4024,6 +4049,31 @@
"hasContainer": false
}
},
{
"id": "minecraft:dead_bubble_coral",
"localizedName": "Dead Bubble Coral",
"material": {
"powerSource": false,
"lightValue": 0,
"hardness": 0.0,
"resistance": 0.0,
"ticksRandomly": false,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
"movementBlocker": true,
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#707070",
"isTranslucent": false,
"hasContainer": false
}
},
{
"id": "minecraft:dead_bubble_coral_block",
"localizedName": "Dead Bubble Coral Block",
@ -4124,6 +4174,31 @@
"hasContainer": false
}
},
{
"id": "minecraft:dead_fire_coral",
"localizedName": "Dead Fire Coral",
"material": {
"powerSource": false,
"lightValue": 0,
"hardness": 0.0,
"resistance": 0.0,
"ticksRandomly": false,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
"movementBlocker": true,
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#707070",
"isTranslucent": false,
"hasContainer": false
}
},
{
"id": "minecraft:dead_fire_coral_block",
"localizedName": "Dead Fire Coral Block",
@ -4199,6 +4274,31 @@
"hasContainer": false
}
},
{
"id": "minecraft:dead_horn_coral",
"localizedName": "Dead Horn Coral",
"material": {
"powerSource": false,
"lightValue": 0,
"hardness": 0.0,
"resistance": 0.0,
"ticksRandomly": false,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
"movementBlocker": true,
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#707070",
"isTranslucent": false,
"hasContainer": false
}
},
{
"id": "minecraft:dead_horn_coral_block",
"localizedName": "Dead Horn Coral Block",
@ -4274,6 +4374,31 @@
"hasContainer": false
}
},
{
"id": "minecraft:dead_tube_coral",
"localizedName": "Dead Tube Coral",
"material": {
"powerSource": false,
"lightValue": 0,
"hardness": 0.0,
"resistance": 0.0,
"ticksRandomly": false,
"fullCube": false,
"slipperiness": 0.6,
"liquid": false,
"solid": true,
"movementBlocker": true,
"burnable": false,
"opaque": true,
"replacedDuringPlacement": false,
"toolRequired": true,
"fragileWhenPushed": false,
"unpushable": false,
"mapColor": "#707070",
"isTranslucent": false,
"hasContainer": false
}
},
{
"id": "minecraft:dead_tube_coral_block",
"localizedName": "Dead Tube Coral Block",
@ -6995,7 +7120,7 @@
"fragileWhenPushed": true,
"unpushable": false,
"mapColor": "#ff0000",
"isTranslucent": true,
"isTranslucent": false,
"hasContainer": false
}
},
@ -14045,7 +14170,7 @@
"fragileWhenPushed": true,
"unpushable": false,
"mapColor": "#4040ff",
"isTranslucent": true,
"isTranslucent": false,
"hasContainer": false
}
},

View File

@ -803,6 +803,10 @@
"id": "minecraft:daylight_detector",
"localizedName": "Air"
},
{
"id": "minecraft:dead_brain_coral",
"localizedName": "Air"
},
{
"id": "minecraft:dead_brain_coral_block",
"localizedName": "Air"
@ -811,6 +815,10 @@
"id": "minecraft:dead_brain_coral_fan",
"localizedName": "Air"
},
{
"id": "minecraft:dead_bubble_coral",
"localizedName": "Air"
},
{
"id": "minecraft:dead_bubble_coral_block",
"localizedName": "Air"
@ -823,6 +831,10 @@
"id": "minecraft:dead_bush",
"localizedName": "Air"
},
{
"id": "minecraft:dead_fire_coral",
"localizedName": "Air"
},
{
"id": "minecraft:dead_fire_coral_block",
"localizedName": "Air"
@ -831,6 +843,10 @@
"id": "minecraft:dead_fire_coral_fan",
"localizedName": "Air"
},
{
"id": "minecraft:dead_horn_coral",
"localizedName": "Air"
},
{
"id": "minecraft:dead_horn_coral_block",
"localizedName": "Air"
@ -839,6 +855,10 @@
"id": "minecraft:dead_horn_coral_fan",
"localizedName": "Air"
},
{
"id": "minecraft:dead_tube_coral",
"localizedName": "Air"
},
{
"id": "minecraft:dead_tube_coral_block",
"localizedName": "Air"
@ -1749,7 +1769,7 @@
},
{
"id": "minecraft:lingering_potion",
"localizedName": "Lingering Potion"
"localizedName": "Lingering Water Bottle"
},
{
"id": "minecraft:llama_spawn_egg",
@ -2237,7 +2257,7 @@
},
{
"id": "minecraft:potion",
"localizedName": "Potion"
"localizedName": "Water Bottle"
},
{
"id": "minecraft:powered_rail",
@ -2677,7 +2697,7 @@
},
{
"id": "minecraft:splash_potion",
"localizedName": "Splash Potion"
"localizedName": "Splash Water Bottle"
},
{
"id": "minecraft:sponge",
@ -2885,7 +2905,7 @@
},
{
"id": "minecraft:tipped_arrow",
"localizedName": "Tipped Arrow"
"localizedName": "Arrow of Poison"
},
{
"id": "minecraft:tnt",

View File

@ -16,6 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.forge;
import com.sk89q.worldedit.blocks.BaseItem;

View File

@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.io.Files;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.BlockVector2D;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.Vector;
@ -47,6 +48,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
import com.sk89q.worldedit.world.weather.WeatherType;
import com.sk89q.worldedit.world.weather.WeatherTypes;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.BlockOldLeaf;
@ -86,6 +89,7 @@ import net.minecraft.world.gen.feature.WorldGenTaiga1;
import net.minecraft.world.gen.feature.WorldGenTaiga2;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.DimensionManager;
import java.io.File;
@ -93,7 +97,6 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import javax.annotation.Nullable;
@ -351,25 +354,75 @@ public class ForgeWorld extends AbstractWorld {
return generator != null && generator.generate(getWorld(), random, ForgeAdapter.toBlockPos(position));
}
@Override
public void checkLoadedChunk(Vector pt) {
getWorld().getChunkFromBlockCoords(ForgeAdapter.toBlockPos(pt));
}
@Override
public void fixAfterFastMode(Iterable<BlockVector2D> chunks) {
fixLighting(chunks);
}
@Override
public void fixLighting(Iterable<BlockVector2D> chunks) {
World world = getWorld();
for (BlockVector2D chunk : chunks) {
world.getChunkFromChunkCoords(chunk.getBlockX(), chunk.getBlockZ()).resetRelightChecks();
}
}
@Override
public boolean playEffect(Vector position, int type, int data) {
getWorld().playEvent(type, ForgeAdapter.toBlockPos(position), data);
return true;
}
@Override
public WeatherType getWeather() {
// TODO Weather implementation
return null;
WorldInfo info = getWorld().getWorldInfo();
if (info.isThundering()) {
return WeatherTypes.THUNDER_STORM;
}
if (info.isRaining()) {
return WeatherTypes.RAIN;
}
return WeatherTypes.CLEAR;
}
@Override
public long getRemainingWeatherDuration() {
return 0;
WorldInfo info = getWorld().getWorldInfo();
if (info.isThundering()) {
return info.getThunderTime();
}
if (info.isRaining()) {
return info.getRainTime();
}
return info.getCleanWeatherTime();
}
@Override
public void setWeather(WeatherType weatherType) {
setWeather(weatherType, 0);
}
@Override
public void setWeather(WeatherType weatherType, long duration) {
WorldInfo info = getWorld().getWorldInfo();
if (WeatherTypes.THUNDER_STORM.equals(weatherType)) {
info.setCleanWeatherTime(0);
info.setThundering(true);
info.setThunderTime((int) duration);
} else if (WeatherTypes.RAIN.equals(weatherType)) {
info.setCleanWeatherTime(0);
info.setRaining(true);
info.setRainTime((int) duration);
} else if (WeatherTypes.CLEAR.equals(weatherType)) {
info.setRaining(false);
info.setThundering(false);
info.setCleanWeatherTime((int) duration);
}
}
@Override