mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Add cause to Weather/ThunderChangeEvents
This commit is contained in:
parent
00ebe90031
commit
547577ccb6
2 changed files with 58 additions and 0 deletions
|
@ -12,10 +12,20 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean canceled;
|
private boolean canceled;
|
||||||
private final boolean to;
|
private final boolean to;
|
||||||
|
// Paper start
|
||||||
|
private final Cause cause;
|
||||||
|
|
||||||
|
public ThunderChangeEvent(@NotNull final World world, final boolean to, @NotNull final Cause cause) {
|
||||||
|
super(world);
|
||||||
|
this.to = to;
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated // Paper end
|
||||||
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
|
public ThunderChangeEvent(@NotNull final World world, final boolean to) {
|
||||||
super(world);
|
super(world);
|
||||||
this.to = to;
|
this.to = to;
|
||||||
|
this.cause = Cause.UNKNOWN; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,4 +57,23 @@ public class ThunderChangeEvent extends WeatherEvent implements Cancellable {
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Gets the cause of the weather change.
|
||||||
|
*
|
||||||
|
* @return the weather change cause
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Cause getCause() {
|
||||||
|
return this.cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Cause {
|
||||||
|
COMMAND,
|
||||||
|
NATURAL,
|
||||||
|
SLEEP,
|
||||||
|
PLUGIN,
|
||||||
|
UNKNOWN
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,10 +12,20 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private boolean canceled;
|
private boolean canceled;
|
||||||
private final boolean to;
|
private final boolean to;
|
||||||
|
// Paper start
|
||||||
|
private final Cause cause;
|
||||||
|
|
||||||
|
public WeatherChangeEvent(@NotNull final World world, final boolean to, @NotNull Cause cause) {
|
||||||
|
super(world);
|
||||||
|
this.to = to;
|
||||||
|
this.cause = cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated // Paper end
|
||||||
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
|
public WeatherChangeEvent(@NotNull final World world, final boolean to) {
|
||||||
super(world);
|
super(world);
|
||||||
this.to = to;
|
this.to = to;
|
||||||
|
this.cause = Cause.UNKNOWN; // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,4 +57,23 @@ public class WeatherChangeEvent extends WeatherEvent implements Cancellable {
|
||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
// Paper start
|
||||||
|
/**
|
||||||
|
* Gets the cause of the weather change.
|
||||||
|
*
|
||||||
|
* @return the weather change cause
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Cause getCause() {
|
||||||
|
return cause;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum Cause {
|
||||||
|
COMMAND,
|
||||||
|
NATURAL,
|
||||||
|
SLEEP,
|
||||||
|
PLUGIN,
|
||||||
|
UNKNOWN
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue