1.5.0 Release Canidate 3

This commit is contained in:
Tyler Murphy 2022-05-19 17:14:01 -04:00
parent 217f412c39
commit 6b4bef24c0
5 changed files with 20 additions and 17 deletions

View file

@ -21,6 +21,7 @@ package net.tylermurphy.hideAndSeek.command;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
import net.tylermurphy.hideAndSeek.database.util.PlayerInfo; import net.tylermurphy.hideAndSeek.database.util.PlayerInfo;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -55,13 +56,7 @@ public class Top implements ICommand {
return; return;
} }
for(PlayerInfo info : infos) { for(PlayerInfo info : infos) {
OfflinePlayer temp = Main.getInstance().getServer().getOfflinePlayer(info.getUniqueId()); String name = Main.getInstance().getDatabase().getNameData().getName(info.getUniqueId());
String name;
if(temp == null){
name = Main.getInstance().getDatabase().getNameData().getName(info.getUniqueId());
} else {
name = temp.getName();
}
ChatColor color; ChatColor color;
switch (i) { switch (i) {
case 1: color = ChatColor.YELLOW; break; case 1: color = ChatColor.YELLOW; break;

View file

@ -42,11 +42,7 @@ public class Wins implements ICommand {
} }
else { else {
name = args[0]; name = args[0];
if(Main.getInstance().getServer().getOfflinePlayer(args[0]) == null){ uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[0]);
uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[0]);
} else {
uuid = Main.getInstance().getServer().getOfflinePlayer(args[0]).getUniqueId();
}
} }
if(uuid == null){ if(uuid == null){
sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0])); sender.sendMessage(errorPrefix + message("START_INVALID_NAME").addPlayer(args[0]));

View file

@ -20,8 +20,11 @@
package net.tylermurphy.hideAndSeek.database; package net.tylermurphy.hideAndSeek.database;
import net.tylermurphy.hideAndSeek.Main; import net.tylermurphy.hideAndSeek.Main;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.lang.management.BufferPoolMXBean;
import java.sql.*; import java.sql.*;
import java.util.UUID; import java.util.UUID;
@ -61,6 +64,11 @@ public class NameDataTable {
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage()); Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
OfflinePlayer retry = Bukkit.getOfflinePlayer(uuid);
if(retry != null){
this.update(uuid, retry.getName());
return retry.getName();
}
return null; return null;
} }
@ -78,6 +86,11 @@ public class NameDataTable {
Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage()); Main.getInstance().getLogger().severe("SQL Error: " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
OfflinePlayer retry = Bukkit.getOfflinePlayer(name);
if(retry != null){
this.update(retry.getUniqueId(), name);
return retry.getUniqueId();
}
return null; return null;
} }

View file

@ -223,7 +223,7 @@ public class Game {
private void whileWaiting() { private void whileWaiting() {
if (!lobbyCountdownEnabled) return; if (!lobbyCountdownEnabled) return;
if (lobbyMin <= board.size()) { if (lobbyMin <= board.size()) {
if (gameTimer == -1) if (lobbyTimer < 0)
lobbyTimer = countdown; lobbyTimer = countdown;
if (board.size() >= changeCountdown) if (board.size() >= changeCountdown)
lobbyTimer = Math.min(lobbyTimer, 10); lobbyTimer = Math.min(lobbyTimer, 10);
@ -240,7 +240,6 @@ public class Game {
} }
private void whileStarting() { private void whileStarting() {
if(gameTick % 20 == 0) { if(gameTick % 20 == 0) {
if (startingTimer % 5 == 0 || startingTimer < 5) { if (startingTimer % 5 == 0 || startingTimer < 5) {
String message; String message;
@ -259,7 +258,7 @@ public class Game {
} else if (countdownDisplay == CountdownDisplay.ACTIONBAR) { } else if (countdownDisplay == CountdownDisplay.ACTIONBAR) {
ActionBar.clearActionBar(player); ActionBar.clearActionBar(player);
ActionBar.sendActionBar(player, messagePrefix + message); ActionBar.sendActionBar(player, messagePrefix + message);
} else if (countdownDisplay == CountdownDisplay.TITLE) { } else if (countdownDisplay == CountdownDisplay.TITLE && startingTimer != 30) {
Titles.clearTitle(player); Titles.clearTitle(player);
Titles.sendTitle(player, 10, 40, 10, " ", message); Titles.sendTitle(player, 10, 40, 10, " ", message);
} }

View file

@ -45,7 +45,7 @@ public class PAPIExpansion extends PlaceholderExpansion {
database.getGameData().getInfo(player.getUniqueId()); database.getGameData().getInfo(player.getUniqueId());
} else { } else {
UUID uuid; UUID uuid;
try { uuid = Main.getInstance().getServer().getOfflinePlayer(args[2]).getUniqueId(); } catch (Exception e) { return placeholderError; } try { uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[2]); } catch (Exception e) { return placeholderError; }
info = database.getGameData().getInfo(uuid); info = database.getGameData().getInfo(uuid);
} }
if (info == null) return placeholderNoData; if (info == null) return placeholderNoData;
@ -69,7 +69,7 @@ public class PAPIExpansion extends PlaceholderExpansion {
database.getGameData().getInfo(player.getUniqueId()); database.getGameData().getInfo(player.getUniqueId());
} else { } else {
UUID uuid; UUID uuid;
try { uuid = Main.getInstance().getServer().getOfflinePlayer(args[2]).getUniqueId(); } catch (Exception e) { return placeholderError; } try { uuid = Main.getInstance().getDatabase().getNameData().getUUID(args[2]); } catch (Exception e) { return placeholderError; }
info = database.getGameData().getInfo(uuid); info = database.getGameData().getInfo(uuid);
} }
if (info == null) return placeholderNoData; if (info == null) return placeholderNoData;