Allowed fly and teleport in 200 day minigame

This commit is contained in:
Norbi Peti 2016-01-29 22:51:46 +01:00
parent 14fbdaef55
commit 73b8c0ce03
3 changed files with 19 additions and 4 deletions

Binary file not shown.

View file

@ -3,9 +3,10 @@ package tk.sznp.thebuttonautoflair;
import java.util.EnumSet;
import java.util.List;
import org.bukkit.event.HandlerList;
import org.bukkit.event.EventHandler;
import au.com.mineauz.minigames.MinigamePlayer;
import au.com.mineauz.minigames.events.StartMinigameEvent;
import au.com.mineauz.minigames.gametypes.MinigameType;
import au.com.mineauz.minigames.mechanics.GameMechanicBase;
import au.com.mineauz.minigames.minigame.Minigame;
@ -36,22 +37,25 @@ public class CreativeGlobalMechanic extends GameMechanicBase {
@Override
public void joinMinigame(Minigame mg, MinigamePlayer mp) {
mp.getPlayer().setAllowFlight(true);
mp.getPlayer().setFlying(true);
mp.setAllowTeleport(true);
}
@Override
public void quitMinigame(Minigame mg, MinigamePlayer mp, boolean forced) {
mg.getBlockRecorder().clearRestoreData();
}
@Override
public void startMinigame(Minigame mg, MinigamePlayer mp) {
mp.setAllowTeleport(true);
}
@Override
public void stopMinigame(Minigame arg0, MinigamePlayer arg1) {
}
@Override
@ -59,4 +63,15 @@ public class CreativeGlobalMechanic extends GameMechanicBase {
return EnumSet.of(MinigameType.MULTIPLAYER);
}
@EventHandler
private void minigameStart(StartMinigameEvent event) {
if (event.getMinigame().getMechanicName().equals(getMechanic())) {
final List<MinigamePlayer> players = event.getPlayers();
//final Minigame minigame = event.getMinigame();
for (MinigamePlayer player : players) {
player.setAllowTeleport(true);
}
}
}
}