Update the naming of CustomScriptListener.java to CustomScriptManager
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
399ae8b0ea
Commit
5407c3f9b4
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.region;
|
package de.steamwar.bausystem.features.region;
|
||||||
|
|
||||||
import de.steamwar.bausystem.features.script.CustomScriptListener;
|
import de.steamwar.bausystem.features.script.CustomScriptManager;
|
||||||
import de.steamwar.bausystem.features.script.EventType;
|
import de.steamwar.bausystem.features.script.EventType;
|
||||||
import de.steamwar.bausystem.linkage.LinkageType;
|
import de.steamwar.bausystem.linkage.LinkageType;
|
||||||
import de.steamwar.bausystem.linkage.Linked;
|
import de.steamwar.bausystem.linkage.Linked;
|
||||||
@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
public class TNTListener implements Listener {
|
public class TNTListener implements Listener {
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
private CustomScriptListener customScriptListener;
|
private CustomScriptManager customScriptManager;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onExplode(EntityExplodeEvent event) {
|
public void onExplode(EntityExplodeEvent event) {
|
||||||
@ -69,7 +69,7 @@ public class TNTListener implements Listener {
|
|||||||
Region region = Region.getRegion(event.getLocation());
|
Region region = Region.getRegion(event.getLocation());
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
if (region.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||||
customScriptListener.callEvent(EventType.TNTExplodeInBuild, player, event);
|
customScriptManager.callEvent(EventType.TNTExplodeInBuild, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Linked(LinkageType.LISTENER)
|
@Linked(LinkageType.LISTENER)
|
||||||
public class CustomScriptListener implements Listener {
|
public class CustomScriptManager implements Listener {
|
||||||
|
|
||||||
private final Map<Player, List<CustomScript.Script>> playerMap = Collections.synchronizedMap(new HashMap<>()); // new ConcurrentHashMap<>();
|
private final Map<Player, List<CustomScript.Script>> playerMap = Collections.synchronizedMap(new HashMap<>()); // new ConcurrentHashMap<>();
|
||||||
|
|
@ -25,7 +25,7 @@ public class ScriptCommand extends SWCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
private CustomScriptListener customScriptListener = null;
|
private CustomScriptManager customScriptManager = null;
|
||||||
|
|
||||||
private static List<SWListInv.SWListEntry<SpecialCommand>> swItems = new ArrayList<>();
|
private static List<SWListInv.SWListEntry<SpecialCommand>> swItems = new ArrayList<>();
|
||||||
|
|
||||||
@ -152,6 +152,6 @@ public class ScriptCommand extends SWCommand {
|
|||||||
|
|
||||||
@Register(value = "menu", description = "SCRIPT_COMMAND_HELP_MENU")
|
@Register(value = "menu", description = "SCRIPT_COMMAND_HELP_MENU")
|
||||||
public void menuGUICommand(Player p) {
|
public void menuGUICommand(Player p) {
|
||||||
customScriptListener.openCommandsMenu(p);
|
customScriptManager.openCommandsMenu(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ import java.util.Set;
|
|||||||
public class ScriptEventListener implements Listener {
|
public class ScriptEventListener implements Listener {
|
||||||
|
|
||||||
@LinkedInstance
|
@LinkedInstance
|
||||||
private CustomScriptListener customScriptListener;
|
private CustomScriptManager customScriptManager;
|
||||||
|
|
||||||
private static final Set<Player> LAST_FS = new HashSet<>();
|
private static final Set<Player> LAST_FS = new HashSet<>();
|
||||||
|
|
||||||
@ -58,18 +58,18 @@ public class ScriptEventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
customScriptListener.callEvent(EventType.SelfJoin, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.SelfJoin, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerQuit(PlayerQuitEvent event) {
|
public void onPlayerQuit(PlayerQuitEvent event) {
|
||||||
customScriptListener.callEvent(EventType.SelfLeave, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.SelfLeave, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
|
||||||
if (LAST_FS.contains(event.getPlayer())) {
|
if (LAST_FS.contains(event.getPlayer())) {
|
||||||
customScriptListener.callEvent(EventType.FF, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.FF, event.getPlayer(), event);
|
||||||
} else {
|
} else {
|
||||||
LAST_FS.add(event.getPlayer());
|
LAST_FS.add(event.getPlayer());
|
||||||
}
|
}
|
||||||
@ -77,21 +77,21 @@ public class ScriptEventListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
customScriptListener.callEvent(EventType.PlaceBlock, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.PlaceBlock, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
customScriptListener.callEvent(EventType.BreakBlock, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.BreakBlock, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
|
||||||
customScriptListener.callEvent(EventType.RightClick, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.RightClick, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
|
||||||
customScriptListener.callEvent(EventType.LeftClick, event.getPlayer(), event);
|
customScriptManager.callEvent(EventType.LeftClick, event.getPlayer(), event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ public class ScriptEventListener implements Listener {
|
|||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||||
customScriptListener.callEvent(EventType.TNTSpawn, player, event);
|
customScriptManager.callEvent(EventType.TNTSpawn, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,7 +118,7 @@ public class ScriptEventListener implements Listener {
|
|||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
if (tntRegion.inRegion(player.getLocation(), RegionType.NORMAL, RegionExtensionType.NORMAL)) {
|
||||||
customScriptListener.callEvent(EventType.TNTExplode, player, event);
|
customScriptManager.callEvent(EventType.TNTExplode, player, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren