mirror of
https://github.com/PikaMug/Quests.git
synced 2024-12-27 19:47:35 +01:00
Integrate utility method
This commit is contained in:
parent
7427a27a60
commit
138d580da8
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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++) {
|
||||
|
Loading…
Reference in New Issue
Block a user