use of de.dytanic.cloudnet.lib.player.OfflinePlayer in project CloudNet by Dytanic.
the class VaultChatImpl method setPlayerSuffix.
@Override
public void setPlayerSuffix(String s, String s1, String s2) {
OfflinePlayer offlinePlayer = getPlayer(s1);
offlinePlayer.getPermissionEntity().setSuffix(s2);
update(offlinePlayer);
}
use of de.dytanic.cloudnet.lib.player.OfflinePlayer in project CloudNet by Dytanic.
the class VaultPermissionImpl method playerAddGroup.
@Override
public boolean playerAddGroup(String s, String s1, String s2) {
OfflinePlayer offlinePlayer = getPlayer(s1);
PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
GroupEntityData groupEntityData = CollectionWrapper.filter(permissionEntity.getGroups(), new Acceptable<GroupEntityData>() {
@Override
public boolean isAccepted(GroupEntityData groupEntityData) {
return groupEntityData.getGroup().equalsIgnoreCase(s2);
}
});
if (groupEntityData != null) {
permissionEntity.getGroups().remove(groupEntityData);
groupEntityData = new GroupEntityData(groupEntityData.getGroup(), 0);
} else {
groupEntityData = new GroupEntityData(groupEntityData.getGroup(), 0);
}
permissionEntity.getGroups().add(groupEntityData);
offlinePlayer.setPermissionEntity(permissionEntity);
updatePlayer(offlinePlayer);
return true;
}
use of de.dytanic.cloudnet.lib.player.OfflinePlayer in project CloudNet by Dytanic.
the class VaultPermissionImpl method groupHas.
@Override
public boolean groupHas(String s, String s1, String s2) {
OfflinePlayer offlinePlayer = getPlayer(s1);
PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
return permissionEntity.isInGroup(s2);
}
use of de.dytanic.cloudnet.lib.player.OfflinePlayer in project CloudNet by Dytanic.
the class VaultPermissionImpl method playerInGroup.
@Override
public boolean playerInGroup(String s, String s1, String s2) {
OfflinePlayer offlinePlayer = getPlayer(s1);
PermissionEntity permissionEntity = offlinePlayer.getPermissionEntity();
return permissionEntity.isInGroup(s2);
}
use of de.dytanic.cloudnet.lib.player.OfflinePlayer in project CloudNet by Dytanic.
the class NetworkManager method handlePlayerLoginRequest.
public void handlePlayerLoginRequest(ProxyServer proxyServer, PlayerConnection cloudPlayerConnection, UUID uniqueId) {
if (this.onlinePlayers.containsKey(cloudPlayerConnection.getUniqueId())) {
proxyServer.sendPacketSynchronized(new PacketOutLoginPlayer(uniqueId, null));
return;
}
LoginRequestEvent loginRequestEvent = new LoginRequestEvent(proxyServer, cloudPlayerConnection);
CloudNet.getInstance().getEventManager().callEvent(loginRequestEvent);
PlayerDatabase playerDatabase = CloudNet.getInstance().getDbHandlers().getPlayerDatabase();
OfflinePlayer offlinePlayer = null;
if (!playerDatabase.containsPlayer(cloudPlayerConnection.getUniqueId()))
offlinePlayer = playerDatabase.registerPlayer(cloudPlayerConnection);
if (offlinePlayer == null)
offlinePlayer = playerDatabase.getPlayer(cloudPlayerConnection.getUniqueId());
CloudPlayer cloudPlayer = new CloudPlayer(offlinePlayer, cloudPlayerConnection, proxyServer.getServerId());
cloudPlayer.setPlayerExecutor(CorePlayerExecutor.INSTANCE);
if (cloudPlayer.getFirstLogin() != null)
cloudPlayer.setFirstLogin(System.currentTimeMillis());
CloudNet.getInstance().getEventManager().callEvent(new PlayerInitEvent(cloudPlayer));
CloudNet.getInstance().getDbHandlers().getNameToUUIDDatabase().append(new MultiValue<>(cloudPlayerConnection.getName(), cloudPlayerConnection.getUniqueId()));
CloudNet.getInstance().getDbHandlers().getNameToUUIDDatabase().replace(new MultiValue<>(cloudPlayerConnection.getUniqueId(), cloudPlayerConnection.getName()));
cloudPlayer.setName(cloudPlayerConnection.getName());
CloudNet.getInstance().getDbHandlers().getPlayerDatabase().updatePlayer(CloudPlayer.newOfflinePlayer(cloudPlayer));
proxyServer.sendPacketSynchronized(new PacketOutLoginPlayer(uniqueId, cloudPlayer));
this.waitingPlayers.put(cloudPlayer.getUniqueId(), cloudPlayer);
handlePlayerLogin(cloudPlayer);
}
Aggregations