Skip to content

Commit

Permalink
feat: disable weather change on match world
Browse files Browse the repository at this point in the history
  • Loading branch information
siloneco committed Nov 21, 2022
1 parent 28ec5e2 commit af03409
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/net/azisaba/lgwneo/listener/GlobalMatchListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.weather.WeatherChangeEvent;

/**
* 全モードに適用するリスナーを登録するクラス
Expand Down Expand Up @@ -169,4 +170,18 @@ public void onBlockPlace(BlockPlaceEvent e) {
}
e.setCancelled(true);
}

/*
* 試合ワールドの天候変化を無効化するListener
*/
@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
String worldName = e.getWorld().getName();
Match match = plugin.getMatchOrganizer().getMatch(worldName);
if (match == null) {
return;
}

e.setCancelled(true);
}
}

0 comments on commit af03409

Please sign in to comment.