Implimented the new tips as requested by CSGI: This took me about 2 hours with less than 2 month of total java experience. As such, MP's developers should be able to do it in much less time... If they can't, then I have no hope for Mineplex...
This commit is contained in:
Daniel Waggner 2021-06-04 13:55:05 -07:00
parent e04ecbd9e9
commit eee2b297ae
3 changed files with 56 additions and 6 deletions

View File

@ -65,9 +65,12 @@ public class CastleSiegeNew extends TeamGame
// protected String[] _help; // protected String[] _help;
private int _undeadIndex = 0; private int _undeadIndex = 0;
private int _defenderIndex = 0; private int _defenderIndex = 0;
private int _generalIndex = 0;
private ChatColor defenderTipColor; private ChatColor defenderTipColor;
private ChatColor undeadTipColor; private ChatColor undeadTipColor;
private ChatColor generalTipColor;
private boolean showDefTip = true; private boolean showDefTip = true;
private boolean showGenTips = false;
private static final String[] DESCRIPTION = { private static final String[] DESCRIPTION = {
C.cAqua + "Defenders" + C.cWhite + " must defend the King.", C.cAqua + "Defenders" + C.cWhite + " must defend the King.",
@ -77,7 +80,7 @@ public class CastleSiegeNew extends TeamGame
C.cRed + "Undead" + C.cWhite + " must kill the King.", C.cRed + "Undead" + C.cWhite + " must kill the King.",
C.cRed + "Undead" + C.cWhite + " lose when the sun rises." C.cRed + "Undead" + C.cWhite + " lose when the sun rises."
}; };
// Original Tip strings - commented out original calling (_help DNF) // Original Tip strings
private static final String[] TIPS = { private static final String[] TIPS = {
"TNT randomly spawns at 3 different locations outside the undead forest.", "TNT randomly spawns at 3 different locations outside the undead forest.",
"Right-click TNT to pick it up.", "Right-click TNT to pick it up.",
@ -89,14 +92,27 @@ public class CastleSiegeNew extends TeamGame
"Defenders respawn as wolves with no armor or weapons.", "Defenders respawn as wolves with no armor or weapons.",
"Wolves must wait 6 seconds in between respawns.", "Wolves must wait 6 seconds in between respawns.",
"Coordination and teamwork are important to winning as Defenders.", "Coordination and teamwork are important to winning as Defenders.",
"In order to add this tip, I had to add the SUPER TEDIOUS... One line string... to the CastleSiegeNew.java file..." "A strong defense has around 75% marksmen and 25% knights",
"Defense, watch out for undead who try to knock you off!",
"Click fences to open them!",
"Defense should avoid retreating to improve their chance of winning!",
"TNT is deadly! Attack TNT from a distance",
"Wolves are best suited to target Undead holding TNT."
}; };
// Undead Tips - Colored red // Undead Tips - Colored red
private static final String[] UndeadTips = { private static final String[] UndeadTips = {
"TNT randomly spawns at 3 different locations outside the undead forest.", "TNT randomly spawns at 3 different locations outside the undead forest.",
"Right-click TNT to pick it up.", "Right-click TNT to pick it up.",
"TNT will automatically explode 30 seconds after being picked up.", "TNT will automatically explode 30 seconds after being picked up.",
"Undead respawn instantly." "Undead respawn instantly.",
" Iron Bars and Cracked Stone Bricks are weak points. Blow them open with TNT!",
"Click while holding TNT to explode.",
"Use your axe to break oak fences! Other fences cannot be broken…",
"Opening multiple pathways are useful for the Undead!",
" Iron bars can only be destroyed with TNT",
"The skeleton kit is useful to kill marksmen",
"Skeletons can only pick up extra arrows shot from knights and paladins!"
}; };
// Defender Tips - Colored aqua // Defender Tips - Colored aqua
private static final String[] DefenderTips = { private static final String[] DefenderTips = {
@ -108,6 +124,13 @@ public class CastleSiegeNew extends TeamGame
"Coordination and teamwork are important to winning as Defenders." "Coordination and teamwork are important to winning as Defenders."
}; };
// Defender Tips - Colored yellow
private static final String[] GeneralTips = {
"Use 1.8.9 for the best gameplay experience!",
"Castle Siege is a challenging game! Work together to succeed.",
"Use Team Chat to coordinate! Message in Team Chat using this format: #(message)"
};
private static final int START_TIME = 14000; private static final int START_TIME = 14000;
private static final int UNDEAD_BURN_TIME = 24000; private static final int UNDEAD_BURN_TIME = 24000;
private static final int DEFENDER_WIN_TIME = UNDEAD_BURN_TIME + 200; private static final int DEFENDER_WIN_TIME = UNDEAD_BURN_TIME + 200;
@ -237,10 +260,10 @@ public class CastleSiegeNew extends TeamGame
} }
@EventHandler @EventHandler
public void DisplayTips(UpdateEvent event) public void DisplayCSTips(UpdateEvent event)
{ {
if (showDefTip) { if (showDefTip && !showGenTips) {
if (!inLobby() || event.getType() != UpdateType.SLOWER) { if (!inLobby() || event.getType() != UpdateType.SLOWER) {
return; return;
} }
@ -266,7 +289,7 @@ public class CastleSiegeNew extends TeamGame
showDefTip = false; showDefTip = false;
} }
else { else if (!showDefTip && !showGenTips) {
if (!inLobby() || event.getType() != UpdateType.SLOWER) { if (!inLobby() || event.getType() != UpdateType.SLOWER) {
return; return;
} }
@ -289,6 +312,33 @@ public class CastleSiegeNew extends TeamGame
} }
_undeadIndex = (_undeadIndex + 1) % UndeadTips.length; _undeadIndex = (_undeadIndex + 1) % UndeadTips.length;
showGenTips = true;
}
else {
if (!inLobby() || event.getType() != UpdateType.SLOWER) {
return;
}
if (Manager.GetGameHostManager().isCommunityServer()) {
return;
}
generalTipColor = generalTipColor == ChatColor.YELLOW ? ChatColor.YELLOW : ChatColor.YELLOW;
String gen = C.cWhiteB + "TIP> " + ChatColor.RESET + generalTipColor + GeneralTips[_generalIndex];
for (Player player : UtilServer.getPlayersCollection()) {
if (!Manager.getPreferences().get(player).isActive(Preference.GAME_TIPS)) {
continue;
}
player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f);
UtilPlayer.message(player, gen);
}
_generalIndex = (_generalIndex + 1) % GeneralTips.length;
showGenTips = false;
showDefTip = true; showDefTip = true;
} }
} }