Use randomly generated version 1 UUID's

This commit is contained in:
libraryaddict 2014-04-12 04:11:51 +12:00
parent 04af32149f
commit 684d996754
2 changed files with 32 additions and 0 deletions

26
pom.xml
View file

@ -17,6 +17,26 @@
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.fasterxml.uuid:java-uuid-generator</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
@ -63,6 +83,12 @@
<artifactId>ProtocolLib</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>3.1.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<version>8.0.5</version>

View file

@ -36,6 +36,9 @@ import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher;
import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedGenerator;
public class DisguiseUtilities {
private static HashMap<Integer, HashSet<TargetedDisguise>> futureDisguises = new HashMap<Integer, HashSet<TargetedDisguise>>();
@ -310,6 +313,9 @@ public class DisguiseUtilities {
e.printStackTrace();
}
}
EthernetAddress addr = EthernetAddress.fromInterface();
TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(addr);
return uuidGenerator.generate();
}
return null;
}