Added open-on-first-login

This commit is contained in:
jman13378 2023-07-06 22:55:47 -04:00
parent 04d344eef2
commit b91ba6403e
46 changed files with 42 additions and 19 deletions

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="org.bukkit.event.EventHandler" />
</list>
</component>
<component name="MavenProjectsManager"> <component name="MavenProjectsManager">
<option name="originalFiles"> <option name="originalFiles">
<list> <list>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>ADVENTURE</platformType>
<platformType>SPIGOT</platformType>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />

View File

@ -1,5 +1,6 @@
package me.rockyhawk.commandpanels.classresources.placeholders; package me.rockyhawk.commandpanels.classresources.placeholders;
import com.bencodez.votingplugin.VotingPluginMain;
import com.bencodez.votingplugin.user.UserManager; import com.bencodez.votingplugin.user.UserManager;
import com.earth2me.essentials.Essentials; import com.earth2me.essentials.Essentials;
import me.realized.tokenmanager.api.TokenManager; import me.realized.tokenmanager.api.TokenManager;
@ -378,7 +379,7 @@ public class Placeholders {
} }
if (plugin.getServer().getPluginManager().isPluginEnabled("VotingPlugin")) { if (plugin.getServer().getPluginManager().isPluginEnabled("VotingPlugin")) {
if(identifier.equals("votingplugin-points")) { if(identifier.equals("votingplugin-points")) {
return String.valueOf(UserManager.getInstance().getVotingPluginUser(p).getPoints()); return String.valueOf(VotingPluginMain.plugin.getVotingPluginUserManager().getVotingPluginUser(p).getPoints());
} }
} }
//end nodes with PlaceHolders //end nodes with PlaceHolders

View File

@ -19,7 +19,7 @@ public class CommandPanelImport implements CommandExecutor {
CommandPanels plugin; CommandPanels plugin;
public CommandPanelImport(CommandPanels pl) { this.plugin = pl; } public CommandPanelImport(CommandPanels pl) { this.plugin = pl; }
@EventHandler @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender.hasPermission("commandpanel.import")) { if (sender.hasPermission("commandpanel.import")) {
if (args.length == 2) { if (args.length == 2) {

View File

@ -17,7 +17,7 @@ public class Commandpanel implements CommandExecutor {
this.plugin = pl; this.plugin = pl;
} }
@EventHandler @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
//below is going to go through the files and find the right one //below is going to go through the files and find the right one
Panel panel = null; Panel panel = null;

View File

@ -15,19 +15,29 @@ public class OpenOnJoin implements Listener {
} }
@EventHandler @EventHandler
public void onWorldLogin(PlayerJoinEvent e){ public void onWorldLogin(PlayerJoinEvent e){
//only opens when the player first logins if (!e.getPlayer().hasPlayedBefore()) {
openOnJoin(e.getPlayer(),"open-on-login."); openOnJoin(e.getPlayer(),"open-on-first-login");
return;
}
//only opens when the player logs into the server
openOnJoin(e.getPlayer(),"open-on-login");
} }
@EventHandler @EventHandler
public void onWorldJoin(PlayerChangedWorldEvent e){ public void onWorldJoin(PlayerChangedWorldEvent e){
//only opens when the player changes the world internally //only opens when the player changes the world internally
openOnJoin(e.getPlayer(),"open-on-join."); openOnJoin(e.getPlayer(),"open-on-join");
} }
private void openOnJoin(Player p, String joinType){ private void openOnJoin(Player p, String joinType){
if(plugin.config.contains(joinType + p.getWorld().getName())){ String world = p.getWorld().getName();
String command = "open= " + plugin.config.getString(joinType + p.getWorld().getName()); // Limited to '1' panel as you can only have '1' inventory open
// 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);
if(plugin.config.contains(joinString)){
String command = "open= " + plugin.config.getString(joinString);
plugin.commandTags.runCommand(null, PanelPosition.Top,p, command); plugin.commandTags.runCommand(null, PanelPosition.Top,p, command);
} }
} }

Binary file not shown.

Binary file not shown.

View File

@ -75,7 +75,3 @@ purchase:
enable: true enable: true
success: '&aSuccessfully Bought For %cp-args% Experience.' success: '&aSuccessfully Bought For %cp-args% Experience.'
failure: '&cInsufficient Experience!' failure: '&cInsufficient Experience!'
permission:
enable: true
success: "&aYou have successfully passed the permission check for '%cp-args%'"
failure: '&cInefficient Permissions'

View File

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

View File

@ -0,0 +1,6 @@
me\rockyhawk\commandpanels\classresources\ItemCreation$1.class
me\rockyhawk\commandpanels\editor\EditorSettings.class
me\rockyhawk\commandpanels\editor\CommandPanelsEditorTabComplete.class
me\rockyhawk\commandpanels\editor\CommandPanelsEditorCommand.class
me\rockyhawk\commandpanels\editor\CPEventHandler.class
me\rockyhawk\commandpanels\editor\CommandPanelsEditorMain.class