diff --git a/src/de/steamwar/misslewars/scripts/Script.java b/src/de/steamwar/misslewars/scripts/Script.java
index 98777cc..095dfaf 100644
--- a/src/de/steamwar/misslewars/scripts/Script.java
+++ b/src/de/steamwar/misslewars/scripts/Script.java
@@ -87,6 +87,8 @@ public class Script {
return new SlowMoScript(jsonObject);
case "cooldown":
return new CooldownScript(jsonObject);
+ case "randomplayer":
+ return new RandomPlayerScript(jsonObject);
default:
return null;
}
diff --git a/src/de/steamwar/misslewars/scripts/ScriptedItem.java b/src/de/steamwar/misslewars/scripts/ScriptedItem.java
index c70fb60..9f453d5 100644
--- a/src/de/steamwar/misslewars/scripts/ScriptedItem.java
+++ b/src/de/steamwar/misslewars/scripts/ScriptedItem.java
@@ -24,6 +24,7 @@ import de.steamwar.misslewars.scripts.utils.JsonUtils;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
+import org.bukkit.entity.LingeringPotion;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.PotionMeta;
diff --git a/src/de/steamwar/misslewars/scripts/implemented/RandomPlayerScript.java b/src/de/steamwar/misslewars/scripts/implemented/RandomPlayerScript.java
new file mode 100644
index 0000000..f689a4f
--- /dev/null
+++ b/src/de/steamwar/misslewars/scripts/implemented/RandomPlayerScript.java
@@ -0,0 +1,51 @@
+/*
+ *
+ * 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.misslewars.scripts.implemented;
+
+import com.google.gson.JsonObject;
+import de.steamwar.misslewars.MWTeam;
+import de.steamwar.misslewars.MissileWars;
+import de.steamwar.misslewars.scripts.RunnableScript;
+import de.steamwar.misslewars.scripts.RunnableScriptEvent;
+import org.bukkit.entity.Player;
+
+import java.util.LinkedList;
+import java.util.Random;
+
+public class RandomPlayerScript implements RunnableScript {
+
+ private Random random = new Random();
+
+ public RandomPlayerScript(JsonObject __) {
+ }
+
+ @Override
+ public boolean execute(RunnableScriptEvent runnableScriptEvent) {
+ MWTeam mwTeam = MissileWars.getBlueTeam();
+ if (Math.random() > 0.5) mwTeam = MissileWars.getRedTeam();
+ LinkedList players = mwTeam.getPlayers();
+ Player player = players.get(random.nextInt(players.size()));
+ runnableScriptEvent.setLocationType(RunnableScriptEvent.LocationType.CUSTOM);
+ runnableScriptEvent.setCustomLocation(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ(), player.getLocation().getPitch(), player.getLocation().getYaw());
+ return true;
+ }
+}