From 3229e7e9552215dfc0a588a2a765ae3b3293fdf2 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Sun, 18 Apr 2021 00:21:05 +0200 Subject: [PATCH] Fix SimulatorCommand linkage --- .../features/simulator/SimulatorCommand.java | 3 +++ .../features/simulator/SimulatorPosition.java | 23 ------------------- .../simulator/TNTSimulatorListener.java | 3 +++ .../show/SimulatorEntityShowMode.java | 11 ++++----- 4 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorPosition.java diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java index b25f2413..70d0fed8 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorCommand.java @@ -23,9 +23,12 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; import de.steamwar.bausystem.SWUtils; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; import de.steamwar.command.SWCommand; import org.bukkit.entity.Player; +@Linked(LinkageType.LISTENER) public class SimulatorCommand extends SWCommand { public SimulatorCommand() { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorPosition.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorPosition.java deleted file mode 100644 index 9e76bffb..00000000 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/SimulatorPosition.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2021 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.bausystem.features.simulator; - -public class SimulatorPosition { -} diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java index 1ef92b0a..274972e6 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/TNTSimulatorListener.java @@ -23,6 +23,8 @@ package de.steamwar.bausystem.features.simulator; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.Permission; +import de.steamwar.bausystem.linkage.LinkageType; +import de.steamwar.bausystem.linkage.Linked; import org.bukkit.FluidCollisionMode; import org.bukkit.Location; import org.bukkit.entity.Entity; @@ -39,6 +41,7 @@ import org.bukkit.util.Vector; import static de.steamwar.bausystem.features.simulator.TNTSimulator.WAND; import static de.steamwar.bausystem.features.simulator.TNTSimulator.get; +@Linked(LinkageType.LISTENER) public class TNTSimulatorListener implements Listener { private boolean permissionCheck(Player player) { diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java index c78f8377..8a2ae390 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/simulator/show/SimulatorEntityShowMode.java @@ -35,8 +35,7 @@ public class SimulatorEntityShowMode implements ShowMode { protected final Player player; - private final Map tntEntityMap = new HashMap<>(); - private final Map updateEntityMap = new HashMap<>(); + private final Map entityMap = new HashMap<>(); public SimulatorEntityShowMode(Player player) { this.player = player; @@ -45,7 +44,7 @@ public class SimulatorEntityShowMode implements ShowMode { @Override public void show(Position position) { RoundedPosition roundedPosition = new RoundedPosition(position); - AbstractSimulatorEntity entity = tntEntityMap.computeIfAbsent(roundedPosition, pos -> createEntity(player, position.getLocation(), true)); + AbstractSimulatorEntity entity = entityMap.computeIfAbsent(roundedPosition, pos -> createEntity(player, position.getLocation(), true)); entity.display(player); } @@ -55,10 +54,8 @@ public class SimulatorEntityShowMode implements ShowMode { @Override public void hide() { - tntEntityMap.forEach((roundedPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); - tntEntityMap.clear(); - updateEntityMap.forEach((roundedPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); - updateEntityMap.clear(); + entityMap.forEach((roundedPosition, abstractTraceEntity) -> abstractTraceEntity.hide(player, true)); + entityMap.clear(); } }