Added option to change back content for usercontent
This commit is contained in:
@@ -180,6 +180,17 @@ public class ContentUsercontent extends Content
|
||||
return Contents.getRegisteredContent(this.content.getGui().getTab().getActiveContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Content getBackContent()
|
||||
{
|
||||
if(this.content.getGui().getTab().getActiveContent() == null)
|
||||
{
|
||||
return super.getBackContent();
|
||||
}
|
||||
|
||||
return Contents.getRegisteredContent(this.content.getGui().getTab().getBackContent());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerNameChanged(String username)
|
||||
{
|
||||
|
||||
@@ -20,12 +20,16 @@ public class JsonTab
|
||||
@SerializedName("active_content")
|
||||
private String activeContent;
|
||||
|
||||
public JsonTab(String title, String category, int categoryIndex, String activeContent)
|
||||
@SerializedName("back_content")
|
||||
private String backContent;
|
||||
|
||||
public JsonTab(String title, String category, int categoryIndex, String activeContent, String backContent)
|
||||
{
|
||||
this.title = title;
|
||||
this.category = category;
|
||||
this.categoryIndex = categoryIndex;
|
||||
this.activeContent = activeContent;
|
||||
this.backContent = backContent;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
@@ -68,11 +72,29 @@ public class JsonTab
|
||||
this.activeContent = activeContent;
|
||||
}
|
||||
|
||||
public String getBackContent()
|
||||
{
|
||||
return this.backContent;
|
||||
}
|
||||
|
||||
public void setBackContent(String backContent)
|
||||
{
|
||||
this.backContent = backContent;
|
||||
}
|
||||
|
||||
public void validate() throws IllegalStateException
|
||||
{
|
||||
if(this.category == null)
|
||||
{
|
||||
throw new IllegalStateException("tab.category is null");
|
||||
}
|
||||
else if(this.activeContent != null && this.activeContent.isEmpty())
|
||||
{
|
||||
throw new IllegalStateException("tab.active_content is empty");
|
||||
}
|
||||
else if(this.backContent != null && this.backContent.isEmpty())
|
||||
{
|
||||
throw new IllegalStateException("tab.back_content is empty");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user