Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private <T, Item extends ItemType<T>, C extends IProfessionType> Item test(T t, Class<Item> itemm, Class<C> clazz) {
- for (Entry<String, Profession<?>> profession : ProfessionManager.PROFESSIONS_ID.entrySet()) {
- String className = profession.getValue().getClass().getGenericSuperclass().getTypeName();
- String name = className.substring(INDEX, className.length() - 1).split("[.]")[1];
- if (!name.equalsIgnoreCase(clazz.getSimpleName())) {
- continue;
- }
- Profession<?> prof = profession.getValue();
- for (ItemType<?> item : prof.getItems()) {
- Item itemReturn = (Item) item;
- if (itemReturn.getObject() == t) {
- return itemReturn;
- }
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement