This commit is contained in:
rockyhawk64 2023-10-08 11:06:57 +11:00
parent 02b2422de0
commit 277fe46859
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
version: 3.19.1.4
version: 3.19.1.5
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -15,12 +15,14 @@ public class OpenOnJoin implements Listener {
}
@EventHandler
public void onWorldLogin(PlayerJoinEvent e){
if (!e.getPlayer().hasPlayedBefore()) {
openOnJoin(e.getPlayer(),"open-on-first-login");
if (!e.getPlayer().hasPlayedBefore() && plugin.config.contains("open-on-first-login")) {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
openOnJoin(e.getPlayer(), "open-on-first-login"), 40L); // 2 seconds delay
return;
}
//only opens when the player logs into the server
openOnJoin(e.getPlayer(),"open-on-login");
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () ->
openOnJoin(e.getPlayer(),"open-on-login"), 20L); // 1 seconds delay
}
@EventHandler
@ -35,7 +37,7 @@ public class OpenOnJoin implements Listener {
// pass the world as "" to tell the code to not use world
if (joinType.equalsIgnoreCase("open-on-first-login")) world="";
String joinString = joinType + (world.equals("") ? "" : "."+ world);
String joinString = joinType + (world.isEmpty() ? "" : "."+ world);
if(plugin.config.contains(joinString)){
String command = "open= " + plugin.config.getString(joinString);
plugin.commandTags.runCommand(null, PanelPosition.Top,p, command);