From 88fbfa0f44b53af91f55deac1c094fe6e280310c Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sat, 26 Mar 2022 11:55:22 +0100 Subject: [PATCH] Add MapsRotateListener --- src/de/steamwar/lobby/LobbySystem.java | 1 + .../lobby/listener/MapsRotateListener.java | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/de/steamwar/lobby/listener/MapsRotateListener.java diff --git a/src/de/steamwar/lobby/LobbySystem.java b/src/de/steamwar/lobby/LobbySystem.java index 9e19805..96cb5f5 100644 --- a/src/de/steamwar/lobby/LobbySystem.java +++ b/src/de/steamwar/lobby/LobbySystem.java @@ -57,6 +57,7 @@ public class LobbySystem extends JavaPlugin { new InventoryInteraction(); new WorldInteraction(); new PlayerSeatListener(); + new MapsRotateListener(); new AlphaWall(l -> l.getX() > 1199, AlphaWall.REFLECT_X); new AlphaWall(l -> l.getX() < 2977, AlphaWall.REFLECT_X); diff --git a/src/de/steamwar/lobby/listener/MapsRotateListener.java b/src/de/steamwar/lobby/listener/MapsRotateListener.java new file mode 100644 index 0000000..e098da0 --- /dev/null +++ b/src/de/steamwar/lobby/listener/MapsRotateListener.java @@ -0,0 +1,38 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2022 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.lobby.listener; + +import de.steamwar.lobby.command.ModifyCommand; +import org.bukkit.entity.ItemFrame; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEntityEvent; + +public class MapsRotateListener extends BasicListener { + + @EventHandler + public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { + if (ModifyCommand.modifying(event.getPlayer())) { + return; + } + if (event.getRightClicked() instanceof ItemFrame) { + event.setCancelled(true); + } + } +} -- 2.39.5