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> <target>1.6</target>
</configuration> </configuration>
</plugin> </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> </plugins>
<resources> <resources>
<resource> <resource>
@ -63,6 +83,12 @@
<artifactId>ProtocolLib</artifactId> <artifactId>ProtocolLib</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>3.1.3</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<version>8.0.5</version> <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.ProtocolManager;
import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.wrappers.WrappedDataWatcher; 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 { public class DisguiseUtilities {
private static HashMap<Integer, HashSet<TargetedDisguise>> futureDisguises = new HashMap<Integer, HashSet<TargetedDisguise>>(); private static HashMap<Integer, HashSet<TargetedDisguise>> futureDisguises = new HashMap<Integer, HashSet<TargetedDisguise>>();
@ -310,6 +313,9 @@ public class DisguiseUtilities {
e.printStackTrace(); e.printStackTrace();
} }
} }
EthernetAddress addr = EthernetAddress.fromInterface();
TimeBasedGenerator uuidGenerator = Generators.timeBasedGenerator(addr);
return uuidGenerator.generate();
} }
return null; return null;
} }