Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
c64bdae149
Commit
dd3bd868a9
@ -1,59 +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 <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package de.steamwar.bausystem.features.warp;
|
|
||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
|
||||||
import de.steamwar.inventory.SWItem;
|
|
||||||
import lombok.experimental.UtilityClass;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Particle;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
|
|
||||||
@UtilityClass
|
|
||||||
public class Moon {
|
|
||||||
|
|
||||||
public static void startMoon(Player player) {
|
|
||||||
player.getInventory().setHelmet(new SWItem(Material.GLASS, BauSystem.MESSAGE.parse("WARP_MOON_ITEM_NAME", player)).getItemStack());
|
|
||||||
AtomicInteger countDown = new AtomicInteger(5);
|
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask -> {
|
|
||||||
if (countDown.get() == 0) {
|
|
||||||
AtomicInteger iter = new AtomicInteger(1000);
|
|
||||||
Bukkit.getScheduler().runTaskTimer(BauSystem.getInstance(), bukkitTask1 -> {
|
|
||||||
if (player.getLocation().getY() > 300 || iter.getAndDecrement() <= 0) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 60 * 5 * 20, 1, false, false));
|
|
||||||
bukkitTask1.cancel();
|
|
||||||
} else {
|
|
||||||
player.setVelocity(player.getVelocity().add(new Vector(0, 0.2, 0)));
|
|
||||||
player.getWorld().spawnParticle(Particle.FLAME, player.getLocation(), 5);
|
|
||||||
}
|
|
||||||
}, 0, 1);
|
|
||||||
bukkitTask.cancel();
|
|
||||||
} else {
|
|
||||||
BauSystem.MESSAGE.sendPrefixless("WARP_MOON_COUNTDOOWN", player, countDown.getAndDecrement());
|
|
||||||
}
|
|
||||||
}, 0, 20);
|
|
||||||
}
|
|
||||||
}
|
|
@ -56,11 +56,6 @@ public class WarpCommand extends SWCommand implements Disable, Enable {
|
|||||||
return SWCommandUtils.createMapper(Warp::getWarp, (commandSender, s) -> new ArrayList<>(Warp.getWarpNames()));
|
return SWCommandUtils.createMapper(Warp::getWarp, (commandSender, s) -> new ArrayList<>(Warp.getWarpNames()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Register(value = "moon", noTabComplete = true)
|
|
||||||
public void tpMoon(Player p) {
|
|
||||||
Moon.startMoon(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Register(value = "add", description = "WARP_HELP_ADD")
|
@Register(value = "add", description = "WARP_HELP_ADD")
|
||||||
@Register("create")
|
@Register("create")
|
||||||
public void addWarp(@Guard Player player, String name) {
|
public void addWarp(@Guard Player player, String name) {
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren