mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-23 05:36:46 +01:00
Finalized page system. Moved grabbing pages to Page.java.
This commit is contained in:
parent
12fbaa4361
commit
d1c4efa30d
@ -47,49 +47,8 @@ public class ExcavationCommand implements CommandExecutor {
|
||||
player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
|
||||
player.sendMessage(mcLocale.getString("m.ExcavationGigaDrillBreakerLength", new Object[] { ticks }));
|
||||
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if(args[0].equals("?"))
|
||||
{
|
||||
Page.clearChat(player);
|
||||
if(args.length > 1 && m.isInt(args[1]))
|
||||
{
|
||||
for(String target : Page.grabPageContents("Excavation Guide", "Guides.Excavation", m.getInt(args[1])))
|
||||
{
|
||||
player.sendMessage(target);
|
||||
}
|
||||
Page.grabGuidePageForSkill(SkillType.EXCAVATION, player, args);
|
||||
|
||||
/*
|
||||
player.sendMessage("");
|
||||
player.sendMessage("==XP Gain==");
|
||||
player.sendMessage("Base XP: " + LoadProperties.mbase);
|
||||
player.sendMessage(ChatColor.GRAY + "Awarded for digging Dirt, Grass, Sand, Gravel, ");
|
||||
player.sendMessage(ChatColor.GRAY + "Soul Sand, Mycelium, and Clay.");
|
||||
player.sendMessage("Treasures: Varies by item");
|
||||
player.sendMessage(ChatColor.GRAY + "Awarded for finding items while digging.");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("==Abilities==");
|
||||
player.sendMessage("Giga Drill Breaker");
|
||||
player.sendMessage(ChatColor.GRAY + "Right-click with a shovel in hand to prep this ability.");
|
||||
player.sendMessage(ChatColor.GRAY + "Allows for instabreaking of associated blocks.");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("==Subskills==");
|
||||
player.sendMessage("Treasure Hunter");
|
||||
player.sendMessage(ChatColor.GRAY + "Randomly find valuable items while digging.");
|
||||
player.sendMessage(ChatColor.GRAY + "Items found vary depending on skill level.");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("==PAGE 1 of 1==");
|
||||
*/
|
||||
} else if(args.length > 1 && !m.isInt(args[1]))
|
||||
{
|
||||
player.sendMessage("Not a valid page number!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /excavation ? [page]");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -5,9 +5,21 @@ import java.util.ArrayList;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.m;
|
||||
import com.gmail.nossr50.datatypes.SkillType;
|
||||
import com.gmail.nossr50.locale.mcLocale;
|
||||
|
||||
public class Page {
|
||||
|
||||
public static int getTotalPageNumber(String address)
|
||||
{
|
||||
String[] addressSplit = mcLocale.getString(address).split("\n");
|
||||
if(addressSplit.length < 8)
|
||||
return 1;
|
||||
else
|
||||
return (addressSplit.length/8)+1;
|
||||
}
|
||||
|
||||
public static ArrayList<String> grabPageContents(String header, String address, int pagenum)
|
||||
{
|
||||
int pageIndexStart = 0;
|
||||
@ -24,19 +36,16 @@ public class Page {
|
||||
allStrings.add(ChatColor.GOLD+"-="+ChatColor.GREEN+header+ChatColor.GOLD+"=-"); //So stylish
|
||||
|
||||
//Add targeted strings
|
||||
|
||||
while(allStrings.size() < 9)
|
||||
{
|
||||
if(pageIndexStart+allStrings.size() > addressSplit.length)
|
||||
allStrings.add("");
|
||||
else
|
||||
allStrings.add(addressSplit[pageIndexStart+allStrings.size()-1]);
|
||||
}
|
||||
|
||||
int totalPages = 1;
|
||||
|
||||
if(addressSplit.length >= 8)
|
||||
{
|
||||
totalPages = (addressSplit.length/8)+1;
|
||||
}
|
||||
|
||||
allStrings.add("Page "+pagenum+" of "+totalPages);
|
||||
allStrings.add("Page "+pagenum+" of "+getTotalPageNumber(address));
|
||||
return allStrings;
|
||||
}
|
||||
|
||||
@ -50,4 +59,36 @@ public class Page {
|
||||
x++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void grabGuidePageForSkill(SkillType skilltype, Player player, String[] args)
|
||||
{
|
||||
if (args.length >= 1)
|
||||
{
|
||||
if(args[0].equals("?"))
|
||||
{
|
||||
String capitalized = m.getCapitalized(skilltype.toString());
|
||||
String address = "Guides."+capitalized;
|
||||
|
||||
Page.clearChat(player);
|
||||
if(args.length > 1 && m.isInt(args[1]) && m.getInt(args[1]) <= Page.getTotalPageNumber(address))
|
||||
{
|
||||
for(String target : Page.grabPageContents(capitalized+" Guide", address, m.getInt(args[1])))
|
||||
{
|
||||
player.sendMessage(target);
|
||||
}
|
||||
} else if(args.length > 1 && m.getInt(args[1]) > Page.getTotalPageNumber(address))
|
||||
{
|
||||
player.sendMessage("That page doesn't exist, there are only "+Page.getTotalPageNumber(address)+" total pages");
|
||||
}
|
||||
else if(args.length > 1 && !m.isInt(args[1]))
|
||||
{
|
||||
player.sendMessage("Not a valid page number!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Usage is /"+skilltype.toString().toLowerCase()+" ? [page]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -416,4 +416,4 @@ Skills.SerratedStrikesPlayerOff=[[RED]]Serrated Strikes[[GREEN]] has worn off fo
|
||||
Skills.BlastMiningPlayer=[[GREEN]]{0}[[DARK_GREEN]] has used [[RED]]Blast Mining!
|
||||
Skills.YourBlastMining=[[GREEN]]Your [[YELLOW]]Blast Mining [[GREEN]]ability is refreshed!
|
||||
TreeFeller.AxeSplinters=[[RED]]YOUR AXE SPLINTERS INTO DOZENS OF PIECES
|
||||
Guides.Excavation=XP GAIN:\n\nGain XP from soft materials with your shovel.\nMaterials include Grass, Dirt, Sand,\nGravel, Mycelium, and Clay\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT
|
||||
Guides.Excavation=XP GAIN:\n\nGain XP from soft materials with your shovel.\nMaterials include Grass, Dirt, Sand,\nGravel, Mycelium, and Clay\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHIS IS PROOF\nOF CONCEPT\nTHE END
|
Loading…
Reference in New Issue
Block a user