mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Prevent updating achievements for a game where the user cheated using Dev mode functions
This commit is contained in:
@@ -291,4 +291,8 @@ public abstract class PlayerController {
|
|||||||
public boolean canPlayUnlimitedLands() {
|
public boolean canPlayUnlimitedLands() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasCheated() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,8 @@ public abstract class AchievementCollection implements Iterable<Achievement> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateAll(IGuiBase gui, Player player) {
|
public void updateAll(IGuiBase gui, Player player) {
|
||||||
|
if (player.getController().hasCheated()) { return; } //don't update achievements if player cheated during game
|
||||||
|
|
||||||
for (Achievement achievement : achievements.values()) {
|
for (Achievement achievement : achievements.values()) {
|
||||||
achievement.update(gui, player);
|
achievement.update(gui, player);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1681,8 +1681,12 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Dev Mode cheat functions
|
//Dev Mode cheat functions
|
||||||
private DevModeCheats cheats;
|
|
||||||
private boolean canPlayUnlimitedLands;
|
private boolean canPlayUnlimitedLands;
|
||||||
|
@Override
|
||||||
|
public boolean canPlayUnlimitedLands() {
|
||||||
|
return canPlayUnlimitedLands;
|
||||||
|
}
|
||||||
|
private DevModeCheats cheats;
|
||||||
public DevModeCheats cheat() {
|
public DevModeCheats cheat() {
|
||||||
if (cheats == null) {
|
if (cheats == null) {
|
||||||
cheats = new DevModeCheats();
|
cheats = new DevModeCheats();
|
||||||
@@ -1690,13 +1694,10 @@ public class PlayerControllerHuman extends PlayerController {
|
|||||||
}
|
}
|
||||||
return cheats;
|
return cheats;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public boolean hasCheated() {
|
public boolean hasCheated() {
|
||||||
return cheats != null;
|
return cheats != null;
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public boolean canPlayUnlimitedLands() {
|
|
||||||
return canPlayUnlimitedLands;
|
|
||||||
}
|
|
||||||
public class DevModeCheats {
|
public class DevModeCheats {
|
||||||
private DevModeCheats() {
|
private DevModeCheats() {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user