mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Send error message when a player joins a game world without a ready sign
This commit is contained in:
parent
2574a06b87
commit
432976712c
@ -117,6 +117,7 @@ public enum DMessage implements Message {
|
|||||||
ERROR_NO_LEAVE_IN_TUTORIAL("error.noLeaveInTutorial"),
|
ERROR_NO_LEAVE_IN_TUTORIAL("error.noLeaveInTutorial"),
|
||||||
ERROR_NO_PERMISSIONS("error.noPermissions"),
|
ERROR_NO_PERMISSIONS("error.noPermissions"),
|
||||||
ERROR_NO_PROTECTED_BLOCK("error.noProtectedBlock"),
|
ERROR_NO_PROTECTED_BLOCK("error.noProtectedBlock"),
|
||||||
|
ERROR_NO_READY_SIGN("error.noReadySign"),
|
||||||
ERROR_NO_REWARDS_TIME("error.noRewardsTime"),
|
ERROR_NO_REWARDS_TIME("error.noRewardsTime"),
|
||||||
ERROR_NO_SUCH_DUNGEON("error.noSuchDungeon"),
|
ERROR_NO_SUCH_DUNGEON("error.noSuchDungeon"),
|
||||||
ERROR_NO_SUCH_GROUP("error.noSuchGroup"),
|
ERROR_NO_SUCH_GROUP("error.noSuchGroup"),
|
||||||
|
@ -112,6 +112,10 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer {
|
|||||||
} else {
|
} else {
|
||||||
PlayerUtil.secureTeleport(player, teleport);
|
PlayerUtil.secureTeleport(player, teleport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!((DGameWorld) world).hasReadySign()) {
|
||||||
|
MessageUtil.sendMessage(player, DMessage.ERROR_NO_READY_SIGN.getMessage(world.getName()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Getters and setters */
|
/* Getters and setters */
|
||||||
|
@ -103,6 +103,8 @@ public class ReadySign extends Button {
|
|||||||
getSign().setLine(2, "");
|
getSign().setLine(2, "");
|
||||||
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
|
getSign().setLine(3, ChatColor.DARK_BLUE + "############");
|
||||||
getSign().update();
|
getSign().update();
|
||||||
|
|
||||||
|
((DGameWorld) getGameWorld()).setReadySign(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,7 +33,7 @@ import de.erethon.dungeonsxl.api.world.GameWorld;
|
|||||||
import de.erethon.dungeonsxl.dungeon.DGame;
|
import de.erethon.dungeonsxl.dungeon.DGame;
|
||||||
import de.erethon.dungeonsxl.event.gameworld.GameWorldStartGameEvent;
|
import de.erethon.dungeonsxl.event.gameworld.GameWorldStartGameEvent;
|
||||||
import de.erethon.dungeonsxl.event.gameworld.GameWorldUnloadEvent;
|
import de.erethon.dungeonsxl.event.gameworld.GameWorldUnloadEvent;
|
||||||
import de.erethon.dungeonsxl.sign.LocationSign;
|
import de.erethon.dungeonsxl.sign.button.ReadySign;
|
||||||
import de.erethon.dungeonsxl.sign.passive.StartSign;
|
import de.erethon.dungeonsxl.sign.passive.StartSign;
|
||||||
import de.erethon.dungeonsxl.sign.windup.MobSign;
|
import de.erethon.dungeonsxl.sign.windup.MobSign;
|
||||||
import de.erethon.dungeonsxl.trigger.FortuneTrigger;
|
import de.erethon.dungeonsxl.trigger.FortuneTrigger;
|
||||||
@ -94,6 +94,8 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
|
|||||||
private List<DungeonMob> mobs = new ArrayList<>();
|
private List<DungeonMob> mobs = new ArrayList<>();
|
||||||
private List<Trigger> triggers = new ArrayList<>();
|
private List<Trigger> triggers = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean readySign;
|
||||||
|
|
||||||
DGameWorld(DungeonsXL plugin, DResourceWorld resourceWorld, File folder, World world, int id) {
|
DGameWorld(DungeonsXL plugin, DResourceWorld resourceWorld, File folder, World world, int id) {
|
||||||
super(plugin, resourceWorld, folder, world, id);
|
super(plugin, resourceWorld, folder, world, id);
|
||||||
caliburn = plugin.getCaliburn();
|
caliburn = plugin.getCaliburn();
|
||||||
@ -132,19 +134,19 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
|
|||||||
int index = getGame().getGroups().indexOf(dGroup);
|
int index = getGame().getGroups().indexOf(dGroup);
|
||||||
|
|
||||||
// Try the matching location
|
// Try the matching location
|
||||||
|
StartSign anyStartSign = null;
|
||||||
for (DungeonSign sign : getDungeonSigns()) {
|
for (DungeonSign sign : getDungeonSigns()) {
|
||||||
if (sign instanceof StartSign) {
|
if (sign instanceof StartSign) {
|
||||||
if (((StartSign) sign).getId() == index) {
|
anyStartSign = (StartSign) sign;
|
||||||
return ((LocationSign) sign).getLocation();
|
if (anyStartSign.getId() == index) {
|
||||||
|
return anyStartSign.getLocation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try any location
|
// Try any start sign
|
||||||
for (DungeonSign sign : getDungeonSigns()) {
|
if (anyStartSign != null) {
|
||||||
if (sign instanceof StartSign) {
|
return anyStartSign.getLocation();
|
||||||
return ((LocationSign) sign).getLocation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lobby location as fallback
|
// Lobby location as fallback
|
||||||
@ -389,6 +391,14 @@ public class DGameWorld extends DInstanceWorld implements GameWorld {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasReadySign() {
|
||||||
|
return readySign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReadySign(ReadySign readySign) {
|
||||||
|
this.readySign = readySign != null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set up the instance for the game
|
* Set up the instance for the game
|
||||||
*/
|
*/
|
||||||
|
@ -127,6 +127,7 @@ error:
|
|||||||
noLeaveInTutorial: "&4You cannot use this command in the tutorial."
|
noLeaveInTutorial: "&4You cannot use this command in the tutorial."
|
||||||
noPermissions: "&4You do not have permission to do this."
|
noPermissions: "&4You do not have permission to do this."
|
||||||
noProtectedBlock: "&4This is not a block protected by DungeonsXL."
|
noProtectedBlock: "&4This is not a block protected by DungeonsXL."
|
||||||
|
noReadySign: "&4The world &6&v1 &4does not seem to have a ready sign. No game can be started and only lobby dungeon signs will be initialized."
|
||||||
noRewardsTime: "&4You cannot receive rewards before &6&v1&4."
|
noRewardsTime: "&4You cannot receive rewards before &6&v1&4."
|
||||||
noSuchDungeon: "&4This dungeon does not exist."
|
noSuchDungeon: "&4This dungeon does not exist."
|
||||||
noSuchGroup: "&4The group &6&v1&4 does not exist."
|
noSuchGroup: "&4The group &6&v1&4 does not exist."
|
||||||
|
@ -127,6 +127,7 @@ error:
|
|||||||
noLeaveInTutorial: "&4Vous ne pouvez utiliser cette commande dans le tutoriel."
|
noLeaveInTutorial: "&4Vous ne pouvez utiliser cette commande dans le tutoriel."
|
||||||
noPermissions: "&4Vous n'avez pas la permission de faire ça."
|
noPermissions: "&4Vous n'avez pas la permission de faire ça."
|
||||||
noProtectedBlock: "&4Ce n'est pas un bloc protégé par DungeonsXL."
|
noProtectedBlock: "&4Ce n'est pas un bloc protégé par DungeonsXL."
|
||||||
|
noReadySign: "&4La carte &6&v1 &4n'a pas de panneau \"ready\". On ne peut pas commencer des jeus et les panneaux de lobby ne sont que initialisés."
|
||||||
noRewardsTime: "&4Vous ne pouvez pas recevoir de récompense avant &6&v1&4."
|
noRewardsTime: "&4Vous ne pouvez pas recevoir de récompense avant &6&v1&4."
|
||||||
noSuchDungeon: "&4Le donjon &6&v1&4 n'existe pas."
|
noSuchDungeon: "&4Le donjon &6&v1&4 n'existe pas."
|
||||||
noSuchGroup: "&4Le groupe &6&v1&4 n'existe pas."
|
noSuchGroup: "&4Le groupe &6&v1&4 n'existe pas."
|
||||||
|
@ -127,6 +127,7 @@ error:
|
|||||||
noLeaveInTutorial: "&4Du kannst diesen Befehl im Tutorial nicht benutzen."
|
noLeaveInTutorial: "&4Du kannst diesen Befehl im Tutorial nicht benutzen."
|
||||||
noPermissions: "&4Du hast nicht die nötigen Berechtigungen, um das zu tun."
|
noPermissions: "&4Du hast nicht die nötigen Berechtigungen, um das zu tun."
|
||||||
noProtectedBlock: "&4Das ist kein von DungeonsXL geschützter Block."
|
noProtectedBlock: "&4Das ist kein von DungeonsXL geschützter Block."
|
||||||
|
noReadySign: "&4Die Welt &6&v1 &4hat kein Ready-Schild. Spiele können nicht begonnen werden und nur Lobby-Schilder werden geladen."
|
||||||
noRewardsTime: "&4Du kannst vor &6&v1&4 keine Belohnungen bekommen."
|
noRewardsTime: "&4Du kannst vor &6&v1&4 keine Belohnungen bekommen."
|
||||||
noSuchDungeon: "&4Dieser Dungeon existiert nicht."
|
noSuchDungeon: "&4Dieser Dungeon existiert nicht."
|
||||||
noSuchGroup: "&4Die Gruppe &6&v1&4 gibt es nicht."
|
noSuchGroup: "&4Die Gruppe &6&v1&4 gibt es nicht."
|
||||||
|
Loading…
Reference in New Issue
Block a user