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