Fixed sync db calls for PlayerTracker
Fixed name update with new UUID Skeleton work for Friends
This commit is contained in:
parent
d19b34b0e4
commit
b058665e93
@ -6,7 +6,7 @@ import mineplex.core.mysql.RepositoryBase;
|
||||
|
||||
public class MysqlAccountRepository extends RepositoryBase
|
||||
{
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS Accounts (id INT NOT NULL AUTO_INCREMENT, name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id));";
|
||||
private static String CREATE_ACCOUNT_TABLE = "CREATE TABLE IF NOT EXISTS Accounts (id INT NOT NULL AUTO_INCREMENT, uuid VARCHAR(100), name VARCHAR(40), gems INT, rank VARCHAR(40), rankPerm BOOL, rankExpire LONG, lastLogin LONG, totalPlayTime LONG, PRIMARY KEY (id), );";
|
||||
|
||||
public MysqlAccountRepository(JavaPlugin plugin)
|
||||
{
|
||||
|
@ -0,0 +1,19 @@
|
||||
package mineplex.core.friend;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.friend.data.FriendRepository;
|
||||
|
||||
public class FriendManager extends MiniPlugin
|
||||
{
|
||||
private FriendRepository _repository;
|
||||
|
||||
public FriendManager(JavaPlugin plugin)
|
||||
{
|
||||
super("Friends", plugin);
|
||||
|
||||
_repository = new FriendRepository();
|
||||
_repository.initialize();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.friend.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FriendRepository
|
||||
{
|
||||
public void initialize()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean addFriend(String name)
|
||||
{
|
||||
boolean success = true;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public boolean removeFriend(String name)
|
||||
{
|
||||
boolean success = true;
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
public List<FriendStatus> getFriends(String uuid)
|
||||
{
|
||||
List<FriendStatus> friends = new ArrayList<FriendStatus>();
|
||||
|
||||
return friends;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package mineplex.core.friend.data;
|
||||
|
||||
public class FriendStatus
|
||||
{
|
||||
public String Name;
|
||||
public String ServerName;
|
||||
public long LastSeenOnline;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
public class FriendPage
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
public class FriendShop
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
public class InvitesPage
|
||||
{
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package mineplex.core.playerTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -20,14 +21,26 @@ public class PlayerTracker extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void trackPlayer(PlayerJoinEvent event)
|
||||
public void trackPlayer(final PlayerJoinEvent event)
|
||||
{
|
||||
_repository.updatePlayerServer(event.getPlayer().getName());
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.updatePlayerServer(event.getPlayer().getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void untrackPlayer(ClientUnloadEvent event)
|
||||
public void untrackPlayer(final ClientUnloadEvent event)
|
||||
{
|
||||
_repository.deleteServerTransfers(event.GetName());
|
||||
Bukkit.getServer().getScheduler().runTaskAsynchronously(GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
_repository.deleteServerTransfers(event.GetName());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,13 @@
|
||||
edited = true;
|
||||
}
|
||||
|
||||
// Update account name if changed
|
||||
if (!String.Equals(account.Name, loginToken.Name))
|
||||
{
|
||||
account.Name = loginToken.Name;
|
||||
edited = true;
|
||||
}
|
||||
|
||||
// Expire ranks
|
||||
if ((account.Rank.Name == "ULTRA") && !account.RankPerm && DateTime.Now.CompareTo(account.RankExpire) >= 0)
|
||||
{
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user