Fixed issues that came up when I ran through the update

This commit is contained in:
Sam 2018-08-01 15:21:26 +01:00 committed by Alexander Meech
parent 31fa194b7f
commit 0f749f7794
4 changed files with 23 additions and 23 deletions

View File

@ -73,7 +73,7 @@ public class HubPlayerManager extends MiniPlugin
float levelPercentage = (float) data.getExpRemainder() / data.getExpNextLevel(); float levelPercentage = (float) data.getExpRemainder() / data.getExpNextLevel();
player.setLevel(data.getLevel()); player.setLevel(data.getLevel());
player.setExp(Math.min(0, Math.max(0.999F, levelPercentage))); player.setExp(Math.max(0, Math.min(0.999F, levelPercentage)));
} }
public void giveHotbar(Player player) public void giveHotbar(Player player)

View File

@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.build;
import java.util.AbstractMap; import java.util.AbstractMap;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -1728,7 +1729,7 @@ public class Build extends Game
@Override @Override
public Location GetSpectatorLocation() public Location GetSpectatorLocation()
{ {
return GetTeamList().get(0).GetSpawn(); return GetTeamList().get(0).GetSpawns().get(0);
} }
@EventHandler @EventHandler
@ -1740,12 +1741,6 @@ public class Build extends Game
return; return;
} }
// If they're not in the data map, don't bother
if (!_data.containsKey(event.getPlayer()))
{
return;
}
_data.remove(event.getPlayer()); _data.remove(event.getPlayer());
} }
@ -1758,7 +1753,7 @@ public class Build extends Game
return null; return null;
} }
return Arrays.asList(player); return Collections.singletonList(player);
} }
protected String getNextWord() protected String getNextWord()
@ -1831,7 +1826,7 @@ public class Build extends Game
@Override @Override
public void EndCheck() public void EndCheck()
{ {
if (GetPlayers(true).isEmpty()) if (IsLive() && GetPlayers(true).isEmpty())
{ {
SetState(GameState.End); SetState(GameState.End);
} }
@ -1858,9 +1853,6 @@ public class Build extends Game
super.disqualify(player); super.disqualify(player);
// Remove the player from the map so players don't vote on it // Remove the player from the map so players don't vote on it
if (_data.containsKey(player)) _data.remove(player);
{
_data.remove(player);
}
} }
} }

View File

@ -3,10 +3,12 @@ package nautilus.game.arcade.game.modules.gamesummary;
import java.util.List; import java.util.List;
import java.util.function.Function; import java.util.function.Function;
import org.bukkit.entity.Player; import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.HoverEvent.Action;
import net.md_5.bungee.api.chat.TextComponent;
import mineplex.core.common.jsonchat.HoverEvent; import org.bukkit.entity.Player;
import mineplex.core.common.jsonchat.JsonMessage;
public abstract class GameSummaryComponent<T> public abstract class GameSummaryComponent<T>
{ {
@ -42,14 +44,20 @@ public abstract class GameSummaryComponent<T>
return false; return false;
} }
StringBuilder hoverTextBuilder = new StringBuilder(); BaseComponent[] message = TextComponent.fromLegacyText(mainText);
String hoverTextString = String.join("\n", hoverText);
hoverText.forEach(text -> hoverTextBuilder.append("\n").append(text)); if (!hoverTextString.isEmpty())
{
HoverEvent hoverEvent = new HoverEvent(Action.SHOW_TEXT, TextComponent.fromLegacyText(hoverTextString));
new JsonMessage(mainText) for (BaseComponent component : message)
.hover(HoverEvent.SHOW_TEXT, hoverTextBuilder.toString().substring(1)) {
.sendToPlayer(player); component.setHoverEvent(hoverEvent);
}
}
player.spigot().sendMessage(message);
return true; return true;
} }

View File

@ -288,7 +288,7 @@ public class GameCreationManager implements Listener
ModePref = null; ModePref = null;
// No map voting, load the maps now // No map voting, load the maps now
boolean loadMapsNow = !Manager.GetServerConfig().MapVoting; boolean loadMapsNow = !Manager.GetServerConfig().MapVoting || MapPref != null;
try try
{ {