mirror of
https://github.com/SimplexDevelopment/FreedomNetworkSuite.git
synced 2024-11-14 05:03:33 +00:00
Merge pull request #6 from AtlasMediaGroup/videos-stupid-contributions
Removes old unused UserData methods
This commit is contained in:
commit
ef3acca330
@ -26,9 +26,7 @@ public class SimpleUserData implements UserData
|
|||||||
private final UserDataUpdateEvent event = new UserDataUpdateEvent(this);
|
private final UserDataUpdateEvent event = new UserDataUpdateEvent(this);
|
||||||
private Group group;
|
private Group group;
|
||||||
private long playtime;
|
private long playtime;
|
||||||
private boolean frozen;
|
|
||||||
private boolean canInteract;
|
private boolean canInteract;
|
||||||
private boolean caged;
|
|
||||||
private AtomicLong balance;
|
private AtomicLong balance;
|
||||||
private boolean transactionsFrozen;
|
private boolean transactionsFrozen;
|
||||||
|
|
||||||
@ -49,9 +47,7 @@ public class SimpleUserData implements UserData
|
|||||||
final User user,
|
final User user,
|
||||||
final Group group,
|
final Group group,
|
||||||
final long playtime,
|
final long playtime,
|
||||||
final boolean frozen,
|
|
||||||
final boolean canInteract,
|
final boolean canInteract,
|
||||||
final boolean caged,
|
|
||||||
final long balance,
|
final long balance,
|
||||||
final boolean transactionsFrozen)
|
final boolean transactionsFrozen)
|
||||||
{
|
{
|
||||||
@ -60,9 +56,7 @@ public class SimpleUserData implements UserData
|
|||||||
this.user = user;
|
this.user = user;
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.playtime = playtime;
|
this.playtime = playtime;
|
||||||
this.frozen = frozen;
|
|
||||||
this.canInteract = canInteract;
|
this.canInteract = canInteract;
|
||||||
this.caged = caged;
|
|
||||||
this.balance = new AtomicLong(balance);
|
this.balance = new AtomicLong(balance);
|
||||||
this.transactionsFrozen = transactionsFrozen;
|
this.transactionsFrozen = transactionsFrozen;
|
||||||
}
|
}
|
||||||
@ -72,61 +66,57 @@ public class SimpleUserData implements UserData
|
|||||||
return sql.executeQuery("SELECT * FROM users WHERE UUID = ?", uuid)
|
return sql.executeQuery("SELECT * FROM users WHERE UUID = ?", uuid)
|
||||||
.thenApplyAsync(result ->
|
.thenApplyAsync(result ->
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (result.next())
|
if (result.next())
|
||||||
{
|
{
|
||||||
final String g = result.getString("group");
|
final String g = result.getString("group");
|
||||||
|
|
||||||
final UUID u = UUID.fromString(uuid);
|
final UUID u = UUID.fromString(uuid);
|
||||||
final String username = result.getString("username");
|
final String username = result.getString("username");
|
||||||
|
|
||||||
final Player player = Bukkit.getPlayer(u);
|
final Player player = Bukkit.getPlayer(u);
|
||||||
|
|
||||||
if (player == null)
|
if (player == null)
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException("Player should be online but they are not!");
|
||||||
"Player should be online but they are not!");
|
|
||||||
|
|
||||||
final User user = new FreedomUser(player);
|
final User user = new FreedomUser(player);
|
||||||
final Group group = CommonsBase.getInstance()
|
final Group group = CommonsBase.getInstance()
|
||||||
.getRegistrations()
|
.getRegistrations()
|
||||||
.getGroupRegistry()
|
.getGroupRegistry()
|
||||||
.getGroup(g);
|
.getGroup(g);
|
||||||
|
|
||||||
final long playtime = result.getLong("playtime");
|
final long playtime = result.getLong("playtime");
|
||||||
final boolean frozen = result.getBoolean("frozen");
|
final boolean canInteract = result.getBoolean("canInteract");
|
||||||
final boolean canInteract = result.getBoolean("canInteract");
|
final long balance = result.getLong("balance");
|
||||||
final boolean caged = result.getBoolean("caged");
|
final boolean transactionsFrozen = result.getBoolean("transactionsFrozen");
|
||||||
final long balance = result.getLong("balance");
|
|
||||||
final boolean transactionsFrozen = result.getBoolean(
|
return new SimpleUserData(u, username, user, group, playtime,
|
||||||
"transactionsFrozen");
|
canInteract, balance, transactionsFrozen);
|
||||||
return new SimpleUserData(u, username, user, group, playtime, frozen,
|
}
|
||||||
canInteract, caged, balance,
|
}
|
||||||
transactionsFrozen);
|
catch (SQLException ex)
|
||||||
}
|
{
|
||||||
}
|
final String sb = "An error occurred while trying to retrieve user data for" +
|
||||||
catch (SQLException ex)
|
" UUID " +
|
||||||
{
|
uuid +
|
||||||
final String sb = "An error occurred while trying to retrieve user data for" +
|
" from the database." +
|
||||||
" UUID " +
|
"\nCaused by: " +
|
||||||
uuid +
|
ExceptionUtils.getRootCauseMessage(ex) +
|
||||||
" from the database." +
|
"\nStack trace: " +
|
||||||
"\nCaused by: " +
|
ExceptionUtils.getStackTrace(ex);
|
||||||
ExceptionUtils.getRootCauseMessage(ex) +
|
|
||||||
"\nStack trace: " +
|
|
||||||
ExceptionUtils.getStackTrace(ex);
|
|
||||||
|
|
||||||
FreedomLogger.getLogger("Datura")
|
FreedomLogger.getLogger("Datura")
|
||||||
.error(sb);
|
.error(sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Player player = Bukkit.getPlayer(UUID.fromString(uuid));
|
final Player player = Bukkit.getPlayer(UUID.fromString(uuid));
|
||||||
if (player == null) throw new IllegalStateException(
|
if (player == null) throw new IllegalStateException("Player should be online but they are not!");
|
||||||
"Player should be online but they are not!");
|
|
||||||
return new SimpleUserData(player);
|
return new SimpleUserData(player);
|
||||||
}, CommonsBase.getInstance()
|
}, CommonsBase.getInstance()
|
||||||
.getExecutor()
|
.getExecutor()
|
||||||
.getAsync())
|
.getAsync())
|
||||||
.join();
|
.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,19 +178,6 @@ public class SimpleUserData implements UserData
|
|||||||
this.playtime = 0L;
|
this.playtime = 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isFrozen()
|
|
||||||
{
|
|
||||||
return frozen;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setFrozen(final boolean frozen)
|
|
||||||
{
|
|
||||||
event.ping();
|
|
||||||
this.frozen = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteract()
|
public boolean canInteract()
|
||||||
{
|
{
|
||||||
@ -214,19 +191,6 @@ public class SimpleUserData implements UserData
|
|||||||
this.canInteract = canInteract;
|
this.canInteract = canInteract;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCaged()
|
|
||||||
{
|
|
||||||
return caged;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCaged(final boolean caged)
|
|
||||||
{
|
|
||||||
event.ping();
|
|
||||||
this.caged = caged;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean areTransactionsFrozen()
|
public boolean areTransactionsFrozen()
|
||||||
{
|
{
|
||||||
|
@ -34,8 +34,4 @@ public interface UserData extends EconomicEntityData
|
|||||||
boolean canInteract();
|
boolean canInteract();
|
||||||
|
|
||||||
void setInteractionState(boolean canInteract);
|
void setInteractionState(boolean canInteract);
|
||||||
|
|
||||||
boolean isCaged();
|
|
||||||
|
|
||||||
void setCaged(boolean caged);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user