Fix console error on join in case the spawn is not set
This commit is contained in:
parent
71716710af
commit
c0fa56fea2
6
pom.xml
6
pom.xml
@ -21,8 +21,8 @@
|
|||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<versionName>${project.version}</versionName>
|
<versionName>${project.version}</versionName>
|
||||||
</properties>
|
</properties>
|
||||||
@ -39,7 +39,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<version>1.19.2-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -36,6 +36,12 @@ public class MessageUtils
|
|||||||
sender = plugin.getServer().getPlayer(senderName);
|
sender = plugin.getServer().getPlayer(senderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendLocalizedMessage(sender, messageEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendLocalizedMessage(CommandSender sender, LocalizedMessages messageEnum)
|
||||||
|
{
|
||||||
|
|
||||||
// If we actually have a sender, send it the message and color it!
|
// If we actually have a sender, send it the message and color it!
|
||||||
if(sender != null) sender.sendMessage(getLocalizedMessage(messageEnum, true));
|
if(sender != null) sender.sendMessage(getLocalizedMessage(messageEnum, true));
|
||||||
// If the sender is null, report it to the debugger.
|
// If the sender is null, report it to the debugger.
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package wtf.beatrice.uhccore.utils;
|
||||||
|
|
||||||
|
public class QuickLogger {
|
||||||
|
|
||||||
|
}
|
@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.entity.Firework;
|
import org.bukkit.entity.Firework;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.meta.FireworkMeta;
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
import wtf.beatrice.uhccore.utils.configuration.LocalizedMessages;
|
||||||
|
|
||||||
public class UhcUtils {
|
public class UhcUtils {
|
||||||
|
|
||||||
@ -69,6 +70,12 @@ public class UhcUtils {
|
|||||||
|
|
||||||
public static void tpSpawnAndGiveItem(Player player)
|
public static void tpSpawnAndGiveItem(Player player)
|
||||||
{
|
{
|
||||||
|
if(Cache.spawn == null)
|
||||||
|
{
|
||||||
|
MessageUtils.sendLocalizedMessage(player, LocalizedMessages.ERROR_SERVER_NOT_SET_UP);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
player.teleport(Cache.spawn);
|
player.teleport(Cache.spawn);
|
||||||
|
|
||||||
|
@ -7,7 +7,11 @@ public enum LocalizedMessages {
|
|||||||
|
|
||||||
WARNING_CONSOLE_ACCESS("error.console_access"),
|
WARNING_CONSOLE_ACCESS("error.console_access"),
|
||||||
|
|
||||||
ERROR_CONSOLE_ACCESS_BLOCKED("error.console_access_blocked");
|
ERROR_CONSOLE_ACCESS_BLOCKED("error.console_access_blocked"),
|
||||||
|
ERROR_SERVER_NOT_SET_UP("error.server_not_set_up"),
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public String path;
|
public String path;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
error:
|
error:
|
||||||
console_access: '&eWarning! You are accessing the plugin command from console.'
|
console_access: '&eWarning! You are accessing the plugin command from console.'
|
||||||
console_access_blocked: '&cSorry, but this command is not available via console.'
|
console_access_blocked: '&cSorry, but this command is not available via console.'
|
||||||
|
server_not_set_up: '&cThis server has no been set up!'
|
||||||
info: '&bThis is a colored and localized message!'
|
info: '&bThis is a colored and localized message!'
|
||||||
player_position: '&bYour position is: &e%pos%'
|
player_position: '&bYour position is: &e%pos%'
|
Loading…
Reference in New Issue
Block a user