-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor refactoring & new twist #5
base: main
Are you sure you want to change the base?
Changes from 1 commit
38bc0c4
741a493
062ac0c
0377163
8c9abae
257c2db
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -368,7 +368,7 @@ public void prepareForSpectate() { | |
assert player != null; | ||
player.setInvisible(true); | ||
reset(player, false); | ||
player.setGameMode(GameMode.SURVIVAL); | ||
player.setGameMode(GameMode.SPECTATOR); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This removes clickable items in hotbar as a spectator |
||
player.setAllowFlight(true); | ||
player.setFlying(true); | ||
player.getInventory().setItem(4, plugin.getItemizer().MANHUNT_RUNNER_TRACKER); | ||
|
@@ -621,10 +621,11 @@ public void updateScoreboard() { | |
line = line.replaceAll("%color%", getColor()); | ||
line = line.replaceAll("%winner%", game.getWinningTeam() == null ? "null" : game.getWinningTeam().name()); | ||
line = line.replaceAll("%lives%", getMaxLives() < 1 ? "unlimited" : Math.max(getMaxLives() - getDeaths(), 0) + ""); | ||
line = line.replaceAll("%hunters%", hunters + ""); | ||
line = line.replaceAll("%runners%", runners + ""); | ||
line = line.replaceAll("%alivehunters%", aliveHunters + ""); | ||
line = line.replaceAll("%aliverunners%", aliveRunners + ""); | ||
line = line.replaceAll("%hunters%", String.valueOf(hunters)); | ||
line = line.replaceAll("%runners%", String.valueOf(runners)); | ||
line = line.replaceAll("%alivehunters%", String.valueOf(aliveHunters)); | ||
line = line.replaceAll("%aliverunners%", String.valueOf(aliveRunners)); | ||
line = line.replaceAll("%spectators%", String.valueOf(game.getSpectators().size())); | ||
line = line.replaceAll("%twist%", game.getSelectedTwist() == null ? "none" : game.getSelectedTwist().name()); | ||
line = line.replaceAll("%kills%", getKills() + ""); | ||
line = line.replaceAll("%maxplayers%", game.getMaxPlayers() + ""); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
import me.gaagjescraft.network.team.manhunt.Manhunt; | ||
import me.gaagjescraft.network.team.manhunt.utils.Util; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.GameMode; | ||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
import org.bukkit.entity.Player; | ||
|
@@ -32,9 +33,14 @@ public void start() { | |
@Override | ||
public void run() { | ||
for (GamePlayer gp : game.getOnlinePlayers(null)) { | ||
if ((Bukkit.getPlayer(gp.getUuid()) != null)) { | ||
Player player = Bukkit.getPlayer(gp.getUuid()); | ||
if (player != null) { | ||
gp.updateScoreboard(); | ||
gp.getCompassTracker().updateCompass(); | ||
|
||
if (gp.isSpectating()) { | ||
player.setGameMode(GameMode.SPECTATOR); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary at best, or at worst, admins can't change gamemode |
||
} | ||
} | ||
} | ||
|
||
|
@@ -43,7 +49,6 @@ public void run() { | |
if (w != null) w.setTime(6000); | ||
} | ||
|
||
// todo add automatic start for minimum amount of players. | ||
if (game.getStatus() == GameStatus.STARTING) { | ||
if (plugin.getCfg().debug) Bukkit.getLogger().severe("Starting the game now. (1)"); | ||
doStartingCountdown(); | ||
|
@@ -189,7 +194,12 @@ private void doHuntersReleaseCountdown() { | |
|
||
// announce time at 60s, 30s, 10s, <5s | ||
int headstart = game.getHeadStart().getSeconds(); | ||
if ((headstart >= 120 && timer == headstart - 120) || (headstart >= 90 && timer == headstart - 90) || (headstart >= 60 && timer == headstart - 60) || (headstart >= 30 && timer == headstart - 30) || (headstart >= 10 && timer == headstart - 10) || (timer >= headstart - 5 && timer < headstart)) { | ||
if ((headstart >= 120 && timer == headstart - 120) | ||
|| (headstart >= 90 && timer == headstart - 90) | ||
|| (headstart >= 60 && timer == headstart - 60) | ||
|| (headstart >= 30 && timer == headstart - 30) | ||
|| (headstart >= 10 && timer == headstart - 10) | ||
|| (timer >= headstart - 5 && timer < headstart)) { | ||
String time = plugin.getUtil().secondsToTimeString(headstart - timer, "string"); | ||
for (GamePlayer gp : online) { | ||
Player p = Bukkit.getPlayer(gp.getUuid()); | ||
|
@@ -310,6 +320,29 @@ public void doEvent() { | |
game.setEventActive(false); | ||
game.determineNextEventTime(); | ||
}, 400); | ||
} else if (game.getSelectedTwist() == TwistVote.GET_HIGH) { | ||
game.setEventActive(true); | ||
for (GamePlayer onlinePlayer : game.getOnlinePlayers(null)) { | ||
Player player = Bukkit.getPlayer(onlinePlayer.getUuid()); | ||
if (player == null) { | ||
continue; | ||
} | ||
|
||
Location playerLocation = player.getLocation(); | ||
player.teleport(new Location( | ||
game.getWorld(), | ||
playerLocation.getX(), | ||
game.getWorld().getHighestBlockYAt(playerLocation) + 1.5, | ||
playerLocation.getZ())); | ||
|
||
plugin.getUtil().sendTitle(player, Util.c(plugin.getCfg().twistGetHighTitle), 20, 50, 20); | ||
player.sendMessage(Util.c(plugin.getCfg().twistGetHighMessage)); | ||
Bukkit.getScheduler().runTaskLater(plugin, () -> { | ||
game.setEventActive(false); | ||
game.determineNextEventTime(); | ||
}, 200); | ||
|
||
} | ||
} else if (game.getSelectedTwist() == TwistVote.BLINDNESS) { | ||
game.setEventActive(true); | ||
for (GamePlayer gp : game.getOnlinePlayers(null)) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,7 +89,7 @@ public void openMenu(Player player) { | |
gui.setItem(i, plugin.getItemizer().FILL_ITEM); | ||
} | ||
|
||
gui.setItem(53, plugin.getItemizer().createItem(plugin.getCfg().mainMenuStoreMaterial, 1, Util.c(plugin.getCfg().mainMenuStoreDisplayname), plugin.getCfg().mainMenuStoreLore)); | ||
gui.setItem(53, plugin.getItemizer().FILL_ITEM); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removes the main store menu item?? |
||
gui.setItem(49, plugin.getItemizer().CLOSE_ITEM); | ||
|
||
player.openInventory(gui); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the seed pre-selection system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you are looking at one particular commit. It was later reverted.