From 1e7e94d359f954337481827570748dc2493d8d4a Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 20 Jan 2022 08:19:46 +0100 Subject: [PATCH] Extract Point from HellsBells and Meteor --- .../fightsystem/event/HellsBells.java | 17 ------- .../de/steamwar/fightsystem/event/Meteor.java | 41 ++++++++--------- .../de/steamwar/fightsystem/event/Point.java | 44 +++++++++++++++++++ 3 files changed, 65 insertions(+), 37 deletions(-) create mode 100644 FightSystem_Core/src/de/steamwar/fightsystem/event/Point.java diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java index a089262..dbe75b4 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java @@ -152,23 +152,6 @@ public class HellsBells { } } - private static class Point { - - private final int x; - private final int y; - private final int z; - - public Point(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Location addAndToLocation(World world, int x, int y, int z) { - return new Location(world, this.x + x, this.y + y, this.z + z); //NOSONAR - } - } - private enum State { PRE(60, 80, 1), diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java b/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java index 0775fc6..b4b9e96 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java @@ -1,3 +1,22 @@ +/* + This file is a part of the SteamWar software. + + Copyright (C) 2020 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.fightsystem.event; import de.steamwar.fightsystem.Config; @@ -10,7 +29,6 @@ import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.fightsystem.winconditions.Winconditions; import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.World; import org.bukkit.entity.Fireball; import org.bukkit.entity.TNTPrimed; @@ -82,8 +100,8 @@ public class Meteor implements Listener { int zOffset = getStart(zLength); int yOffset = getHeightStart(); - Meteor.Point redStart = new Meteor.Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset); - Meteor.Point blueStart = new Meteor.Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset); + Point redStart = new Point(Config.RedExtendRegion.getMinX() + xOffset, Config.RedExtendRegion.getMaxY() + yOffset, Config.RedExtendRegion.getMaxZ() - zOffset); + Point blueStart = new Point(Config.BlueExtendRegion.getMinX() + xOffset, Config.BlueExtendRegion.getMaxY() + yOffset, Config.BlueExtendRegion.getMinZ() + zOffset); vector.setX(random.nextDouble() - 0.5); vector.setZ(random.nextDouble() - 0.5); @@ -146,23 +164,6 @@ public class Meteor implements Listener { } } - private static class Point { - - private final int x; - private final int y; - private final int z; - - public Point(int x, int y, int z) { - this.x = x; - this.y = y; - this.z = z; - } - - public Location toLocation(World world) { - return new Location(world, this.x, this.y, this.z); //NOSONAR - } - } - private enum State { PRE(60, 80, 1, 0, 0, 0), diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/event/Point.java b/FightSystem_Core/src/de/steamwar/fightsystem/event/Point.java new file mode 100644 index 0000000..13dc087 --- /dev/null +++ b/FightSystem_Core/src/de/steamwar/fightsystem/event/Point.java @@ -0,0 +1,44 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2020 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.fightsystem.event; + +import org.bukkit.Location; +import org.bukkit.World; + +class Point { + + private final int x; + private final int y; + private final int z; + + public Point(int x, int y, int z) { + this.x = x; + this.y = y; + this.z = z; + } + + public Location toLocation(World world) { + return new Location(world, this.x, this.y, this.z); //NOSONAR + } + + public Location addAndToLocation(World world, int x, int y, int z) { + return new Location(world, this.x + x, this.y + y, this.z + z); //NOSONAR + } +}