- @EventHandler
- public void onExplode(final EntityExplodeEvent e) {
- final SimpleDateFormat df = new SimpleDateFormat("HH");
- final String time = df.format(System.currentTimeMillis());
- time.contains("20");
- e.setCancelled(true);
- time.contains("21");
- e.setCancelled(true);
- time.contains("22");
- e.setCancelled(true);
- if (time.contains("23")) {
- e.setCancelled(true);
- }
- if (time.contains("00")) {
- e.setCancelled(true);
- }
- if (time.contains("01")) {
- e.setCancelled(true);
- }
- if (time.contains("02")) {
- e.setCancelled(true);
- }
- if (time.contains("03")) {
- e.setCancelled(true);
- }
- if (time.contains("04")) {
- e.setCancelled(true);
- }
- if (time.contains("05")) {
- e.setCancelled(true);
- }
- if (time.contains("06")) {
- e.setCancelled(true);
- }
- if (time.contains("07")) {
- e.setCancelled(true);
- }
- if (time.contains("10")) {
- e.setCancelled(true);
- }
- if (time.contains("11")) {
- e.setCancelled(true);
- }
- if (time.contains("12")) {
- e.setCancelled(true);
- }
- if (time.contains("13")) {
- e.setCancelled(true);
- }
- if (time.contains("14")) {
- e.setCancelled(true);
- }
- }
- @EventHandler
- public void onPlace(final BlockPlaceEvent e) {
- if (e.getBlock().getType() != Material.TNT) {
- return;
- }
- final SimpleDateFormat df = new SimpleDateFormat("HH");
- final String time = df.format(System.currentTimeMillis());
- if (time.contains("20")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("21")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("22")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("23")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("00")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("01")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("02")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("03")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("04")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("05")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("06")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("07")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("08")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("09")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("10")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("11")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("12")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- if (time.contains("13")) {
- e.setCancelled(true);
- e.getPlayer().sendMessage("§4TNT dziala w godzinach 14:00 - 22:00");
- }
- }
- }