Changed to setData in PlayerCustomData
This commit is contained in:
parent
2ac28c4fd5
commit
3e8c3cb928
@ -4,8 +4,6 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniDbClientPlugin;
|
||||
@ -33,7 +31,7 @@ public class CustomDataManager extends MiniDbClientPlugin<PlayerCustomData>
|
||||
PlayerCustomData data = new PlayerCustomData(_repository);
|
||||
while (resultSet.next())
|
||||
{
|
||||
data.incrementData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data"));
|
||||
data.setData(_repository.getKey(resultSet.getInt("customDataId")), resultSet.getInt("data"));
|
||||
}
|
||||
Set(playerName, data);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public abstract class MineplexPlayer
|
||||
public void put(String key, int data)
|
||||
{
|
||||
key = getKeyPrefix() + key;
|
||||
_customDataManager.Get(getPlayer()).incrementData(key, data);
|
||||
_customDataManager.Get(getPlayer()).setData(key, data);
|
||||
}
|
||||
|
||||
public int get(String key)
|
||||
|
@ -24,31 +24,31 @@ public class PlayerCustomData
|
||||
return _data;
|
||||
}
|
||||
|
||||
public void incrementData(CustomData cd, int amount)
|
||||
public void setData(CustomData cd, int amount)
|
||||
{
|
||||
_data.put(cd, amount);
|
||||
}
|
||||
|
||||
public void incrementData(String key, int amount)
|
||||
public void setData(String key, int amount)
|
||||
{
|
||||
if (_repository.doesKeyExist(key))
|
||||
{
|
||||
incrementData(_repository.getKey(key), amount);
|
||||
setData(_repository.getKey(key), amount);
|
||||
return;
|
||||
}
|
||||
|
||||
_repository.getClientManager().getScheduler().runTaskAsynchronously(
|
||||
_repository.getClientManager().getPlugin(),
|
||||
new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.registerKey(key); // Make sure it's in the DB.
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
_repository.registerKey(key); // Make sure it's in the DB.
|
||||
|
||||
incrementData(_repository.getKey(key), amount); // Input
|
||||
}
|
||||
});
|
||||
setData(_repository.getKey(key), amount); // Input
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int getData(String key)
|
||||
|
Loading…
Reference in New Issue
Block a user