Package com.comphenix.protocol.reflect

Examples of com.comphenix.protocol.reflect.FieldAccessException


        return new WrappedDataWatcher(nsmWatcher);
      else
        return null;
     
    } catch (IllegalAccessException e) {
      throw new FieldAccessException("Cannot access DataWatcher field.", e);
    }
  }
View Full Code Here


       
        try {
          lookup = new ArrayLookup();
        } catch (Exception e2) {
          // Wow
          throw new FieldAccessException(e1.getMessage() + ". Workaround failed too.", e2);
        }
      }
     
      // Should work fine now
    }
View Full Code Here

         
          // Convert to the Bukkit world type
          return worldTypeGetType.invoke(this, specific.getName());
         
        } catch (Exception e) {
          throw new FieldAccessException("Cannot find the WorldType.getType() method.", e);
       
      }

      @Override
      protected WorldType getSpecificValue(Object generic) {
        try {
          if (worldTypeName == null) {
            try {
              worldTypeName = worldType.getMethod("name");
            } catch (Exception e) {
              // Assume the first method is the one
              worldTypeName = FuzzyReflection.fromClass(worldType).
                getMethodByParameters("name", String.class, new Class<?>[] {});
            }
          }
         
          // Dynamically call the namne method
          String name = (String) worldTypeName.invoke(generic);
          return WorldType.getByName(name);
         
        } catch (Exception e) {
          throw new FieldAccessException("Cannot call the name method in WorldType.", e);
        }
      }
     
      @Override
      public Class<WorldType> getSpecificType() {
View Full Code Here

          serverPacketsRef = (Set<Integer>) FieldUtils.readStaticField(sets.get(0), true);
          clientPacketsRef = (Set<Integer>) FieldUtils.readStaticField(sets.get(1), true);
         
          // Impossible
          if (serverPacketsRef == null || clientPacketsRef == null)
            throw new FieldAccessException("Packet sets are in an illegal state.");
         
          // NEVER allow callers to modify the underlying sets
          serverPackets = ImmutableSet.copyOf(serverPacketsRef);
          clientPackets = ImmutableSet.copyOf(clientPacketsRef);
         
          // Check sizes
          if (serverPackets.size() < MIN_SERVER_PACKETS)
            throw new InsufficientPacketsException("Insufficient server packets.", false, serverPackets.size());
          if (clientPackets.size() < MIN_CLIENT_PACKETS)
            throw new InsufficientPacketsException("Insufficient client packets.", true, clientPackets.size());
         
        } else {
          throw new FieldAccessException("Cannot retrieve packet client/server sets.");
        }
       
      } catch (IllegalAccessException e) {
        throw new FieldAccessException("Cannot access field.", e);
      }
     
    } else {
      // Copy over again if it has changed
      if (serverPacketsRef != null && serverPacketsRef.size() != serverPackets.size())
View Full Code Here

  public Set<Integer> getServerPackets() throws FieldAccessException {
    initializeSets();
   
    // Sanity check. This is impossible!
    if (serverPackets != null && serverPackets.size() < MIN_SERVER_PACKETS)
      throw new FieldAccessException("Server packet list is empty. Seems to be unsupported");
    return serverPackets;
  }
View Full Code Here

  public Set<Integer> getClientPackets() throws FieldAccessException {
    initializeSets();
   
    // As above
    if (clientPackets != null && clientPackets.size() < MIN_CLIENT_PACKETS)
      throw new FieldAccessException("Client packet list is empty. Seems to be unsupported");
    return clientPackets;
  }
View Full Code Here

          sendServerPacket(player, packet);
        }
      }
     
    } catch (InvocationTargetException e) {
      throw new FieldAccessException("Unable to send server packet.", e);
    }
  }
View Full Code Here

    try {
      for (Player player : players) {
        sendServerPacket(player, packet);
      }
    } catch (InvocationTargetException e) {
      throw new FieldAccessException("Unable to send server packet.", e);
    }
  }
View Full Code Here

      return new PacketContainer(type, nmsPacket);
     
    } catch (IllegalArgumentException e) {
      throw e;
    } catch (InstantiationException e) {
      throw new FieldAccessException("Cannot construct an abstract packet.", e);
    } catch (IllegalAccessException e) {
      throw new FieldAccessException("Cannot construct packet due to a security limitation.", e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException("Minecraft error.", e);
    }
  }
View Full Code Here

      scanPlayersMethod.invoke(trackerEntry, nmsPlayers);
     
    } catch (IllegalArgumentException e) {
      throw e;
    } catch (IllegalAccessException e) {
      throw new FieldAccessException("Security limitation prevents access to 'get' method in IntHashMap", e);
    } catch (InvocationTargetException e) {
      throw new RuntimeException("Exception occurred in Minecraft.", e);
    } catch (SecurityException e) {
      throw new FieldAccessException("Security limitation prevents access to 'scanPlayers' method in trackerEntry.", e);
    } catch (NoSuchMethodException e) {
      throw new FieldAccessException("Cannot find 'scanPlayers' method. Is ProtocolLib up to date?", e);
    }
  }
View Full Code Here

TOP

Related Classes of com.comphenix.protocol.reflect.FieldAccessException

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.