Skip to content

Commit

Permalink
Allow like/dislike to be used when any game is running, but now only …
Browse files Browse the repository at this point in the history
…allow it to be used on levels that are currently running a game
  • Loading branch information
UnknownShadow200 committed Dec 14, 2022
1 parent 566ca7e commit 1b3f66d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 0 additions & 2 deletions MCGalaxy/Commands/Command.Helpers.cs
Expand Up @@ -30,8 +30,6 @@ public abstract partial class Command {
if (enable == CommandEnable.Economy && !Economy.Enabled)
return "economy is disabled.";

if (enable == bothFlags && !(ZSGame.Instance.Running || LSGame.Instance.Running))
return "neither zombie nor lava survival is running.";
if (enable == CommandEnable.Zombie && !ZSGame.Instance.Running)
return "zombie survival is not running.";
if (enable == CommandEnable.Lava)
Expand Down
14 changes: 10 additions & 4 deletions MCGalaxy/Commands/Fun/RateMapCmds.cs
Expand Up @@ -16,20 +16,26 @@
permissions and limitations under the Licenses.
*/
using System;
using MCGalaxy.Games;

namespace MCGalaxy.Commands.Fun {

public class CmdLike : Command2 {
namespace MCGalaxy.Commands.Fun
{
public class CmdLike : Command2
{
public override string name { get { return "Like"; } }
public override string type { get { return CommandTypes.Games; } }
public override CommandEnable Enabled { get { return CommandEnable.Zombie | CommandEnable.Lava; } }
public override bool SuperUseable { get { return false; } }

public override void Use(Player p, string message, CommandData data) { RateMap(p, true); }

protected bool RateMap(Player p, bool like) {
string prefix = like ? "" : "dis";

IGame game = IGame.GameOn(p.level);
if (game == null) {
p.Message("Can only {0}like this map when a game is running on it.", prefix); return false;
}

if (p.Game.RatedMap) {
prefix = p.Game.LikedMap ? "" : "dis";
p.Message("You have already {0}liked this map.", prefix); return false;
Expand Down

0 comments on commit 1b3f66d

Please sign in to comment.