dunno if it works

This commit is contained in:
2023-11-12 10:40:18 +08:00
parent fb4baac9d4
commit dc680883ac
5 changed files with 25 additions and 10 deletions
-1
View File
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="EntryPointsManager"> <component name="EntryPointsManager">
<list size="1"> <list size="1">
+1
View File
@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/.idea/modules/cf.sobrooms.notifyonstart.main.iml" filepath="$PROJECT_DIR$/.idea/modules/cf.sobrooms.notifyonstart.main.iml" />
<module fileurl="file://$PROJECT_DIR$/.idea/modules/notifyonstart.main.iml" filepath="$PROJECT_DIR$/.idea/modules/notifyonstart.main.iml" /> <module fileurl="file://$PROJECT_DIR$/.idea/modules/notifyonstart.main.iml" filepath="$PROJECT_DIR$/.idea/modules/notifyonstart.main.iml" />
</modules> </modules>
</component> </component>
+12 -7
View File
@@ -5,7 +5,11 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="ce97b9f5-6785-4670-b350-12f90ab9ea27" name="Changes" comment="wrong version number"> <list default="true" id="ce97b9f5-6785-4670-b350-12f90ab9ea27" name="Changes" comment="wrong version number">
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/modules.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cf/sobrooms/commands/SetLoggingModeCommand.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cf/sobrooms/commands/SetLoggingModeCommand.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/cf/sobrooms/events/player/PlayerJoin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/cf/sobrooms/events/player/PlayerJoin.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -44,18 +48,19 @@
&quot;associatedIndex&quot;: 8 &quot;associatedIndex&quot;: 8
}</component> }</component>
<component name="ProjectId" id="2VtRIra79d9tkHTc8fsXlFQRFWj" /> <component name="ProjectId" id="2VtRIra79d9tkHTc8fsXlFQRFWj" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;, "RunOnceActivity.OpenProjectViewOnStart": "true",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;, "SHARE_PROJECT_CONFIGURATION_FILES": "true",
&quot;git-widget-placeholder&quot;: &quot;main&quot; "git-widget-placeholder": "main"
} }
}</component> }]]></component>
<component name="RunManager"> <component name="RunManager">
<configuration name="notify-on-start [build]" type="GradleRunConfiguration" factoryName="Gradle" nameIsGenerated="true"> <configuration name="notify-on-start [build]" type="GradleRunConfiguration" factoryName="Gradle" nameIsGenerated="true">
<ExternalSystemSettings> <ExternalSystemSettings>
@@ -1,6 +1,7 @@
package cf.sobrooms.commands; package cf.sobrooms.commands;
import cf.sobrooms.Main; import cf.sobrooms.Main;
import org.bukkit.Bukkit;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@@ -12,17 +13,24 @@ import java.io.IOException;
public class SetLoggingModeCommand implements CommandExecutor { public class SetLoggingModeCommand implements CommandExecutor {
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args[0].isBlank()) { if (args[0].isBlank()) {
sender.sendMessage("Please only provide true or false."); sender.sendMessage("Please only provide true or false in the command arguments.");
return false; return false;
} else { } else {
if (args[0].equals("true") || args[0].equals("false")) { if (args[0].equals("true") || args[0].equals("false")) {
try { try {
FileWriter writer = new FileWriter(Main.isLoggingConfig); FileWriter writer = new FileWriter(Main.isLoggingConfig);
writer.write(args[0]); writer.write(args[0]);
writer.close(); writer.close();
System.out.println("Wrote to config, closing writer..."); System.out.println("Wrote to config, closing writer...");
sender.sendMessage(ChatColor.RED + "" + ChatColor.ITALIC + "Changes will only apply once the server has restarted."); sender.sendMessage(ChatColor.RED + "" + ChatColor.ITALIC + "Changes will only apply once the server has restarted.");
sender.sendMessage(ChatColor.RED + "" + ChatColor.ITALIC + "Restart your server if you would like to apply the changes."); String status = "";
if (args[0].equals("true"))
status = "enabled";
else if (args[0].equals("false"))
status = "disabled";
Bukkit.broadcastMessage(ChatColor.ITALIC + "%s %s server logging.".formatted(sender.getName(), status));
Bukkit.broadcastMessage(ChatColor.ITALIC + "Changes will only apply once the server has restarted.");
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
@@ -24,6 +24,8 @@ public class PlayerJoin implements Listener {
.setColor(Color.BLUE); .setColor(Color.BLUE);
notify.addEmbed(embedObject); notify.addEmbed(embedObject);
try { try {
if (!player.hasPlayedBefore())
player.sendMessage("Welcome to the server!");
notify.execute(); notify.execute();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);