mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2025-02-01 21:11:34 +01:00
Custom ready titles
Because why not?
This commit is contained in:
parent
9c2a45d814
commit
351f10569b
@ -265,6 +265,34 @@ public class WorldConfig extends GameRules {
|
|||||||
if (configFile.contains("forcedGameType")) {
|
if (configFile.contains("forcedGameType")) {
|
||||||
forcedGameType = plugin.getGameTypes().getByName(configFile.getString("forcedGameType"));
|
forcedGameType = plugin.getGameTypes().getByName(configFile.getString("forcedGameType"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.title")) {
|
||||||
|
title = configFile.getString("title.title");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.subtitle")) {
|
||||||
|
subtitle = configFile.getString("title.subtitle");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.actionBar")) {
|
||||||
|
actionBar = configFile.getString("title.actionBar");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.chat")) {
|
||||||
|
chat = configFile.getString("title.chat");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.fadeIn")) {
|
||||||
|
titleFadeIn = (int) configFile.getDouble("title.fadeIn") * 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.fadeOut")) {
|
||||||
|
titleFadeOut = (int) configFile.getDouble("title.fadeOut") * 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configFile.contains("title.show")) {
|
||||||
|
titleShow = (int) configFile.getDouble("title.show") * 20;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
|
@ -79,6 +79,11 @@ public class GameRules {
|
|||||||
DEFAULT_VALUES.gameCommandWhitelist = new ArrayList<>();
|
DEFAULT_VALUES.gameCommandWhitelist = new ArrayList<>();
|
||||||
DEFAULT_VALUES.gamePermissions = new ArrayList<>();
|
DEFAULT_VALUES.gamePermissions = new ArrayList<>();
|
||||||
|
|
||||||
|
/* Title */
|
||||||
|
DEFAULT_VALUES.titleFadeIn = 20;
|
||||||
|
DEFAULT_VALUES.titleFadeOut = 20;
|
||||||
|
DEFAULT_VALUES.titleShow = 60;
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
DEFAULT_VALUES.msgs = new HashMap<>();
|
DEFAULT_VALUES.msgs = new HashMap<>();
|
||||||
DEFAULT_VALUES.secureObjects = new ArrayList<>();
|
DEFAULT_VALUES.secureObjects = new ArrayList<>();
|
||||||
@ -125,6 +130,15 @@ public class GameRules {
|
|||||||
protected List<String> gameCommandWhitelist;
|
protected List<String> gameCommandWhitelist;
|
||||||
protected List<String> gamePermissions;
|
protected List<String> gamePermissions;
|
||||||
|
|
||||||
|
/* Title */
|
||||||
|
protected String title;
|
||||||
|
protected String subtitle;
|
||||||
|
protected String actionBar;
|
||||||
|
protected String chat;
|
||||||
|
protected Integer titleFadeIn;
|
||||||
|
protected Integer titleFadeOut;
|
||||||
|
protected Integer titleShow;
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
protected Map<Integer, String> msgs;
|
protected Map<Integer, String> msgs;
|
||||||
protected List<ItemStack> secureObjects;
|
protected List<ItemStack> secureObjects;
|
||||||
@ -372,6 +386,112 @@ public class GameRules {
|
|||||||
return gamePermissions;
|
return gamePermissions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Title
|
||||||
|
/**
|
||||||
|
* @return the main title string or null for the default one
|
||||||
|
*/
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
* the text to set
|
||||||
|
*/
|
||||||
|
public void setTitle(String text) {
|
||||||
|
title = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the subtitle string or null for the default one
|
||||||
|
*/
|
||||||
|
public String getSubTitle() {
|
||||||
|
return subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
* the text to set
|
||||||
|
*/
|
||||||
|
public void setSubTitle(String text) {
|
||||||
|
subtitle = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the action bar string or null for the default one
|
||||||
|
*/
|
||||||
|
public String getActionBar() {
|
||||||
|
return actionBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
* the text to set
|
||||||
|
*/
|
||||||
|
public void setActionBar(String text) {
|
||||||
|
actionBar = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the chat message string or null for the default one
|
||||||
|
*/
|
||||||
|
public String getChatText() {
|
||||||
|
return chat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param text
|
||||||
|
* the text to set
|
||||||
|
*/
|
||||||
|
public void setChatText(String text) {
|
||||||
|
chat = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the title fade in time in ticks
|
||||||
|
*/
|
||||||
|
public int getTitleFadeIn() {
|
||||||
|
return titleFadeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param time
|
||||||
|
* the time to set
|
||||||
|
*/
|
||||||
|
public void setTitleFadeIn(int time) {
|
||||||
|
titleFadeIn = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the title fade out time in ticks
|
||||||
|
*/
|
||||||
|
public int getTitleFadeOut() {
|
||||||
|
return titleFadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param time
|
||||||
|
* the time to set
|
||||||
|
*/
|
||||||
|
public void setTitleFadeOut(int time) {
|
||||||
|
titleFadeOut = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the time until the title disappears in ticks
|
||||||
|
*/
|
||||||
|
public int getTitleShow() {
|
||||||
|
return titleShow;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param time
|
||||||
|
* the time to set
|
||||||
|
*/
|
||||||
|
public void setTitleShow(int time) {
|
||||||
|
titleShow = time;
|
||||||
|
}
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
@ -579,6 +699,35 @@ public class GameRules {
|
|||||||
gamePermissions.addAll(defaultValues.gamePermissions);
|
gamePermissions.addAll(defaultValues.gamePermissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Title */
|
||||||
|
if (title == null) {
|
||||||
|
title = defaultValues.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subtitle == null) {
|
||||||
|
subtitle = defaultValues.subtitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actionBar == null) {
|
||||||
|
actionBar = defaultValues.actionBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chat == null) {
|
||||||
|
chat = defaultValues.chat;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titleFadeIn == null) {
|
||||||
|
titleFadeIn = defaultValues.titleFadeIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titleFadeOut == null) {
|
||||||
|
titleFadeOut = defaultValues.titleFadeOut;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (titleShow == null) {
|
||||||
|
titleShow = defaultValues.titleShow;
|
||||||
|
}
|
||||||
|
|
||||||
/* Misc */
|
/* Misc */
|
||||||
if (msgs == null) {
|
if (msgs == null) {
|
||||||
msgs = defaultValues.msgs;
|
msgs = defaultValues.msgs;
|
||||||
|
@ -710,12 +710,26 @@ public class DGroup {
|
|||||||
dPlayer.respawn();
|
dPlayer.respawn();
|
||||||
|
|
||||||
if (plugin.getMainConfig().isSendFloorTitleEnabled()) {
|
if (plugin.getMainConfig().isSendFloorTitleEnabled()) {
|
||||||
if (dungeonName != null) {
|
if (rules.getTitle() != null || rules.getSubTitle() != null) {
|
||||||
|
String title = rules.getTitle() == null ? "" : rules.getTitle();
|
||||||
|
String subtitle = rules.getSubTitle() == null ? "" : rules.getSubTitle();
|
||||||
|
|
||||||
|
MessageUtil.sendTitleMessage(player, title, subtitle, rules.getTitleFadeIn(), rules.getTitleShow(), rules.getTitleFadeOut());
|
||||||
|
|
||||||
|
} else if (dungeonName != null) {
|
||||||
MessageUtil.sendTitleMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", " "));
|
MessageUtil.sendTitleMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", " "));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
MessageUtil.sendTitleMessage(player, "&4&l" + mapName.replaceAll("_", " "));
|
MessageUtil.sendTitleMessage(player, "&4&l" + mapName.replaceAll("_", " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (rules.getActionBar() != null) {
|
||||||
|
MessageUtil.sendActionBarMessage(player, rules.getActionBar());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rules.getChatText() != null) {
|
||||||
|
MessageUtil.sendCenteredMessage(player, rules.getChatText());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Requirement requirement : rules.getRequirements()) {
|
for (Requirement requirement : rules.getRequirements()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user