Skip to content

Commit

Permalink
finetuning
Browse files Browse the repository at this point in the history
  • Loading branch information
NonSwag committed Feb 18, 2023
1 parent 11c205e commit 95f6f39
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void pickAndPasteRuin() {
int zSize = this.maxZ - this.minZ;
int x = this.minX + (xSize / 4);
int z = this.minZ + (zSize / 4);
int y = world.getHighestBlockAt(x, z).getY() - 5;
int y = world.getHighestBlockAt(x, z).getY() - 5; // FIXME: 19.02.23
String chosen = options.get(Populator.RANDOM.nextInt(options.size()));
Location location = new Location(Bukkit.getWorlds().get(0), x, y, z);
loader.paste(chosen, location);
Expand Down
Binary file modified out/production/walls/net/nonswag/fvr/walls/Walls$1.class
Binary file not shown.
Binary file modified out/production/walls/net/nonswag/fvr/walls/Walls.class
Binary file not shown.
Binary file modified out/production/walls/net/nonswag/fvr/walls/api/GameStarter.class
Binary file not shown.
7 changes: 4 additions & 3 deletions src/main/java/net/nonswag/fvr/walls/Walls.java
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,7 @@ private void handleKitInteraction(PlayerInteractEvent event) {
if (target != null) {
target.getWorld().strikeLightning(target);
stack.setDurability((short) (stack.getDurability() - 10));
numberOfUsesLeft = numberOfUsesLeft - 1;
thorOwners.put(event.getPlayer().getUniqueId(), numberOfUsesLeft);
thorOwners.put(event.getPlayer().getUniqueId(), --numberOfUsesLeft);
if (numberOfUsesLeft > 0) {
Notifier.notify(event.getPlayer(), "Mjölnir has " + numberOfUsesLeft + " remaining lightning bolts!");
} else {
Expand Down Expand Up @@ -920,7 +919,9 @@ public void onFoodLevelChange(FoodLevelChangeEvent event) {
event.setCancelled(true);
break;
case FIGHTING:
if (!isSpectator(event.getEntity()) && ThreadLocalRandom.current().nextInt(100) > 30) return;
if (isSpectator(event.getEntity())) event.setCancelled(true);
if (((Player) event.getEntity()).getFoodLevel() < event.getFoodLevel()) return;
if (ThreadLocalRandom.current().nextInt(100) < 30) return;
event.setCancelled(true);
break;
default:
Expand Down
12 changes: 8 additions & 4 deletions src/main/java/net/nonswag/fvr/walls/api/GameStarter.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ public static void startGame(Map<UUID, WallsPlayer> players, final Walls walls)
WallsPlayer tempWallsPlayer = walls.getPlayer(all);
switch (tempWallsPlayer.getTeam()) {
case SPECTATORS:
int rand = GameStarter.getSmallestTeam(walls);
assignedPlayers.put(all, Team.values()[rand]);
player.teleport(walls.getSpawns().get(rand));
Notifier.notify(player, "You have been assigned to " + Walls.teamNames[rand]);
int smallestTeam = GameStarter.getSmallestTeam(walls);
System.out.print("smallest team: " + smallestTeam);
System.out.println("team is: " + Team.values()[smallestTeam]);
System.out.println("available team spawns: " + walls.getSpawns().size());
assignedPlayers.put(all, Team.values()[smallestTeam]);
if (smallestTeam >= walls.getSpawns().size()) return;
player.teleport(walls.getSpawns().get(smallestTeam));
Notifier.notify(player, "You have been assigned to " + Walls.teamNames[smallestTeam]);
break;
case RED:
player.teleport(walls.getTeam1Spawn());
Expand Down

0 comments on commit 95f6f39

Please sign in to comment.