diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java index 1a0b5f9b3..8c570a801 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/StatsManager.java @@ -18,6 +18,7 @@ import mineplex.core.account.event.RetrieveClientInformationEvent; import mineplex.core.common.util.NautHashMap; import mineplex.core.stats.column.Column; import mineplex.core.stats.column.ColumnInt; +import mineplex.core.stats.column.ColumnUuid; import mineplex.core.stats.column.ColumnVarChar; public class StatsManager extends MiniPlugin @@ -53,6 +54,7 @@ public class StatsManager extends MiniPlugin { if (!_tables.containsKey(tableName)) { + // Change ColumnVarChar playerColumn = new ColumnVarChar("playerName", 16); List> columnList = new ArrayList>(); columnList.add(playerColumn); @@ -79,9 +81,11 @@ public class StatsManager extends MiniPlugin public void addStat(Player player, String table, String statName, int value) { + // getName -> getUniqueId addStat(player.getName(), table, statName, value); } + // playerName -> uuid public void addStat(String playerName, String table, String statName, int value) { if (!_playerStatList.containsKey(table)) @@ -95,6 +99,7 @@ public class StatsManager extends MiniPlugin Row row = _tables.get(table).createRow(); + // bad playername! ((ColumnVarChar)row.Columns.get("playerName")).Value = playerName; _playerStatList.get(table).put(playerName, row); @@ -133,10 +138,13 @@ public class StatsManager extends MiniPlugin try { + // playerName -> column name of UUID or uuid or UniqueID, whichever you choose + // and event.getPlayerName() is still in this event, but so is getUniqueId List> columnList = new ArrayList>(); - columnList.add(new ColumnVarChar("playerName", 16, event.getPlayerName())); + columnList.add(new ColumnUuid("playerUuid", 256, event.getUniqueId())); List rows = table.retrieve(columnList); + // Same here. Row row = table.createRow(); ((ColumnVarChar)row.Columns.get("playerName")).Value = event.getPlayerName(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/stats/column/ColumnUuid.java b/Plugins/Mineplex.Core/src/mineplex/core/stats/column/ColumnUuid.java new file mode 100644 index 000000000..6c83cc976 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/stats/column/ColumnUuid.java @@ -0,0 +1,41 @@ +package mineplex.core.stats.column; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.UUID; + +public class ColumnUuid extends Column +{ + public int Length = 256; + public UUID Value = UUID.fromString(""); + + public ColumnUuid(String name, int length) + { + this(name, length, UUID.fromString("")); + } + + public ColumnUuid(String name, int length, UUID value) + { + super(name); + + Length = length; + Value = value; + } + + public String getCreateString() + { + return Name + " VARCHAR(" + Length + ")"; + } + + @Override + public String getValue(ResultSet resultSet) throws SQLException + { + return resultSet.getString(Name); + } + + @Override + public ColumnUuid clone() + { + return new ColumnUuid(Name, Length, Value); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 0a8d77575..5e59bc570 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -87,6 +87,10 @@ public class SuperSmash extends SoloGame this.SpawnDistanceRequirement = 16; this.InventoryOpen = false; + + // Add stat table here + // Example + //Manager.GetStatsManager().addTable("SuperSmashMobStats", "Kills", "Deaths", "Wins", "Losses"); } @EventHandler(priority = EventPriority.HIGH)