From cc8f213848652a912bbac6307fd70294d61e7a3b Mon Sep 17 00:00:00 2001 From: BrandyScotchland Date: Sat, 1 Jan 2022 03:23:39 +0100 Subject: [PATCH] Source-Code --- .classpath | 15 +++++++++++++ .gitignore | 1 + .project | 17 +++++++++++++++ .settings/org.eclipse.core.resources.prefs | 2 ++ .settings/org.eclipse.jdt.core.prefs | 15 +++++++++++++ LICENSE | 9 -------- README.md | 3 --- config.yml | 21 ++++++++++++++++++ plugin.yml | 5 +++++ src/me/motd/Motd.java | 34 ++++++++++++++++++++++++++++++ src/me/motd/utils/ServerPing.java | 21 ++++++++++++++++++ 11 files changed, 131 insertions(+), 12 deletions(-) create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 .settings/org.eclipse.core.resources.prefs create mode 100644 .settings/org.eclipse.jdt.core.prefs delete mode 100644 LICENSE create mode 100644 config.yml create mode 100644 plugin.yml create mode 100644 src/me/motd/Motd.java create mode 100644 src/me/motd/utils/ServerPing.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..41e80cc --- /dev/null +++ b/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ae3c172 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/.project b/.project new file mode 100644 index 0000000..6e7787e --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Spigot-Motd + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..25d0718 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/config.yml=UTF-8 diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cd95bae --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,15 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=16 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=16 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=16 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e882938..0000000 --- a/LICENSE +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) 2022 - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md index 0a1758c..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,3 +0,0 @@ -# Minecraft-Motd - -Ein einfaches Plugin um in Minecraft ein Motd anzuzeigen. \ No newline at end of file diff --git a/config.yml b/config.yml new file mode 100644 index 0000000..a908c02 --- /dev/null +++ b/config.yml @@ -0,0 +1,21 @@ +############################################################### +# # +# ███╗░░░███╗░█████╗░███╗░░░███╗░█████╗░████████╗██████╗░ # +# ████╗░████║██╔══██╗████╗░████║██╔══██╗╚══██╔══╝██╔══██╗ # +# ██╔████╔██║██║░░╚═╝██╔████╔██║██║░░██║░░░██║░░░██║░░██║ # +# ██║╚██╔╝██║██║░░██╗██║╚██╔╝██║██║░░██║░░░██║░░░██║░░██║ # +# ██║░╚═╝░██║╚█████╔╝██║░╚═╝░██║╚█████╔╝░░░██║░░░██████╔╝ # +# ╚═╝░░░░░╚═╝░╚════╝░╚═╝░░░░░╚═╝░╚════╝░░░░╚═╝░░░╚═════╝░ # +# By: 006mi4 Version: 1.17 # +############################################################### + +#English: Create a cool MOTD for your server. +#Deutsch: Erstelle einen coolen MOTD für deinen Server. + + +#English: You can use two lines with the MOTD Plugin. LineOne is the top line and LineTwo is the bottom line. +#Deutsch: Du kannst bei dem MOTD Plugin zwei Zeilen nutzen. LineOne ist die obere Zeile und LineTwo die untere. + +LineOne: '&eServername.de &f- &bName Network &f- &f[&d1.17&f]' + +LineTwo: '&a&lMCMOTD PLUGIN &r&f- &eInfo&f: &bhttps://spigotmc.org' \ No newline at end of file diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..b1d14d5 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,5 @@ +name: McMotd +version: 1.0.0 +api-version: 1.16 + +main: me.motd.Motd diff --git a/src/me/motd/Motd.java b/src/me/motd/Motd.java new file mode 100644 index 0000000..381cda2 --- /dev/null +++ b/src/me/motd/Motd.java @@ -0,0 +1,34 @@ +package me.motd; + +import org.bukkit.Bukkit; +import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.java.JavaPlugin; + +import me.motd.utils.ServerPing; + +public class Motd extends JavaPlugin { + + public static Plugin pl; + + @Override + public void onEnable() { + pl = this; + + reloadConfig(); + saveDefaultConfig(); + + PluginManager pm = Bukkit.getPluginManager(); + pm.registerEvents(new ServerPing(), this); + + super.onEnable(); + } + + @Override + public void onDisable() { + + super.onDisable(); + } + + +} diff --git a/src/me/motd/utils/ServerPing.java b/src/me/motd/utils/ServerPing.java new file mode 100644 index 0000000..eee4c19 --- /dev/null +++ b/src/me/motd/utils/ServerPing.java @@ -0,0 +1,21 @@ +package me.motd.utils; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.server.ServerListPingEvent; + +import me.motd.Motd; + +public class ServerPing implements Listener { + + @EventHandler + public void onServerPing(ServerListPingEvent e) { + + String lineOne = Motd.pl.getConfig().getString("LineOne"); + String lineTwo = Motd.pl.getConfig().getString("LineTwo"); + + e.setMotd(lineOne.replace("&", "")+"\n"+lineTwo.replace("&", "")); + + } + +}