Java 类net.minecraft.util.com.google.common.collect.Lists 实例源码
项目:CraftBukkit
文件:PlayerList.java
public String b(boolean flag) {
String s = "";
ArrayList arraylist = Lists.newArrayList(this.players);
for (int i = 0; i < arraylist.size(); ++i) {
if (i > 0) {
s = s + ", ";
}
s = s + ((EntityPlayer) arraylist.get(i)).getName();
if (flag) {
s = s + " (" + ((EntityPlayer) arraylist.get(i)).getUniqueID().toString() + ")";
}
}
return s;
}
项目:CraftBukkit
文件:JsonList.java
private void h() {
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.d.values().iterator();
while (iterator.hasNext()) {
JsonListEntry jsonlistentry = (JsonListEntry) iterator.next();
if (jsonlistentry.hasExpired()) {
arraylist.add(jsonlistentry.getKey());
}
}
iterator = arraylist.iterator();
while (iterator.hasNext()) {
Object object = iterator.next();
this.d.remove(object);
}
}
项目:CraftBukkit
文件:NameReferencingFileConverter.java
public static String a(String s) {
if (!UtilColor.b(s) && s.length() <= 16) {
MinecraftServer minecraftserver = MinecraftServer.getServer();
GameProfile gameprofile = minecraftserver.getUserCache().getProfile(s);
if (gameprofile != null && gameprofile.getId() != null) {
return gameprofile.getId().toString();
} else if (!minecraftserver.N() && minecraftserver.getOnlineMode()) {
ArrayList arraylist = Lists.newArrayList();
GameProfileLookupCallback gameprofilelookupcallback = new GameProfileLookupCallback(minecraftserver, arraylist);
a(minecraftserver, Lists.newArrayList(new String[] { s}), gameprofilelookupcallback);
return arraylist.size() > 0 && ((GameProfile) arraylist.get(0)).getId() != null ? ((GameProfile) arraylist.get(0)).getId().toString() : "";
} else {
return EntityHuman.a(new GameProfile((UUID) null, s)).toString();
}
} else {
return s;
}
}
项目:Tweakkit-Server
文件:PlayerList.java
public String b(boolean flag) {
String s = "";
ArrayList arraylist = Lists.newArrayList(this.players);
for (int i = 0; i < arraylist.size(); ++i) {
if (i > 0) {
s = s + ", ";
}
s = s + ((EntityPlayer) arraylist.get(i)).getName();
if (flag) {
s = s + " (" + ((EntityPlayer) arraylist.get(i)).getUniqueID().toString() + ")";
}
}
return s;
}
项目:Tweakkit-Server
文件:JsonList.java
private void h() {
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.d.values().iterator();
while (iterator.hasNext()) {
JsonListEntry jsonlistentry = (JsonListEntry) iterator.next();
if (jsonlistentry.hasExpired()) {
arraylist.add(jsonlistentry.getKey());
}
}
iterator = arraylist.iterator();
while (iterator.hasNext()) {
Object object = iterator.next();
this.d.remove(object);
}
}
项目:Tweakkit-Server
文件:NameReferencingFileConverter.java
public static String a(String s) {
if (!UtilColor.b(s) && s.length() <= 16) {
MinecraftServer minecraftserver = MinecraftServer.getServer();
GameProfile gameprofile = minecraftserver.getUserCache().getProfile(s);
if (gameprofile != null && gameprofile.getId() != null) {
return gameprofile.getId().toString();
} else if (!minecraftserver.N() && minecraftserver.getOnlineMode()) {
ArrayList arraylist = Lists.newArrayList();
GameProfileLookupCallback gameprofilelookupcallback = new GameProfileLookupCallback(minecraftserver, arraylist);
a(minecraftserver, Lists.newArrayList(new String[] { s}), gameprofilelookupcallback);
return arraylist.size() > 0 && ((GameProfile) arraylist.get(0)).getId() != null ? ((GameProfile) arraylist.get(0)).getId().toString() : "";
} else {
return EntityHuman.a(new GameProfile((UUID) null, s)).toString();
}
} else {
return s;
}
}
项目:CraftBukkit
文件:PlayerList.java
public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer
UUID uuid = EntityHuman.a(gameprofile);
ArrayList arraylist = Lists.newArrayList();
EntityPlayer entityplayer;
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.getUniqueID().equals(uuid)) {
arraylist.add(entityplayer);
}
}
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
entityplayer = (EntityPlayer) iterator.next();
entityplayer.playerConnection.disconnect("You logged in from another location");
}
/* CraftBukkit start
Object object;
if (this.server.R()) {
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
} else {
object = new PlayerInteractManager(this.server.getWorldServer(0));
}
return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object);
// */
return player;
// CraftBukkit end
}
项目:CraftBukkit
文件:PlayerConnection.java
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
arraylist.add(s);
}
this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()])));
}
项目:CraftBukkit
文件:NameReferencingFileConverter.java
public static boolean a(DedicatedServer dedicatedserver, PropertyManager propertymanager) {
File file1 = d(propertymanager);
File file2 = new File(file1.getParentFile(), "playerdata");
File file3 = new File(file1.getParentFile(), "unknownplayers");
if (file1.exists() && file1.isDirectory()) {
File[] afile = file1.listFiles();
ArrayList arraylist = Lists.newArrayList();
File[] afile1 = afile;
int i = afile.length;
for (int j = 0; j < i; ++j) {
File file4 = afile1[j];
String s = file4.getName();
if (s.toLowerCase(Locale.ROOT).endsWith(".dat")) {
String s1 = s.substring(0, s.length() - ".dat".length());
if (s1.length() > 0) {
arraylist.add(s1);
}
}
}
try {
String[] astring = (String[]) arraylist.toArray(new String[arraylist.size()]);
PlayerDatFileConverter playerdatfileconverter = new PlayerDatFileConverter(dedicatedserver, file2, file3, file1, astring);
a(dedicatedserver, Lists.newArrayList(astring), playerdatfileconverter);
return true;
} catch (FileConversionException fileconversionexception) {
e.error("Conversion failed, please try again later", fileconversionexception);
return false;
}
} else {
return true;
}
}
项目:Tweakkit-Server
文件:PlayerList.java
public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer
UUID uuid = EntityHuman.a(gameprofile);
ArrayList arraylist = Lists.newArrayList();
EntityPlayer entityplayer;
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
if (entityplayer.getUniqueID().equals(uuid)) {
arraylist.add(entityplayer);
}
}
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
entityplayer = (EntityPlayer) iterator.next();
entityplayer.playerConnection.disconnect("You logged in from another location");
}
/* CraftBukkit start
Object object;
if (this.server.R()) {
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
} else {
object = new PlayerInteractManager(this.server.getWorldServer(0));
}
return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object);
// */
return player;
// CraftBukkit end
}
项目:Tweakkit-Server
文件:PlayerConnection.java
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
ArrayList arraylist = Lists.newArrayList();
Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
arraylist.add(s);
}
this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist.toArray(new String[arraylist.size()])));
}
项目:Tweakkit-Server
文件:NameReferencingFileConverter.java
public static boolean a(DedicatedServer dedicatedserver, PropertyManager propertymanager) {
File file1 = d(propertymanager);
File file2 = new File(file1.getParentFile(), "playerdata");
File file3 = new File(file1.getParentFile(), "unknownplayers");
if (file1.exists() && file1.isDirectory()) {
File[] afile = file1.listFiles();
ArrayList arraylist = Lists.newArrayList();
File[] afile1 = afile;
int i = afile.length;
for (int j = 0; j < i; ++j) {
File file4 = afile1[j];
String s = file4.getName();
if (s.toLowerCase(Locale.ROOT).endsWith(".dat")) {
String s1 = s.substring(0, s.length() - ".dat".length());
if (s1.length() > 0) {
arraylist.add(s1);
}
}
}
try {
String[] astring = (String[]) arraylist.toArray(new String[arraylist.size()]);
PlayerDatFileConverter playerdatfileconverter = new PlayerDatFileConverter(dedicatedserver, file2, file3, file1, astring);
a(dedicatedserver, Lists.newArrayList(astring), playerdatfileconverter);
return true;
} catch (FileConversionException fileconversionexception) {
e.error("Conversion failed, please try again later", fileconversionexception);
return false;
}
} else {
return true;
}
}
项目:Tweakkit-Server
文件:UserCache.java
public String[] a() {
ArrayList arraylist = Lists.newArrayList(this.c.keySet());
return (String[]) arraylist.toArray(new String[arraylist.size()]);
}
项目:Tweakkit-Server
文件:UserCache.java
public void b() {
List list = null;
BufferedReader bufferedreader = null;
label81: {
try {
bufferedreader = Files.newReader(this.g, Charsets.UTF_8);
list = (List) this.b.fromJson(bufferedreader, h);
break label81;
} catch (FileNotFoundException filenotfoundexception) {
;
// Spigot Start
} catch (net.minecraft.util.com.google.gson.JsonSyntaxException ex) {
JsonList.a.warn( "Usercache.json is corrupted or has bad formatting. Deleting it to prevent further issues." );
this.g.delete();
// Spigot End
} finally {
IOUtils.closeQuietly(bufferedreader);
}
return;
}
if (list != null) {
this.c.clear();
this.d.clear();
LinkedList linkedlist = this.e;
synchronized (this.e) {
this.e.clear();
}
list = Lists.reverse(list);
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
UserCacheEntry usercacheentry = (UserCacheEntry) iterator.next();
if (usercacheentry != null) {
this.a(usercacheentry.a(), usercacheentry.b());
}
}
}
}