Skip to content

Commit 6456004

Browse files
added forced message of the day
1 parent db9b24d commit 6456004

File tree

11 files changed

+288
-68
lines changed

11 files changed

+288
-68
lines changed

.github/dependabot.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
updates:
3+
4+
- package-ecosystem: "maven"
5+
directory: "/"
6+
schedule:
7+
interval: "daily"
8+
time: "12:00"
9+
timezone: "Europe/Berlin"
10+
assignees:
11+
- "bierdosenhalter"
12+
reviewers:
13+
- "bierdosenhalter"
14+
commit-message:
15+
prefix: "maven"
16+
include: "scope"
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "daily"
22+
time: "12:00"
23+
timezone: "Europe/Berlin"
24+
assignees:
25+
- "bierdosenhalter"
26+
reviewers:
27+
- "bierdosenhalter"
28+
commit-message:
29+
prefix: "github-actions"
30+
include: "scope"

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: onTagTagTag
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
13+
- name: Git
14+
uses: actions/checkout@v3
15+
16+
- name: Java
17+
uses: actions/[email protected]
18+
with:
19+
distribution: 'adopt'
20+
java-version: '8'
21+
22+
- name: Cache
23+
uses: actions/[email protected]
24+
with:
25+
path: ~/.m2
26+
key: '${{ runner.os }}-m2-${{ hashFiles(''**/pom.xml'') }}'
27+
restore-keys: '${{ runner.os }}-m2'
28+
29+
- name: Package
30+
run: mvn --batch-mode --show-version --errors package --file pom.xml
31+
32+
- name: Draft
33+
id: create_release
34+
uses: actions/create-release@v1
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
with:
38+
tag_name: ${{ github.ref }}
39+
release_name: ${{ github.ref }}
40+
body: 'automated release at commit ${{ github.sha }}'
41+
draft: false
42+
prerelease: false
43+
44+
- name: Release
45+
uses: csexton/release-asset-action@v2
46+
with:
47+
pattern: "target/ServerPingPlayerList-*.jar"
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
release-url: ${{ steps.create_release.outputs.upload_url }}

README.md

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,48 @@
1-
## player-list
1+
## ServerPingPlayerList
22

33
[![discord](https://img.shields.io/discord/895546064260718622?logo=discord)](https://discord.0b0t.org)
44
[![reddit](https://img.shields.io/reddit/subreddit-subscribers/0b0t)](https://old.reddit.com/r/0b0t/)
5-
![last commit](https://img.shields.io/github/last-commit/zeroBzeroT/player-list)
6-
![repo size](https://img.shields.io/github/languages/code-size/zeroBzeroT/player-list.svg?label=repo%20size)
5+
![last commit](https://img.shields.io/github/last-commit/zeroBzeroT/ServerPingPlayerList)
6+
![repo size](https://img.shields.io/github/languages/code-size/zeroBzeroT/ServerPingPlayerList.svg?label=repo%20size)
7+
[![downloads](https://img.shields.io/github/downloads/zeroBzeroT/ServerPingPlayerList/total)](https://github.com/zeroBzeroT/ServerPingPlayerList/releases)
78

89
---
910

10-
player-list is a plugin for [BungeeCord](https://github.com/SpigotMC/BungeeCord). Even if I'm not convinced by [BungeeCord](https://github.com/SpigotMC/BungeeCord) I started this project back then. The plugin makes sure that the player list is displayed as so-called samples again. This feature is included in Vanilla Minecraft and Bukkit, Spigot & Paper by default, but the [BungeeCord Proxy](https://github.com/SpigotMC/BungeeCord) does not support this feature. Therefore, I have developed this plugin.
11+
ServerPingPlayerList is a plugin for [BungeeCord](https://github.com/SpigotMC/BungeeCord). The plugin makes sure that
12+
the player list is displayed as so-called samples again. This feature is included in Vanilla Minecraft and Bukkit,
13+
Spigot & Paper by default, but the [BungeeCord Proxy](https://github.com/SpigotMC/BungeeCord) does not support this
14+
feature. Therefore, I have developed this plugin.
1115

12-
### Libraries used
13-
* BungeeCord API (only compiled)
16+
### Details
17+
18+
- All players of a server in the server browser (on hover)
19+
- Server name, version and minimum supported protocol
20+
- Message of the day override
21+
22+
### Commands
23+
24+
- **/spplreload {count}** reloads the config from the file
25+
26+
### Config
27+
28+
| Setting | Description |
29+
|-------------------------|---------------------------------------------|
30+
| versionName | Name and Version of the Server |
31+
| versionMinProtocol | Minimum supported protocol version |
32+
| setHoverInfo | Show player list on hover in server browser |
33+
| messageOfTheDayOverride | Overrides all MOTDs of the servers |
34+
| messageOfTheDay | Message of the day |
35+
36+
### Libraries
37+
38+
- BungeeCord API
39+
40+
### Warranty
41+
42+
The Software is provided "as is" and without warranties of any kind, express
43+
or implied, including but not limited to the warranties of merchantability,
44+
fitness for a particular purpose, and non-infringement. In no event shall the
45+
Authors or copyright owners be liable for any claims, damages or other
46+
liability, whether in an action in contract, tort or otherwise, arising from,
47+
out of or in connection with the Software or the use or other dealings in the
48+
Software.

pom.xml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66

7-
<groupId>de.deeprobin</groupId>
8-
<artifactId>PlayerList</artifactId>
9-
<version>1.2.1-SNAPSHOT</version>
7+
<groupId>org.zeroBzeroT</groupId>
8+
<artifactId>ServerPingPlayerList</artifactId>
9+
<version>1.2.2</version>
1010
<packaging>jar</packaging>
1111
<name>${project.artifactId}</name>
1212

@@ -20,6 +20,19 @@
2020
<build>
2121
<defaultGoal>clean package</defaultGoal>
2222
<plugins>
23+
<plugin>
24+
<groupId>org.apache.maven.plugins</groupId>
25+
<artifactId>maven-jar-plugin</artifactId>
26+
<version>3.2.0</version>
27+
<configuration>
28+
<archive>
29+
<addMavenDescriptor>false</addMavenDescriptor>
30+
<manifestEntries>
31+
<Built-By>bierdosenhalter</Built-By>
32+
</manifestEntries>
33+
</archive>
34+
</configuration>
35+
</plugin>
2336
<plugin>
2437
<groupId>org.apache.maven.plugins</groupId>
2538
<artifactId>maven-compiler-plugin</artifactId>
@@ -33,6 +46,27 @@
3346
<groupId>org.apache.maven.plugins</groupId>
3447
<artifactId>maven-shade-plugin</artifactId>
3548
<version>3.2.4</version>
49+
<configuration>
50+
<relocations>
51+
<relocation>
52+
<pattern>org.bstats</pattern>
53+
<shadedPattern>org.zeroBzeroT.bstats</shadedPattern>
54+
</relocation>
55+
</relocations>
56+
<filters>
57+
<filter>
58+
<artifact>org.bstats:*</artifact>
59+
<excludes>
60+
<exclude>META-INF/*.MF</exclude>
61+
</excludes>
62+
</filter>
63+
<filter>
64+
<excludes>
65+
<exclude>META-INF/**</exclude>
66+
</excludes>
67+
</filter>
68+
</filters>
69+
</configuration>
3670
<executions>
3771
<execution>
3872
<phase>package</phase>
@@ -59,6 +93,10 @@
5993
<id>sonatype snapshots</id>
6094
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
6195
</repository>
96+
<repository>
97+
<id>spigot-repo</id>
98+
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
99+
</repository>
62100
</repositories>
63101

64102
<dependencies>
@@ -68,6 +106,12 @@
68106
<version>1.16-R0.4</version>
69107
<scope>provided</scope>
70108
</dependency>
109+
<dependency>
110+
<groupId>org.bstats</groupId>
111+
<artifactId>bstats-bungeecord</artifactId>
112+
<version>3.0.0</version>
113+
<scope>compile</scope>
114+
</dependency>
71115
</dependencies>
72116

73117
</project>

src/main/java/de/deeprobin/playerlist/Main.java

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/main/java/de/deeprobin/playerlist/Config.java renamed to src/main/java/org/zeroBzeroT/serverPingPlayerList/Config.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package de.deeprobin.playerlist;
1+
package org.zeroBzeroT.serverPingPlayerList;
22

33
import net.md_5.bungee.api.plugin.Plugin;
44
import net.md_5.bungee.config.Configuration;
@@ -16,6 +16,9 @@ public class Config {
1616
public static String versionName = "ZeroPaper 1.12.2+";
1717
public static int versionMinProtocol = 340;
1818
public static boolean setHoverInfo = true;
19+
public static boolean messageOfTheDayOverride = false;
20+
public static String messageOfTheDay = "";
21+
public static boolean bStats = false;
1922

2023
/**
2124
* Loads a config file, and if it doesn't exist creates one
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package org.zeroBzeroT.serverPingPlayerList;
2+
3+
import net.md_5.bungee.api.ChatColor;
4+
import net.md_5.bungee.api.plugin.Plugin;
5+
import org.bstats.bungeecord.Metrics;
6+
import org.zeroBzeroT.serverPingPlayerList.listener.ServerListListener;
7+
8+
import java.io.File;
9+
10+
public final class Main extends Plugin {
11+
@Override
12+
public void onEnable() {
13+
super.onEnable();
14+
15+
String folder = getDataFolder().getPath();
16+
17+
// Create path directories if not existent
18+
//noinspection ResultOfMethodCallIgnored
19+
new File(folder).mkdirs();
20+
21+
// Config
22+
try {
23+
Config.getConfig(this);
24+
} catch (Exception e) {
25+
e.printStackTrace();
26+
onDisable();
27+
return;
28+
}
29+
30+
// Commands
31+
getProxy().getPluginManager().registerCommand(this, new ReloadCommand(this));
32+
33+
// register the listener
34+
this.getProxy().getPluginManager().registerListener(this, new ServerListListener(this));
35+
36+
// Some output to the console ;)
37+
log("config", "§3Version Name: §r" + ChatColor.translateAlternateColorCodes('&', Config.versionName));
38+
log("config", "§3Version Minimum Protocol: §r" + Config.versionMinProtocol);
39+
log("config", "§3Set Hover Info: §r" + Config.setHoverInfo);
40+
if(Config.messageOfTheDayOverride)
41+
log("config", "§3Message Of The Day: §r" + ChatColor.translateAlternateColorCodes('&',Config.messageOfTheDay));
42+
43+
// Load Plugin Metrics
44+
if (Config.bStats) {
45+
new Metrics(this, 16229);
46+
}
47+
}
48+
49+
@Override
50+
public void onDisable() {
51+
super.onDisable();
52+
53+
getProxy().getPluginManager().unregisterListeners(this);
54+
}
55+
56+
public void log(String module, String message) {
57+
getLogger().info("§a[" + module + "] §e" + message + "§r");
58+
}
59+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.zeroBzeroT.serverPingPlayerList;
2+
3+
import net.md_5.bungee.api.CommandSender;
4+
import net.md_5.bungee.api.ProxyServer;
5+
import net.md_5.bungee.api.chat.TextComponent;
6+
import net.md_5.bungee.api.plugin.Command;
7+
import net.md_5.bungee.api.plugin.Plugin;
8+
9+
/**
10+
* ReloadCommand
11+
*/
12+
public class ReloadCommand extends Command {
13+
private final Plugin plugin;
14+
15+
public ReloadCommand(Plugin plugin) {
16+
super("spplreload");
17+
this.plugin = plugin;
18+
}
19+
20+
@Override
21+
public void execute(CommandSender sender, String[] args) {
22+
if (sender != ProxyServer.getInstance().getConsole()) {
23+
sender.sendMessage(new TextComponent("§cUnknown command. Type \"/help\" for help."));
24+
return;
25+
}
26+
27+
// Config reload
28+
try {
29+
sender.sendMessage(new TextComponent("§3Reloading config..."));
30+
31+
Config.getConfig(plugin);
32+
} catch (Exception e) {
33+
e.printStackTrace();
34+
}
35+
}
36+
}

0 commit comments

Comments
 (0)