Files
KekWar/LobbySystem/src/de/steamwar/lobby/particle/ParticleTickData.java
T
2025-10-23 17:56:43 +02:00

71 lines
2.1 KiB
Java

/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 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 <https://www.gnu.org/licenses/>.
*/
package de.steamwar.lobby.particle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
@RequiredArgsConstructor
@AllArgsConstructor
@Getter
public class ParticleTickData {
private final World world;
private final Player player;
private Location location;
private final double deg;
private final boolean isMoving;
private boolean onlySelf = false;
private boolean onlyOthers = false;
public ParticleTickData withLocation(Location location) {
ParticleTickData particleTickData = copy();
particleTickData.location = location;
return particleTickData;
}
public ParticleTickData onlySelf() {
ParticleTickData particleTickData = copy();
particleTickData.onlySelf = true;
return particleTickData;
}
public ParticleTickData onlyOthers() {
ParticleTickData particleTickData = copy();
particleTickData.onlyOthers = true;
return particleTickData;
}
public Location getLocation() {
if (location == null) {
return player.getLocation();
}
return location;
}
public ParticleTickData copy() {
return new ParticleTickData(world, player, location, deg, isMoving, onlySelf, onlyOthers);
}
}