aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md10
-rw-r--r--src/main/java/com/MylesAndMore/tumble/EventListener.java11
-rw-r--r--src/main/java/com/MylesAndMore/tumble/Game.java9
3 files changed, 19 insertions, 11 deletions
diff --git a/README.md b/README.md
index fd89174..0f98959 100644
--- a/README.md
+++ b/README.md
@@ -12,12 +12,12 @@ once this list is complete and all bugs are fixed, we *should* be ready for rele
## game realism
- [x] make the shovel in shovels mode not lose any durabilty
-- [ ] make it so that you can't move until the game begins
+- [x] make it so that you can't move until the game begins
- [ ] make the game blocks breakable very fast, but **not instantly--very important for balancing!!**
- [ ] add infinite snowballs in the gamemanager for tumble mode
-- [ ] make it so that you can't remove any of the game items from your inventory
+- [x] make it so that you can't remove any of the game items from your inventory
- [ ] make snowballs actually break blocks (duh)
-- [ ] make the randomized mode logic
+- [x] make the randomized mode logic
- [ ] set some limits on the spectator mode in-game; make it so they can't fly outside of the map
## game logic (fyi: very object-oriented)
@@ -25,8 +25,8 @@ once this list is complete and all bugs are fixed, we *should* be ready for rele
- [x] make a Game class and object that we can initialize a new instance of with a gameType
- [ ] within this game object, while games are running:
- [ ] prevent players from joining/autojoining during
- - [ ] keep track of when someone wins; start a new round when this happens
- - [ ] keep track of how many wins each player has; end the game when a player reaches 3
+ - [x] keep track of when someone wins; start a new round when this happens
+ - [x] keep track of how many wins each player has; end the game when a player reaches 3
- [ ] add a section in the config for a place to tp the winning player
- [ ] add logic to do this
diff --git a/src/main/java/com/MylesAndMore/tumble/EventListener.java b/src/main/java/com/MylesAndMore/tumble/EventListener.java
index 4c3d154..bfe6767 100644
--- a/src/main/java/com/MylesAndMore/tumble/EventListener.java
+++ b/src/main/java/com/MylesAndMore/tumble/EventListener.java
@@ -13,6 +13,7 @@ import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerItemDamageEvent;
import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
@@ -86,7 +87,6 @@ public class EventListener implements Listener{
}
}
-
@EventHandler
public void PlayerDropItemEvent(PlayerDropItemEvent event) {
// When an item is dropped, make sure there is a defined gameWorld
@@ -98,6 +98,15 @@ public class EventListener implements Listener{
}
}
}
+
+ @EventHandler
+ public void PlayerMoveEvent(PlayerMoveEvent event) {
+ // On a PlayerMoveEvent, check if the game is starting
+ if (Objects.equals(Game.getGame().getGameState(), "starting")) {
+ // Cancel the event if the game is starting (so players can't move before the game starts)
+ event.setCancelled(true);
+ }
+ }
}
diff --git a/src/main/java/com/MylesAndMore/tumble/Game.java b/src/main/java/com/MylesAndMore/tumble/Game.java
index d3234a1..1b8227e 100644
--- a/src/main/java/com/MylesAndMore/tumble/Game.java
+++ b/src/main/java/com/MylesAndMore/tumble/Game.java
@@ -114,7 +114,7 @@ public class Game {
// Create a list that will later keep track of each player's wins
gameWins = new ArrayList<>();
gameWins.addAll(List.of(0,0,0,0,0,0,0,0));
- // Wait 5s (50t) for the clients to load in
+ // Wait 5s (100t) for the clients to load in
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> {
// Display the "go!" title
displayTitles(gamePlayers, ChatColor.GREEN + "Go!", null, 1, 5, 1);
@@ -122,7 +122,7 @@ public class Game {
// Set gamemodes to survival
setGamemode(gamePlayers, GameMode.SURVIVAL);
gameState = "running";
- }, 50);
+ }, 100);
return true;
}
@@ -336,7 +336,7 @@ public class Game {
// Announce win
displayTitles(gamePlayers, ChatColor.RED + "Game over!", ChatColor.GOLD + winner.getName() + " has won the game!", 4, 40, 2);
displayMessage(gamePlayers, ChatColor.BLUE + "Teleporting back in five seconds...");
- // Wait 5s (100t), then
+ // Wait 10s (200t), then
Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(TumbleManager.getPlugin(), () -> {
// Set their gamemodes to survival
setGamemode(gamePlayers, GameMode.SURVIVAL);
@@ -344,8 +344,7 @@ public class Game {
for (Player aPlayer : gamePlayers) {
aPlayer.teleport(Bukkit.getWorld(TumbleManager.getLobbyWorld()).getSpawnLocation());
}
- }, 100);
+ }, 200);
gameState = "complete";
}
-
}