Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ buildNumber.properties

# Common working directory
run/

server/
libs/
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

FastBuilder is an in-progress Minecraft plugin designed to enhance your bridging experience.

##It is prohibited to use this plugin for profit
## It is prohibited to use this plugin for profit

## Features

Expand All @@ -16,6 +16,9 @@ FastBuilder is an in-progress Minecraft plugin designed to enhance your bridging
- Cosmetics: Future updates will include cosmetics.
- More Accurate Timer: We are working on improving the timer's accuracy to provide a more precise and fair gameplay experience.

## Known Issues
- The Scoreboard has the character limit of 40 per line. It's recommended to stay under 32 characters to avoid the issues.

Stay tuned for more updates as we continue to improve and expand FastBuilder!

[Discord](https://discord.gg/CXX3aQ8yWz)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ private List<String> fetchLines(Player player) {
private List<String> getPlayingLines(Player player) {
PlayerProfile profile = plugin.getProfileManager().get(player.getUniqueId());
Arena arena = profile.getArena();
String leader1 = arena.getLeader1();
String leader2 = arena.getLeader2();
String leader3 = arena.getLeader3();
String leader1 = arena.getLeader(0);
String leader2 = arena.getLeader(1);
String leader3 = arena.getLeader(2);
String pb = profile.getPBString();
String blocks = String.valueOf(profile.getBlocks() == 0 ? CC.GRAY + "-" : profile.getBlocks());
String time = profile.getTimeString();
Expand Down
90 changes: 54 additions & 36 deletions src/main/java/com/njdge/fastbuilder/arena/Arena.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,52 +81,70 @@ public Island getFreeIsland() {
}
}

public String getLeader1() {
Map.Entry<Player, Long> minEntry = players.entrySet().stream()
.filter(entry -> entry.getValue() != null)
.min(Map.Entry.comparingByValue())
.orElse(null);

if (minEntry == null) {
return CC.GRAY + "-.---";
}

String leader = minEntry.getKey().getName();

String formattedTime = formatTime(minEntry.getValue());
return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
}

public String getLeader2() {
List<Map.Entry<Player, Long>> sortedPlayers = players.entrySet().stream()
.filter(entry -> entry.getValue() != null)
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toList());

if (sortedPlayers.size() < 2) {
return CC.GRAY + "-.---";
}

String leader = sortedPlayers.get(1).getKey().getName();

String formattedTime = formatTime(sortedPlayers.get(1).getValue());
return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
}

public String getLeader3() {
public String getLeader(int rank) {
List<Map.Entry<Player, Long>> sortedPlayers = players.entrySet().stream()
.filter(entry -> entry.getValue() != null)
.sorted(Map.Entry.comparingByValue())
.collect(Collectors.toList());

if (sortedPlayers.size() < 3) {
if (sortedPlayers.size() < rank+1) {
return CC.GRAY + "-.---";
}

String leader = sortedPlayers.get(2).getKey().getName();
Map.Entry<Player, Long> entry = sortedPlayers.get(rank);

String formattedTime = formatTime(sortedPlayers.get(2).getValue());
String leader = entry.getKey().getName();
String formattedTime = formatTime(entry.getValue());

return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
}
//
// public String getLeader1() {
// Map.Entry<Player, Long> minEntry = players.entrySet().stream()
// .filter(entry -> entry.getValue() != null)
// .min(Map.Entry.comparingByValue())
// .orElse(null);
//
// if (minEntry == null) {
// return CC.GRAY + "-.---";
// }
//
// String leader = minEntry.getKey().getName();
//
// String formattedTime = formatTime(minEntry.getValue());
// return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
// }
//
// public String getLeader2() {
// List<Map.Entry<Player, Long>> sortedPlayers = players.entrySet().stream()
// .filter(entry -> entry.getValue() != null)
// .sorted(Map.Entry.comparingByValue())
// .collect(Collectors.toList());
//
// if (sortedPlayers.size() < 2) {
// return CC.GRAY + "-.---";
// }
//
// String leader = sortedPlayers.get(1).getKey().getName();
//
// String formattedTime = formatTime(sortedPlayers.get(1).getValue());
// return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
// }
//
// public String getLeader3() {
// List<Map.Entry<Player, Long>> sortedPlayers = players.entrySet().stream()
// .filter(entry -> entry.getValue() != null)
// .sorted(Map.Entry.comparingByValue())
// .collect(Collectors.toList());
//
// if (sortedPlayers.size() < 3) {
// return CC.GRAY + "-.---";
// }
//
// String leader = sortedPlayers.get(2).getKey().getName();
//
// String formattedTime = formatTime(sortedPlayers.get(2).getValue());
//
// return CC.GREEN + leader + ": " + CC.YELLOW + formattedTime;
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,10 @@ public void onPlace(BlockPlaceEvent e) {
Arena arena = profile.getArena();
Island island = arena.getIsland(player);

profile.setBlocks(profile.getBlocks() + 1);

if (profile.getState().equals(ProfileState.PLAYING)) {
if (!island.getPlaceableCuboid().isIn(e.getBlock().getLocation())) {
e.setCancelled(true);
profile.setBlocks(profile.getBlocks() - 1);
sendActionBar(player, CC.RED + "You can't place blocks here");
} else {
if (!profile.isPlaced()) {
Expand All @@ -180,6 +179,7 @@ public void onPlace(BlockPlaceEvent e) {
} else if (profile.getState().equals(ProfileState.EDITING)) {
e.setCancelled(false);
}
profile.setBlocks(profile.getBlocks() + 1);
}

@EventHandler
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: FastBuilder
version: '${project.version}'
main: com.njdge.fastbuilder.FastBuilder
api-version: '1.8'
commands:
edit: