diff --git a/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameDisabledEvent.java b/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameDisabledEvent.java new file mode 100644 index 000000000..24d9bc52d --- /dev/null +++ b/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameDisabledEvent.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 ScreamingSandals + * + * This file is part of Screaming BedWars. + * + * Screaming BedWars 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. + * + * Screaming BedWars 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 Screaming BedWars. If not, see . + */ + +package org.screamingsandals.bedwars.api.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.screamingsandals.bedwars.api.game.Game; + +/** + * @author Bedwars Team + */ +public class BedWarsGameDisabledEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + private Game game; + + /** + * @param game + */ + public BedWarsGameDisabledEvent(Game game) { + this.game = game; + } + + @Override + public HandlerList getHandlers() { + return BedWarsGameDisabledEvent.handlers; + } + + /** + * @return game + */ + public Game getGame() { + return this.game; + } + + public static HandlerList getHandlerList() { + return BedWarsGameDisabledEvent.handlers; + } + +} diff --git a/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameEnabledEvent.java b/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameEnabledEvent.java new file mode 100644 index 000000000..7e87df86c --- /dev/null +++ b/api/src/main/java/org/screamingsandals/bedwars/api/events/BedWarsGameEnabledEvent.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2023 ScreamingSandals + * + * This file is part of Screaming BedWars. + * + * Screaming BedWars 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. + * + * Screaming BedWars 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 Screaming BedWars. If not, see . + */ + +package org.screamingsandals.bedwars.api.events; + +import org.bukkit.event.Event; +import org.bukkit.event.HandlerList; +import org.screamingsandals.bedwars.api.game.Game; + +/** + * @author Bedwars Team + */ +public class BedWarsGameEnabledEvent extends Event { + private static final HandlerList handlers = new HandlerList(); + private Game game; + + /** + * @param game + */ + public BedWarsGameEnabledEvent(Game game) { + this.game = game; + } + + @Override + public HandlerList getHandlers() { + return BedWarsGameEnabledEvent.handlers; + } + + /** + * @return game + */ + public Game getGame() { + return this.game; + } + + public static HandlerList getHandlerList() { + return BedWarsGameEnabledEvent.handlers; + } + +} diff --git a/build.gradle b/build.gradle index 1a54bdcdf..85bae901d 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { allprojects { group = 'org.screamingsandals.bedwars' - version = '0.2.31' + version = '0.2.32-SNAPSHOT' } if (version.toString().endsWith('-SNAPSHOT')) { diff --git a/plugin/src/main/java/org/screamingsandals/bedwars/game/Game.java b/plugin/src/main/java/org/screamingsandals/bedwars/game/Game.java index eaadf73b8..708908e34 100644 --- a/plugin/src/main/java/org/screamingsandals/bedwars/game/Game.java +++ b/plugin/src/main/java/org/screamingsandals/bedwars/game/Game.java @@ -1332,6 +1332,7 @@ public void run() { statusbar = BossBarSelector.getBossBar(lobbySpawn); } preparing = false; + Bukkit.getPluginManager().callEvent(new BedWarsGameEnabledEvent(this)); } } @@ -1348,6 +1349,7 @@ public void stop() { } else { afterRebuild = GameStatus.DISABLED; } + Bukkit.getPluginManager().callEvent(new BedWarsGameDisabledEvent(this)); } public void joinToGame(Player player) {