Integrate utility method

This commit is contained in:
BuildTools 2019-02-13 23:24:43 -05:00
parent 7427a27a60
commit 138d580da8
3 changed files with 28 additions and 12 deletions

View File

@ -1,3 +1,15 @@
/*******************************************************************************************************
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.prompts;
import java.util.Arrays;

View File

@ -1,3 +1,15 @@
/*******************************************************************************************************
* Continued by FlyingPikachu/HappyPikachu with permission from _Blackvein_. All rights reserved.
*
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************************************/
package me.blackvein.quests.prompts;
import java.util.Arrays;

View File

@ -33,8 +33,10 @@ public class MiscUtil {
public static String getProperMobName(EntityType type) {
String name = type.name().toLowerCase();
name = Character.toUpperCase(name.charAt(0)) + name.substring(1);
while (fixUnderscore(name) != null) {
name = fixUnderscore(name);
int index = name.indexOf('_');
if (index != -1) {
name = name.substring(0, (index + 1)) + Character.toUpperCase(name.charAt(index + 1)) + name.substring(index + 2);
name = name.replaceFirst("_", "");
}
return name;
}
@ -49,16 +51,6 @@ public class MiscUtil {
return null;
}
public static String fixUnderscore(String s) {
int index = s.indexOf('_');
if (index == -1) {
return null;
}
s = s.substring(0, (index + 1)) + Character.toUpperCase(s.charAt(index + 1)) + s.substring(index + 2);
s = s.replaceFirst("_", "");
return s;
}
public static String concatArgArray(String[] args, int startingIndex, int endingIndex, char delimiter) {
String s = "";
for (int i = startingIndex; i <= endingIndex; i++) {