glow fix, on join code change
This commit is contained in:
parent
3ad77301c9
commit
0503909014
2 changed files with 4 additions and 28 deletions
|
@ -22,7 +22,6 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
import org.bukkit.event.player.PlayerJoinEvent;
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerKickEvent;
|
import org.bukkit.event.player.PlayerKickEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
|
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import net.tylermurphy.hideAndSeek.Main;
|
import net.tylermurphy.hideAndSeek.Main;
|
||||||
|
@ -34,32 +33,14 @@ public class EventListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||||
event.getPlayer().setLevel(0);
|
event.getPlayer().setLevel(0);
|
||||||
if(!Functions.setup()) return;
|
|
||||||
HiderTeam.removeEntry(event.getPlayer().getName());
|
HiderTeam.removeEntry(event.getPlayer().getName());
|
||||||
SeekerTeam.removeEntry(event.getPlayer().getName());
|
SeekerTeam.removeEntry(event.getPlayer().getName());
|
||||||
SpectatorTeam.removeEntry(event.getPlayer().getName());
|
SpectatorTeam.removeEntry(event.getPlayer().getName());
|
||||||
if(status.equals("Playing") || status.equals("Starting")) {
|
if(!Functions.setup()) return;
|
||||||
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld)) {
|
if(event.getPlayer().getWorld().getName().equals("hideandseek_"+spawnWorld) || event.getPlayer().getWorld().getName().equals(lobbyWorld)){
|
||||||
Spectator.add(event.getPlayer().getName());
|
|
||||||
SpectatorTeam.addEntry(event.getPlayer().getName());
|
|
||||||
event.getPlayer().sendMessage(messagePrefix + "You have joined mid game, and thus have been placed on the spectator team.");
|
|
||||||
event.getPlayer().setGameMode(GameMode.SPECTATOR);
|
|
||||||
event.getPlayer().getInventory().clear();
|
|
||||||
for(PotionEffect effect : event.getPlayer().getActivePotionEffects()){
|
|
||||||
event.getPlayer().removePotionEffect(effect.getType());
|
|
||||||
}
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld("hideandseek_"+spawnWorld), spawnPosition.getX(),spawnPosition.getY(),spawnPosition.getZ()));
|
|
||||||
}
|
|
||||||
if(event.getPlayer().getWorld().getName().equals(spawnWorld)) {
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
||||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
||||||
}
|
}
|
||||||
} else if(status.equals("Setup") || status.equals("Standby")) {
|
|
||||||
if(Functions.playerInProtectedWorld(event.getPlayer())){
|
|
||||||
event.getPlayer().teleport(new Location(Bukkit.getWorld(exitWorld), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ()));
|
|
||||||
event.getPlayer().setGameMode(GameMode.ADVENTURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -136,7 +117,6 @@ public class EventListener implements Listener {
|
||||||
if(event.getEntity() instanceof Snowball) {
|
if(event.getEntity() instanceof Snowball) {
|
||||||
Snowball snowball = (Snowball) event.getEntity();
|
Snowball snowball = (Snowball) event.getEntity();
|
||||||
if(snowball.getShooter() instanceof Player) {
|
if(snowball.getShooter() instanceof Player) {
|
||||||
if(!Functions.playerInProtectedWorld((Player) snowball.getShooter())) return;
|
|
||||||
Player player = (Player) snowball.getShooter();
|
Player player = (Player) snowball.getShooter();
|
||||||
if(Hider.contains(player.getName())) {
|
if(Hider.contains(player.getName())) {
|
||||||
Main.glow.onProjectilve();
|
Main.glow.onProjectilve();
|
||||||
|
|
|
@ -155,10 +155,6 @@ public class Functions {
|
||||||
board = mainBoard;
|
board = mainBoard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean playerInProtectedWorld(Player p) {
|
|
||||||
return p.getWorld().getName().equals("hideandseek_"+spawnWorld) || p.getWorld().getName().equals(spawnWorld);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void broadcastMessage(String message) {
|
public static void broadcastMessage(String message) {
|
||||||
for(Player player : playerList.values()) {
|
for(Player player : playerList.values()) {
|
||||||
player.sendMessage(message);
|
player.sendMessage(message);
|
||||||
|
|
Loading…
Reference in a new issue