Skip to content

Commit

Permalink
Merge branch 'release/0.2.3-develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmc971 committed Mar 18, 2021
2 parents 11e096d + 5d978a2 commit c06d790
Show file tree
Hide file tree
Showing 63 changed files with 559 additions and 146 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

8 changes: 5 additions & 3 deletions .github/workflows/maven.yml → .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,13 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: make gradle wrapper executable
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: develop-build-release
uses: fnkr/github-action-ghr@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GHR_PATH: target/ModularMSMF.jar
GHR_PATH: jars/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 26 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,29 @@ testserver/*
!testserver/start.bat
!testserver/start.sh
!testserver/README.md
/bin/
/target/
/.project
/.settings/
.classpath
**/bin/
**/target/
**/.project
**/.settings/
**/.classpath

# GRADLE gitignore
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties
# Ignore Gradle build output directory
build
# compilation output
jars/
13 changes: 13 additions & 0 deletions ModularMSMF-Core/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
plugins {
id "com.github.johnrengelman.shadow"
}

dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.12.2'
}

shadowJar {
dependencies {
include(dependency('com.fasterxml.jackson.core:.*'))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//import java.util.logging.Logger;
import java.util.regex.Pattern;

import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.FileConfiguration;
Expand All @@ -27,6 +28,7 @@
import io.github.davidmc971.modularmsmf.util.ChatUtils.ChatFormat;
import io.github.davidmc971.modularmsmf.util.KillType;
import io.github.davidmc971.modularmsmf.util.Utils;
import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.ChatColor;

/**
Expand All @@ -43,18 +45,19 @@ public class Events implements Listener {
public static ArrayList<String> blacklistedExpressions = new ArrayList<String>();

public Events(ModularMSMF plugin) {
this.plugin = plugin;
// currently an ArrayList containing words to be filtered
// to be loaded from a configuration file later on
blacklistedExpressions.add("hacker");
this.plugin = plugin;
// currently an ArrayList containing words to be filtered
// to be loaded from a configuration file later on
blacklistedExpressions.add("hacker");
}

@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) throws IOException {
Player player = event.getPlayer();
event.setJoinMessage(null);
event.joinMessage(Component.empty());
Utils.broadcastWithConfiguredLanguageEach(plugin, ChatFormat.WELCOME, "event.welcome", "_var",
player.getDisplayName());

}

@EventHandler
Expand Down Expand Up @@ -122,7 +125,8 @@ public void onDeath(PlayerDeathEvent event) {
}
}
if (!temp) {
Utils.broadcastWithConfiguredLanguageEach(plugin, ChatFormat.DEATH, "event.just_died", "_var", event.getEntity().getDisplayName());
Utils.broadcastWithConfiguredLanguageEach(plugin, ChatFormat.DEATH, "event.just_died", "_var",
event.getEntity().getDisplayName());
}
}

Expand Down Expand Up @@ -155,81 +159,87 @@ public KillType getKt() {
@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncPlayerChatEvent event) {
Player p = event.getPlayer();
String msg = event.getMessage();
// p.sendMessage(msg);
msg = filterMessage(msg, blacklistedExpressions, p);
String msg = event.getMessage();

// p.sendMessage(msg);

msg = filterMessage(msg, blacklistedExpressions, p);

// p.sendMessage(msg);
// p.sendMessage(msg);

// for(int i = 0; i < blacklistedExpressions.size(); i++){
// if(!blacklistedExpressions.contains(msg.toLowerCase())) {
// //plugin.getLogger().info("Async Chat Event");
// FileConfiguration playercfg = plugin.getDataManager().getPlayerCfg(event.getPlayer().getUniqueId());
// if (playercfg.isBoolean("muted") && playercfg.getBoolean("muted") && !event.getMessage().startsWith("/")) {
// event.setCancelled(true);
// Utils.sendMessageWithConfiguredLanguage(plugin, event.getPlayer(), ChatFormat.NOPERM, "event.muted");
// }

// FileConfiguration settings = plugin.getDataManager().settingsyaml; //TODO: change to getter
// ChatColor cl_prefix = toColor(settings, "chat.colors.prefix");
// ChatColor cl_name = toColor(settings, "chat.colors.displayname");
// ChatColor cl_msg = toColor(settings, "chat.colors.message");

// //l.info("cl_prefix: " + cl_prefix);
// //l.info("cl_name: " + cl_name);
// //l.info("cl_msg: " + cl_msg);

// String format = settings.getString("chat.format");
// //l.info("format #1: " + format);
// format = format.replaceAll("_name", "%1\\$s")
// .replaceAll("_message", "%2\\$s")
// .replaceAll("_clpre", cl_prefix.toString())
// .replaceAll("_clname", cl_name.toString())
// .replaceAll("_clmessage", cl_msg.toString());
// //l.info("format #2: " + format);

// event.setFormat(format);
// } else {
// p.sendMessage("Blacklisted text dectected. Not allowed to send: " + msg.toLowerCase());
// msg.replaceAll(blacklistedExpressions.get(i), "#");
// event.setCancelled(true);
// System.out.println("Sending text "+msg);
// break;
// }
// if(!blacklistedExpressions.contains(msg.toLowerCase())) {
// //plugin.getLogger().info("Async Chat Event");
// FileConfiguration playercfg =
// plugin.getDataManager().getPlayerCfg(event.getPlayer().getUniqueId());
// if (playercfg.isBoolean("muted") && playercfg.getBoolean("muted") &&
// !event.getMessage().startsWith("/")) {
// event.setCancelled(true);
// Utils.sendMessageWithConfiguredLanguage(plugin, event.getPlayer(),
// ChatFormat.NOPERM, "event.muted");
// }

// FileConfiguration settings = plugin.getDataManager().settingsyaml; //TODO:
// change to getter
// ChatColor cl_prefix = toColor(settings, "chat.colors.prefix");
// ChatColor cl_name = toColor(settings, "chat.colors.displayname");
// ChatColor cl_msg = toColor(settings, "chat.colors.message");

// //l.info("cl_prefix: " + cl_prefix);
// //l.info("cl_name: " + cl_name);
// //l.info("cl_msg: " + cl_msg);

// String format = settings.getString("chat.format");
// //l.info("format #1: " + format);
// format = format.replaceAll("_name", "%1\\$s")
// .replaceAll("_message", "%2\\$s")
// .replaceAll("_clpre", cl_prefix.toString())
// .replaceAll("_clname", cl_name.toString())
// .replaceAll("_clmessage", cl_msg.toString());
// //l.info("format #2: " + format);

// event.setFormat(format);
// } else {
// p.sendMessage("Blacklisted text dectected. Not allowed to send: " +
// msg.toLowerCase());
// msg.replaceAll(blacklistedExpressions.get(i), "#");
// event.setCancelled(true);
// System.out.println("Sending text "+msg);
// break;
// }
// }
event.setMessage(msg);
}
private String filterMessage(String msg, List<String> blacklist, CommandSender cmdsnd) {
for (String expr : blacklist) {
expr = expr.toLowerCase();
// cmdsnd.sendMessage("Checking for expression: " + expr);
if (msg.toLowerCase().contains(expr)) {
// cmdsnd.sendMessage("Found match for expression: " + expr);
String replacement = "";
for (int i = 0; i < expr.length(); i++) {
replacement += "*";
}
// cmdsnd.sendMessage("Replacement text: " + replacement);
msg = msg.replaceAll("(?i)"+Pattern.quote(expr), replacement);
}
}
return msg;
}
}

private String filterMessage(String msg, List<String> blacklist, CommandSender cmdsnd) {
for (String expr : blacklist) {
expr = expr.toLowerCase();
// cmdsnd.sendMessage("Checking for expression: " + expr);
if (msg.toLowerCase().contains(expr)) {
// cmdsnd.sendMessage("Found match for expression: " + expr);
String replacement = "";
for (int i = 0; i < expr.length(); i++) {
replacement += "*";
}
// cmdsnd.sendMessage("Replacement text: " + replacement);
msg = msg.replaceAll("(?i)" + Pattern.quote(expr), replacement);
}
}
return msg;
}

public ChatColor toColor(FileConfiguration settings, String colorKey) {
return ChatColor.getByChar(settings.getString(colorKey).charAt(0));
}

@EventHandler
public void onCommandEvent(PlayerCommandPreprocessEvent e){
public void onCommandEvent(PlayerCommandPreprocessEvent e) {
Player p = e.getPlayer();
if(p.isOp()){
if (p.isOp()) {
String commandName = e.getMessage().substring(1).split(" ")[0].toLowerCase();
if (commandName.equals("pl") || commandName.equals("plugins")) {
Utils.sendMessageWithConfiguredLanguage(plugin, p, ChatFormat.ERROR, "general.commands_blocked", "_var", commandName);
Utils.sendMessageWithConfiguredLanguage(plugin, p, ChatFormat.ERROR, "general.commands_blocked", "_var",
commandName);
e.setCancelled(true);
}
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
#name: ModularMSMF
#main: main.ModularMSMF
#version: Alpha 0.1.0
#author: ${author}

name: ${name}
name: ModularMSMF-Core
version: ${version}
description: ${description}
description: The Core of the Modular Minecraft Server Management Framework
website: ${url}
authors: [Lightkeks, davidmc971]

main: ${mainClass}
api: none

main: io.github.davidmc971.modularmsmf.ModularMSMF

commands:
report:
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions ModularMSMF-Core/src/main/resources/props.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build_timestamp: "${timestamp}"
6 changes: 6 additions & 0 deletions Notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
```
Bukkit.getConsoleSender().sendMessage(Component.text(plugin.getLanguageManager().getStandardLanguage()
.getString("event.welcome").replaceAll("_var", player.getDisplayName())));
```

Mit Component arbeiten REEEEEEEE
65 changes: 4 additions & 61 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,63 +1,6 @@
[![Java CI with Maven](https://github.com/davidmc971/ModularMSMF/actions/workflows/maven.yml/badge.svg?branch=develop)](https://github.com/davidmc971/ModularMSMF/actions/workflows/maven.yml)
[![Gradle Build](https://github.com/davidmc971/ModularMSMF/actions/workflows/gradle.yml/badge.svg?branch=develop)](https://github.com/davidmc971/ModularMSMF/actions/workflows/gradle.yml)

OUTDATED GUIDE! Since we switched to maven, this guide will be updated.
## This is the official repository of ModularMSMF
ModularMSMF - the Modular Minecraft Server Management Framework - is intended to be a full suite for managing a server and giving users a nice player experience.

You need to have the following installed (when using Windows):

Java Development Kit (JDK) (at least Java 8)
Get it here: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Notepad++ (optional, but definitely recommended, install before git)
Get it here: https://notepad-plus-plus.org/download/

Git for Windows (choose Notepad++ as editor if installed)
Get it here: https://git-scm.com/download/win

Eclipse IDE for Java Developers
Get the installer here: https://www.eclipse.org/downloads/

After installing all these, choose your eclipse workspace, for the plugin the
location is not important, but you will have your testserver there if you don't
reconfigure your personal AutoExport.xml, more on that later.

Install those in Eclipse once you've got it up and running:

EGit - Git Integration for Eclipse (pretty much needed, should be pre-installed though)
http://marketplace.eclipse.org/content/egit-git-team-provider

Darkest Dark Theme with DevStyle (personal recommendation)
http://marketplace.eclipse.org/content/darkest-dark-theme-devstyle

Now choose a folder for the source code from GitHub, it is neither needed to be
in your workspace nor to be on the same drive. Just remember the location ;)

In that folder open git bash (through the context menu) and execute:
git clone https://github.com/davidmc971/ModularMSMF.git
It should download the source code of ModularMSMF.

Next we will build Spigot using the Spigot BuildTools, follow the guide here:
https://www.spigotmc.org/wiki/buildtools/

After that, generate the javadoc for Spigot-API, follow this guide:
https://www.spigotmc.org/wiki/creating-offline-javadoc-for-the-spigot-api/

Now to the Eclipse setup part.
If you have at least some experience using Eclipse, it will be easier for you. :)
In Eclipse, we skip the welcome screen and create a new Java Project.
You can do so through the context menu of your package explorer for example.
Conveniently name your new project ModularMSMF and click "Finish".

Completely remove the existing src folder, right-click your project and
go into "Build Path > Configure Build Path...". Under the tab "Source" click
on "Link Source" and browse for the src folder in your cloned git repository.
Make sure you didn't select any of the subfolders in src so it looks similar
to this: "some-path\ModularMSMF\src" and click "Finish".
Next, under the "Libraries" tab click on classpath and then on
"Add External JARs...". Navigate to your Spigot BuildTools folder and select
the file




Navigate to your cloned git reporsitory and select the "src" folder.
Click next. Now we include the Spigot-API to the classpath of our project:
Currently we are developing the Core and it's API and there are a few Modules planned and in the development stage.
Loading

0 comments on commit c06d790

Please sign in to comment.