use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.
the class CommandDeop method execute.
public void execute(ICommandListener icommandlistener, String[] astring) {
if (astring.length == 1 && astring[0].length() > 0) {
MinecraftServer minecraftserver = MinecraftServer.getServer();
GameProfile gameprofile = minecraftserver.getPlayerList().getOPs().a(astring[0]);
if (gameprofile == null) {
throw new CommandException("commands.deop.failed", new Object[] { astring[0] });
} else {
minecraftserver.getPlayerList().removeOp(gameprofile);
a(icommandlistener, this, "commands.deop.success", new Object[] { astring[0] });
}
} else {
throw new ExceptionUsage("commands.deop.usage", new Object[0]);
}
}
use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.
the class CommandOp method tabComplete.
public List tabComplete(ICommandListener icommandlistener, String[] astring) {
if (astring.length == 1) {
String s = astring[astring.length - 1];
ArrayList arraylist = new ArrayList();
GameProfile[] agameprofile = MinecraftServer.getServer().F();
int i = agameprofile.length;
for (int j = 0; j < i; ++j) {
GameProfile gameprofile = agameprofile[j];
if (!MinecraftServer.getServer().getPlayerList().isOp(gameprofile) && a(s, gameprofile.getName())) {
arraylist.add(gameprofile.getName());
}
}
return arraylist;
} else {
return null;
}
}
use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.
the class CommandOp method execute.
public void execute(ICommandListener icommandlistener, String[] astring) {
if (astring.length == 1 && astring[0].length() > 0) {
MinecraftServer minecraftserver = MinecraftServer.getServer();
GameProfile gameprofile = minecraftserver.getUserCache().getProfile(astring[0]);
if (gameprofile == null) {
throw new CommandException("commands.op.failed", new Object[] { astring[0] });
} else {
minecraftserver.getPlayerList().addOp(gameprofile);
a(icommandlistener, this, "commands.op.success", new Object[] { astring[0] });
}
} else {
throw new ExceptionUsage("commands.op.usage", new Object[0]);
}
}
use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.
the class PlayerList method a.
public void a(NetworkManager networkmanager, EntityPlayer entityplayer) {
GameProfile gameprofile = entityplayer.getProfile();
UserCache usercache = this.server.getUserCache();
GameProfile gameprofile1 = usercache.a(gameprofile.getId());
String s = gameprofile1 == null ? gameprofile.getName() : gameprofile1.getName();
usercache.a(gameprofile);
NBTTagCompound nbttagcompound = this.a(entityplayer);
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
String s1 = "local";
if (networkmanager.getSocketAddress() != null) {
s1 = networkmanager.getSocketAddress().toString();
}
g.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
this.a(entityplayer, (EntityPlayer) null, worldserver);
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer);
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, this.getMaxPlayers(), worldserver.getWorldData().getType()));
playerconnection.sendPacket(new PacketPlayOutCustomPayload("MC|Brand", this.getServer().getServerModName().getBytes(Charsets.UTF_8)));
playerconnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
entityplayer.getStatisticManager().d();
entityplayer.getStatisticManager().updateStatistics(entityplayer);
this.sendScoreboard((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
this.server.az();
ChatMessage chatmessage;
if (!entityplayer.getName().equalsIgnoreCase(s)) {
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[] { entityplayer.getScoreboardDisplayName(), s });
} else {
chatmessage = new ChatMessage("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName() });
}
chatmessage.getChatModifier().setColor(EnumChatFormat.YELLOW);
this.sendMessage(chatmessage);
this.c(entityplayer);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.b(entityplayer, worldserver);
if (this.server.getResourcePack().length() > 0) {
entityplayer.setResourcePack(this.server.getResourcePack());
}
Iterator iterator = entityplayer.getEffects().iterator();
while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next();
playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect));
}
entityplayer.syncInventory();
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("Riding", 10)) {
Entity entity = EntityTypes.a(nbttagcompound.getCompound("Riding"), worldserver);
if (entity != null) {
entity.attachedToPlayer = true;
worldserver.addEntity(entity);
entityplayer.mount(entity);
entity.attachedToPlayer = false;
}
}
}
use of net.minecraft.util.com.mojang.authlib.GameProfile in project mc-dev by Bukkit.
the class UserCache method a.
private List a(int i) {
ArrayList arraylist = Lists.newArrayList();
LinkedList linkedlist = this.e;
ArrayList arraylist1;
synchronized (this.e) {
arraylist1 = Lists.newArrayList(Iterators.limit(this.e.iterator(), i));
}
Iterator iterator = arraylist1.iterator();
while (iterator.hasNext()) {
GameProfile gameprofile = (GameProfile) iterator.next();
UserCacheEntry usercacheentry = this.b(gameprofile.getId());
if (usercacheentry != null) {
arraylist.add(usercacheentry);
}
}
return arraylist;
}
Aggregations