Package com.comphenix.protocol.reflect.fuzzy

Examples of com.comphenix.protocol.reflect.fuzzy.FuzzyClassContract


  }
 
  private Map<Class, Integer> getSpigotWrapper() throws IllegalAccessException {
    // If it talks like a duck, etc.
    // Perhaps it would be nice to have a proper duck typing library as well
    FuzzyClassContract mapLike = FuzzyClassContract.newBuilder().
        method(FuzzyMethodContract.newBuilder().
            nameExact("size").returnTypeExact(int.class)).
        method(FuzzyMethodContract.newBuilder().
            nameExact("put").parameterCount(2)).
        method(FuzzyMethodContract.newBuilder().
View Full Code Here


   */
  public static Class<?> getPacketClass() {
    try {
      return getMinecraftClass("Packet");
    } catch (RuntimeException e) {
      FuzzyClassContract paketContract = null;
     
      // What kind of class we're looking for (sanity check)
      if (isUsingNetty()) {
        paketContract = FuzzyClassContract.newBuilder().
            method(FuzzyMethodContract.newBuilder().
View Full Code Here

       
      } catch (RuntimeException e1) {
        // Okay, this must be on 1.7.2
        Class<?> playerClass = getEntityPlayerClass();
       
        FuzzyClassContract playerConnection = FuzzyClassContract.newBuilder().
          field(FuzzyFieldContract.newBuilder().typeExact(playerClass).build()).
          constructor(FuzzyMethodContract.newBuilder().
              parameterCount(3).
              parameterSuperOf(getMinecraftServerClass(), 0).
              parameterSuperOf(getEntityPlayerClass(), 2).
View Full Code Here

  public static Class<?> getDataWatcherClass() {
    try {
      return getMinecraftClass("DataWatcher");
    } catch (RuntimeException e) {
      // Describe the DataWatcher
      FuzzyClassContract dataWatcherContract = FuzzyClassContract.newBuilder().
           field(FuzzyFieldContract.newBuilder().
             requireModifier(Modifier.STATIC).
             typeDerivedOf(Map.class)).
           field(FuzzyFieldContract.newBuilder().
               banModifier(Modifier.STATIC).
View Full Code Here

      return getMinecraftClass("NBTBase");
    } catch (RuntimeException e) {
      Class<?> nbtBase = null;
     
      if (isUsingNetty()) {
        FuzzyClassContract tagCompoundContract = FuzzyClassContract.newBuilder().
            field(FuzzyFieldContract.newBuilder().
              typeDerivedOf(Map.class)).
            method(FuzzyMethodContract.newBuilder().
              parameterDerivedOf(DataOutput.class).
              parameterCount(1)).
            build();
       
        Method selected = FuzzyReflection.fromClass(getPacketDataSerializerClass()).
            getMethod(FuzzyMethodContract.newBuilder().
              banModifier(Modifier.STATIC).
              parameterCount(1).
              parameterMatches(tagCompoundContract).
              returnTypeVoid().
              build()         
             );
        nbtBase = selected.getParameterTypes()[0].getSuperclass();
       
      } else {
        FuzzyClassContract tagCompoundContract = FuzzyClassContract.newBuilder().
          constructor(FuzzyMethodContract.newBuilder().
            parameterExactType(String.class).
            parameterCount(1)).
          field(FuzzyFieldContract.newBuilder().
            typeDerivedOf(Map.class)).
View Full Code Here

   */
  public static Class<?> getEntityTrackerClass() {
    try {
      return getMinecraftClass("EntityTracker");
    } catch (RuntimeException e) {
      FuzzyClassContract entityTrackerContract = FuzzyClassContract.newBuilder().
          field(FuzzyFieldContract.newBuilder().
              typeDerivedOf(Set.class)).
            method(FuzzyMethodContract.newBuilder().
                parameterSuperOf(MinecraftReflection.getEntityClass()).
                parameterCount(1).
View Full Code Here

   */
  public static Class<?> getNetworkListenThreadClass() {
    try {
      return getMinecraftClass("NetworkListenThread");
    } catch (RuntimeException e) {
      FuzzyClassContract networkListenContract = FuzzyClassContract.newBuilder().
          field(FuzzyFieldContract.newBuilder().
              typeDerivedOf(ServerSocket.class)).
          field(FuzzyFieldContract.newBuilder().
              typeDerivedOf(Thread.class)).
          field(FuzzyFieldContract.newBuilder().
View Full Code Here

      return getMinecraftClass("IntHashMap");
    } catch (RuntimeException e) {
      final Class<?> parent = getEntityTrackerClass();

      // Expected structure of a IntHashMap
      final FuzzyClassContract intHashContract = FuzzyClassContract.newBuilder().
        // add(int key, Object value)
        method(FuzzyMethodContract.newBuilder().
            parameterCount(2).
            parameterExactType(int.class, 0).
            parameterExactType(Object.class, 1).requirePublic()
View Full Code Here

TOP

Related Classes of com.comphenix.protocol.reflect.fuzzy.FuzzyClassContract

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.