-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
166 additions
and
44 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
.idea/libraries/Maven__org_spigotmc_spigot_api_1_16_5_R0_1_SNAPSHOT.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,63 @@ | ||
package bingo.teleporter; | ||
|
||
import bingo.BingoPlugin; | ||
import core.Utils; | ||
import core.timer.TimerType; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.HashMap; | ||
|
||
public class Teleporter { | ||
|
||
private static boolean enabled; | ||
private static int time; | ||
private static int radius; | ||
private static BingoPlugin bingoPlugin; | ||
|
||
|
||
private static HashMap<String, TeleporterTimer> playerCountdown = new HashMap<String, TeleporterTimer>(); | ||
|
||
public Teleporter(BingoPlugin bingoPlugin, boolean enabled, int time, int radius) { | ||
Teleporter.enabled = enabled; | ||
Teleporter.time = time; | ||
Teleporter.radius = radius; | ||
Teleporter.bingoPlugin = bingoPlugin; | ||
} | ||
|
||
public void init() { | ||
if (enabled) { | ||
for (Player player : Bukkit.getOnlinePlayers()) { | ||
TeleporterTimer teleporterTimer = new TeleporterTimer(bingoPlugin, TimerType.DECREASING, "", "", true, Utils.colorize("Du kannst dich wieder &bteleportieren&f!"), player); | ||
teleporterTimer.setSeconds(time); | ||
teleporterTimer.resume(); | ||
playerCountdown.put(player.getDisplayName(), teleporterTimer); | ||
} | ||
} | ||
} | ||
|
||
public void enable() { | ||
enabled = true; | ||
} | ||
|
||
public void disable() { | ||
enabled = false; | ||
} | ||
|
||
public static boolean canTP(Player player){ | ||
return playerCountdown.get(player.getDisplayName()).getTicks() == 0; | ||
} | ||
|
||
public static void teleport(Player player){ | ||
TeleporterTimer teleporterTimer = playerCountdown.get(player.getDisplayName()); | ||
teleporterTimer.setSeconds(time); | ||
teleporterTimer.resume(); | ||
Utils.sendDebugMessage("&cPlayer has been teleported"); | ||
playerCountdown.put(player.getDisplayName(), teleporterTimer); | ||
bingo.Utils.scatterPlayer(player, radius); | ||
} | ||
|
||
public static TeleporterTimer getTimer(Player player){ | ||
return playerCountdown.get(player.getDisplayName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters