From 01b68cf8e5a5cf22cd178735d6879f17a054602e Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Wed, 30 Aug 2017 21:51:21 -0400 Subject: [PATCH] Revert unnecessarily breaking changes to converters Fixes #394 --- .../protocol/reflect/EquivalentConverter.java | 20 ++++++++++- .../protocol/reflect/GenericConverter.java | 33 ------------------- .../protocol/reflect/SpecificConverter.java | 33 ------------------- .../protocol/MinecraftVersionTest.java | 1 + 4 files changed, 20 insertions(+), 67 deletions(-) delete mode 100644 modules/API/src/main/java/com/comphenix/protocol/reflect/GenericConverter.java delete mode 100644 modules/API/src/main/java/com/comphenix/protocol/reflect/SpecificConverter.java diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java index 4a64f52b..fd52435f 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java +++ b/modules/API/src/main/java/com/comphenix/protocol/reflect/EquivalentConverter.java @@ -23,7 +23,25 @@ package com.comphenix.protocol.reflect; * @author Kristian * @param The specific type. */ -public interface EquivalentConverter extends SpecificConverter, GenericConverter { +public interface EquivalentConverter { + /** + * Retrieve a copy of the generic type from a specific type. + *

+ * This is usually a native net.minecraft.server type in Minecraft. + * @param specific - the specific type we need to copy. + * @return A copy of the specific type. + */ + Object getGeneric(T specific); + + /** + * Retrieve a copy of the specific type using an instance of the generic type. + *

+ * This is usually a wrapper type in the Bukkit API or ProtocolLib API. + * @param generic - the generic type. + * @return The new specific type. + */ + T getSpecific(Object generic); + /** * Due to type erasure, we need to explicitly keep a reference to the specific type. * @return The specific type. diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/GenericConverter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/GenericConverter.java deleted file mode 100644 index 9451fac4..00000000 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/GenericConverter.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2017 Dan Mulloy - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.reflect; - -/** - * Converts specific objects into generic objects. - * @author Dan - * @param Specific type - */ -public interface GenericConverter { - /** - * Retrieve a copy of the generic type from a specific type. - *

- * This is usually a native net.minecraft.server type in Minecraft. - * @param specific - the specific type we need to copy. - * @return A copy of the specific type. - */ - Object getGeneric(T specific); -} \ No newline at end of file diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/SpecificConverter.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/SpecificConverter.java deleted file mode 100644 index 2d39cfae..00000000 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/SpecificConverter.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. - * Copyright (C) 2017 Dan Mulloy - * - * This program is free software; you can redistribute it and/or modify it under the terms of the - * GNU General Public License as published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program; - * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307 USA - */ -package com.comphenix.protocol.reflect; - -/** - * Converts generic objects into specific objects. - * @author Dan - * @param The specific type - */ -public interface SpecificConverter { - /** - * Retrieve a copy of the specific type using an instance of the generic type. - *

- * This is usually a wrapper type in the Bukkit API or ProtocolLib API. - * @param generic - the generic type. - * @return The new specific type. - */ - T getSpecific(Object generic); -} \ No newline at end of file diff --git a/modules/ProtocolLib/src/test/java/com/comphenix/protocol/MinecraftVersionTest.java b/modules/ProtocolLib/src/test/java/com/comphenix/protocol/MinecraftVersionTest.java index b893ac43..4b48a56c 100644 --- a/modules/ProtocolLib/src/test/java/com/comphenix/protocol/MinecraftVersionTest.java +++ b/modules/ProtocolLib/src/test/java/com/comphenix/protocol/MinecraftVersionTest.java @@ -23,6 +23,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Test; +import com.comphenix.protocol.utility.MinecraftProtocolVersion; import com.comphenix.protocol.utility.MinecraftVersion; public class MinecraftVersionTest {