File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
src/com/bencodez/advancedcore/api/user/userstorage/mysql Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 22 <modelVersion >4.0.0</modelVersion >
33 <groupId >com.bencodez</groupId >
44 <artifactId >advancedcore</artifactId >
5- <version >3.5.1 </version >
5+ <version >3.5.2 </version >
66 <packaging >jar</packaging >
77 <name >AdvancedCore</name >
88 <properties >
Original file line number Diff line number Diff line change 1010import java .util .Collections ;
1111import java .util .List ;
1212import java .util .Set ;
13+ import java .util .UUID ;
1314import java .util .concurrent .ConcurrentHashMap ;
1415
1516import org .bukkit .configuration .ConfigurationSection ;
@@ -358,6 +359,32 @@ public Set<String> getNames() {
358359 return names ;
359360 }
360361
362+ public ConcurrentHashMap <UUID , String > getRowsUUIDNameQuery () {
363+ ConcurrentHashMap <UUID , String > uuidNames = new ConcurrentHashMap <UUID , String >();
364+ String sqlStr = "SELECT UUID, PlayerName FROM " + getName () + ";" ;
365+
366+ try (Connection conn = mysql .getConnectionManager ().getConnection ();
367+ PreparedStatement sql = conn .prepareStatement (sqlStr )) {
368+ ResultSet rs = sql .executeQuery ();
369+ /*
370+ * Query query = new Query(mysql, sql); ResultSet rs = query.executeQuery();
371+ */
372+
373+ while (rs .next ()) {
374+ String uuid = rs .getString ("uuid" );
375+ String playerName = rs .getString ("PlayerName" );
376+ if (uuid != null && !uuid .isEmpty () && !uuid .equals ("null" )) {
377+ uuidNames .put (UUID .fromString (uuid ), playerName );
378+ }
379+ }
380+ sql .close ();
381+ conn .close ();
382+ } catch (SQLException e ) {
383+ }
384+
385+ return uuidNames ;
386+ }
387+
361388 public ArrayList <String > getNamesQuery () {
362389 ArrayList <String > uuids = new ArrayList <String >();
363390
You can’t perform that action at this time.
0 commit comments