first commit
This commit is contained in:
parent
a195140325
commit
512ec48dd2
|
@ -46,10 +46,8 @@ public class Maya extends JavaPlugin{
|
|||
return 12;
|
||||
}
|
||||
|
||||
@Getter
|
||||
private static ArrayList<Player> players = new ArrayList<>();
|
||||
public static ArrayList<Player> getPlayers() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public static int lobbyID;
|
||||
public static int warmupID;
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
*/
|
||||
public class BuyCounter extends BukkitRunnable{
|
||||
|
||||
int time = 60;
|
||||
private int time = 60;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.Buy) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
*/
|
||||
public class DeathmatchCounter extends BukkitRunnable{
|
||||
|
||||
int time = 20;
|
||||
private int time = 20;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.DeathMatch) {
|
||||
|
|
|
@ -17,8 +17,8 @@ import org.bukkit.scoreboard.Scoreboard;
|
|||
*/
|
||||
public class GameCounter extends BukkitRunnable{
|
||||
|
||||
int time = 0;
|
||||
int maxTime = 80;
|
||||
private int time = 0;
|
||||
private int maxTime = 80;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.InGame) {
|
||||
|
@ -33,10 +33,9 @@ public class GameCounter extends BukkitRunnable{
|
|||
}
|
||||
time++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void updateScoreboard() {
|
||||
private void updateScoreboard() {
|
||||
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
|
||||
|
||||
Objective obj = board.getObjective("maya");
|
||||
|
|
|
@ -6,53 +6,21 @@ package eu.univento.maya.game;
|
|||
* @version 1.0
|
||||
*/
|
||||
public enum GameStage {
|
||||
/**
|
||||
* players are waiting in the lobby until min player count is reached
|
||||
*/
|
||||
|
||||
Lobby(1),
|
||||
/**
|
||||
* players waiting while map is being loaded
|
||||
*/
|
||||
Warmup(2),
|
||||
/**
|
||||
* game has been started, teams are hiding there block
|
||||
*/
|
||||
InGame(3),
|
||||
/**
|
||||
* players can buy items
|
||||
*/
|
||||
Buy(4),
|
||||
/**
|
||||
* players can fight
|
||||
*/
|
||||
DeathMatch(5),
|
||||
/**
|
||||
* server is reseting map and restarts
|
||||
*/
|
||||
Restart(6);
|
||||
|
||||
/**
|
||||
* id of stage
|
||||
*/
|
||||
private int id;
|
||||
/**
|
||||
* gets gamestage for id
|
||||
* @param id Integer
|
||||
*/
|
||||
private GameStage(int id) {
|
||||
this.setId(id);
|
||||
}
|
||||
/**
|
||||
* gets id of gamestage
|
||||
* @return Integer
|
||||
*/
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* sets id
|
||||
* @param id Integer
|
||||
*/
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
*/
|
||||
public class LobbyCounter extends BukkitRunnable{
|
||||
|
||||
int time = 60;
|
||||
private int time = 60;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.Lobby && Bukkit.getOnlinePlayers().size() >= Maya.getMinPlayers()) {
|
||||
|
@ -36,6 +36,5 @@ public class LobbyCounter extends BukkitRunnable{
|
|||
}
|
||||
time--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
*/
|
||||
public class RestartCounter extends BukkitRunnable{
|
||||
|
||||
int time = 10;
|
||||
private int time = 10;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.Restart) {
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||
*/
|
||||
public class WarmupCounter extends BukkitRunnable{
|
||||
|
||||
int time = 10;
|
||||
private int time = 10;
|
||||
|
||||
public void run() {
|
||||
if(Maya.getStage() == GameStage.Warmup) {
|
||||
|
@ -28,7 +28,6 @@ public class WarmupCounter extends BukkitRunnable{
|
|||
}
|
||||
time--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package eu.univento.maya.listener;
|
|||
|
||||
import eu.univento.core.api.Config;
|
||||
import eu.univento.core.api.player.CustomPlayer;
|
||||
import eu.univento.core.api.player.SpectateManager;
|
||||
import eu.univento.core.api.player.Spectator;
|
||||
import eu.univento.maya.Maya;
|
||||
import eu.univento.maya.game.GameStage;
|
||||
|
@ -22,7 +23,7 @@ public class PlayerEvents implements Listener{
|
|||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||
if(Maya.getStage() == GameStage.Lobby) {
|
||||
if(Maya.getPlayers().size() >= Maya.getMaxPlayers()) {
|
||||
Spectator.add(p);
|
||||
new Spectator(p);
|
||||
p.teleport(Config.readLocation("Maya.Spawn.Spectator"));
|
||||
p.sendMessage("§cDu bist nun Zuschauer");
|
||||
e.setJoinMessage(null);
|
||||
|
@ -30,13 +31,13 @@ public class PlayerEvents implements Listener{
|
|||
}
|
||||
p.teleport(Config.readLocation("Maya.Spawn.Lobby"));
|
||||
p.sendMessage("§cDu bist dem Spiel beigetreten");
|
||||
e.setJoinMessage("§6Maya: " + p.getColor() + p.getDisplayName() + " §6ist dem Spiel beigetreten");
|
||||
e.setJoinMessage("§6Maya: " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §6ist dem Spiel beigetreten");
|
||||
p.setGameMode(GameMode.ADVENTURE);
|
||||
|
||||
|
||||
}else {
|
||||
e.setJoinMessage(null);
|
||||
Spectator.add(p);
|
||||
new Spectator(p);
|
||||
p.teleport(Config.readLocation("Maya.Spawn.Spectator"));
|
||||
p.sendMessage("§cDu bist nun Zuschauer");
|
||||
|
||||
|
@ -46,13 +47,14 @@ public class PlayerEvents implements Listener{
|
|||
@EventHandler
|
||||
public void onQuit(PlayerQuitEvent e) {
|
||||
CustomPlayer p = CustomPlayer.getPlayer(e.getPlayer());
|
||||
if(Spectator.is(p)) {
|
||||
Spectator.remove(p);
|
||||
e.setQuitMessage(null);
|
||||
if(SpectateManager.contains(p)) {
|
||||
Spectator spectator = SpectateManager.get(p);
|
||||
assert spectator != null;
|
||||
spectator.remove();
|
||||
}
|
||||
if(Maya.getPlayers().contains(p)) {
|
||||
Maya.getPlayers().remove(p);
|
||||
e.setQuitMessage("§6Maya: " + p.getColor() + p.getDisplayName() + " §6hat das Spiel verlassen");
|
||||
e.setQuitMessage("§6Maya: " + p.getDatabasePlayer().getRank().getColor() + p.getDisplayName() + " §6hat das Spiel verlassen");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package eu.univento.maya.modules;
|
||||
|
||||
import eu.univento.core.api.map.MinecraftSchematic;
|
||||
import eu.univento.maya.Maya;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
@ -16,8 +15,10 @@ public class Modules {
|
|||
|
||||
private static void loadModule(Location loc, String name) {
|
||||
File file = new File("plugins/Core/Maya/modules/", name + ".schematic");
|
||||
/*
|
||||
MinecraftSchematic schematic = new MinecraftSchematic(file);
|
||||
schematic.placeInWorld(loc);
|
||||
*/
|
||||
}
|
||||
|
||||
public static void generate() {
|
||||
|
|
Loading…
Reference in New Issue