Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/bleeding' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeeey committed Jan 24, 2021
2 parents 367891b + 68af607 commit 33c3f9b
Show file tree
Hide file tree
Showing 152 changed files with 2,576 additions and 960 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ jobs:
uses: actions/upload-artifact@v1
if: success()
with:
name: Nukkit
name: Cloudburst
path: target/Cloudburst.jar
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,12 @@ rebel-remote.xml
# Nukkit generated files
banned-ips.json
banned-players.json
nukkit.yml
cloudburst.yml
!src/test/resources/config/cloudburst.yml
ops.txt
server.log
server.properties
!src/test/resources/config/server.properties
white-list.txt
worlds
worlds/*
Expand Down
14 changes: 7 additions & 7 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007

Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.

Expand Down Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
Cloudburst is a server software for Minecraft: Bedrock Edition.
Copyright (C) 2020 CloudburstMC

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

{project} Copyright (C) {year} {fullname}
Copyright (C) 2020 CloudburstMC
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand All @@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.

The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
Introduction
-------------

Cloudburst is nuclear-powered server software for Minecraft: Bedrock Edition.
Cloudburst is a server software for Minecraft: Bedrock Edition.
It has a few key advantages over other server software:

* Written in Java, Cloudburst is faster and more stable.
* Having a friendly structure, it's easy to contribute to Cloudburst's development and rewrite plugins from other platforms into Cloudburst plugins.

Cloudburst is **under improvement** yet, we welcome contributions.
Cloudburst is **under improvement**, yet we welcome contributions.

Links
--------------------
Expand All @@ -41,7 +41,7 @@ Simply run `java -jar Cloudburst.jar`.

Plugin API
-------------
Information on Cloudburst's API can be found at the [wiki](https://cloudburstmc.org/wiki/nukkit/).
Information on Cloudburst's API can be found at the [wiki](https://cloudburstmc.org/wiki/cloudburst/).

Docker
-------------
Expand Down
25 changes: 15 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

<repositories>
<repository>
<id>nukkitx-repo-release</id>
<url>https://repo.nukkitx.com/maven-releases/</url>
<id>opencollab-repo-release</id>
<url>https://repo.opencollab.dev/maven-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
Expand All @@ -30,8 +30,8 @@
</snapshots>
</repository>
<repository>
<id>nukkitx-repo-snapshot</id>
<url>https://repo.nukkitx.com/maven-snapshots/</url>
<id>opencollab-repo-snapshot</id>
<url>https://repo.opencollab.dev/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
Expand All @@ -44,13 +44,13 @@
<distributionManagement>
<repository>
<id>releases</id>
<name>nukkitx-releases</name>
<url>https://repo.nukkitx.com/release</url>
<name>opencollab-releases</name>
<url>https://repo.opencollab.dev/maven-releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>nukkitx-snapshots</name>
<url>https://repo.nukkitx.com/snapshot</url>
<name>opencollab-snapshots</name>
<url>https://repo.opencollab.dev/maven-snapshots</url>
</snapshotRepository>
</distributionManagement>

Expand Down Expand Up @@ -260,7 +260,7 @@
<dependency>
<groupId>com.nukkitx</groupId>
<artifactId>block-state-updater</artifactId>
<version>1.16.20.1</version>
<version>1.16.20.2</version>
<exclusions>
<exclusion>
<groupId>com.nukkitx</groupId>
Expand Down Expand Up @@ -325,6 +325,11 @@
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.cloudburstmc</groupId>
<artifactId>upnp</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>

<build>
Expand All @@ -339,7 +344,7 @@
<manifestEntries>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<Main-Class>org.cloudburstmc.server.Nukkit</Main-Class>
<Main-Class>org.cloudburstmc.server.Bootstrap</Main-Class>
</manifestEntries>
</archive>
</configuration>
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/co/aikar/timings/Timings.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ public final class Timings {
public static final Timing permissionDefaultTimer;

static {
setTimingsEnabled(Server.getInstance().getConfig("timings.enabled", false));
setVerboseEnabled(Server.getInstance().getConfig("timings.verbose", false));
setHistoryInterval(Server.getInstance().getConfig("timings.history-interval", 6000));
setHistoryLength(Server.getInstance().getConfig("timings.history-length", 72000));
setTimingsEnabled(Server.getInstance().getConfig().getTimings().isEnabled());
setVerboseEnabled(Server.getInstance().getConfig().getTimings().isVerbose());
setHistoryInterval(Server.getInstance().getConfig().getTimings().getHistoryInterval());
setHistoryLength(Server.getInstance().getConfig().getTimings().getHistoryLength());

privacy = Server.getInstance().getConfig("timings.privacy", false);
ignoredConfigSections.addAll(Server.getInstance().getConfig().getStringList("timings.ignore"));
privacy = Server.getInstance().getConfig().getTimings().isPrivacy();
ignoredConfigSections.addAll(Server.getInstance().getConfig().getTimings().getIgnore());

log.debug("Timings: \n" +
"Enabled - " + isTimingsEnabled() + "\n" +
Expand Down Expand Up @@ -182,7 +182,7 @@ public static void setHistoryLength(int length) {
//For special cases of servers with special permission to bypass the max.
//This max helps keep data file sizes reasonable for processing on Aikar's Timing parser side.
//Setting this will not help you bypass the max unless Aikar has added an exception on the API side.
if (Server.getInstance().getConfig().getBoolean("timings.bypass-max", false)) {
if (Server.getInstance().getConfig().getTimings().isBypassMax()) {
maxLength = Integer.MAX_VALUE;
}

Expand Down Expand Up @@ -219,7 +219,7 @@ public static Timing getTaskTiming(TaskHandler handler, long period) {
}

if (handler.getTask() instanceof PluginTask) {
String owner = ((PluginTask<?>) handler.getTask()).getContainer().getName();
String owner = ((PluginTask<?>) handler.getTask()).getContainer().getDescription().getName();
return TimingsManager.getTiming(owner, "PluginTask: " + handler.getTaskId() + repeating, schedulerSyncTimer);
} else if (!handler.isAsynchronous()) {
return TimingsManager.getTiming(DEFAULT_GROUP.name, "Task: " + handler.getTaskId() + repeating, schedulerSyncTimer);
Expand All @@ -229,9 +229,9 @@ public static Timing getTaskTiming(TaskHandler handler, long period) {
}

public static Timing getPluginEventTiming(Class<? extends Event> event, Object listener, Method method, PluginContainer plugin) {
Timing group = TimingsManager.getTiming(plugin.getName(), "Combined Total", pluginEventTimer);
Timing group = TimingsManager.getTiming(plugin.getDescription().getName(), "Combined Total", pluginEventTimer);

return TimingsManager.getTiming(plugin.getName(), "Event: " + listener.getClass().getName() + "."
return TimingsManager.getTiming(plugin.getDescription().getName(), "Event: " + listener.getClass().getName() + "."
+ (method.getName())
+ " (" + event.getSimpleName() + ")", group);
}
Expand Down
40 changes: 18 additions & 22 deletions src/main/java/co/aikar/timings/TimingsExport.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@
*/
package co.aikar.timings;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.extern.log4j.Log4j2;
import org.apache.logging.log4j.Level;
import org.cloudburstmc.server.Nukkit;
import org.cloudburstmc.server.Bootstrap;
import org.cloudburstmc.server.Server;
import org.cloudburstmc.server.command.CommandSender;
import org.cloudburstmc.server.command.ConsoleCommandSender;
Expand All @@ -43,8 +42,6 @@
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.zip.GZIPOutputStream;

import static co.aikar.timings.TimingsManager.HISTORY;
Expand All @@ -68,7 +65,7 @@ private TimingsExport(CommandSender sender, ObjectNode out, TimingsHistory[] his
* @param sender Sender that issued the command
*/
public static void reportTimings(CommandSender sender) {
ObjectNode out = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode out = Bootstrap.JSON_MAPPER.createObjectNode();
out.put("version", Server.getInstance().getVersion());
out.put("maxplayers", Server.getInstance().getMaxPlayers());
out.put("start", TimingsManager.timingStart / 1000);
Expand All @@ -78,14 +75,14 @@ public static void reportTimings(CommandSender sender) {
if (!Timings.isPrivacy()) {
out.put("server", Server.getInstance().getName());
out.put("motd", Server.getInstance().getMotd());
out.put("online-mode", Server.getInstance().getPropertyBoolean("xbox-auth", true));
out.put("online-mode", Server.getInstance().getConfig().isXboxAuth());
out.put("icon", ""); //"data:image/png;base64,"
}

final Runtime runtime = Runtime.getRuntime();
RuntimeMXBean runtimeBean = ManagementFactory.getRuntimeMXBean();

ObjectNode system = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode system = Bootstrap.JSON_MAPPER.createObjectNode();
system.put("timingcost", getCost());
system.put("name", System.getProperty("os.name"));
system.put("version", System.getProperty("os.version"));
Expand All @@ -102,7 +99,7 @@ public static void reportTimings(CommandSender sender) {
TimingsHistory[] history = HISTORY.toArray(new TimingsHistory[HISTORY.size() + 1]);
history[HISTORY.size()] = new TimingsHistory(); //Current snapshot

ObjectNode timings = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode timings = Bootstrap.JSON_MAPPER.createObjectNode();
for (TimingIdentifier.TimingGroup group : TimingIdentifier.GROUP_MAP.values()) {
for (Timing id : group.timings) {
if (!id.timed && !id.isSpecial()) {
Expand All @@ -113,7 +110,7 @@ public static void reportTimings(CommandSender sender) {
}
}

ObjectNode idmap = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode idmap = Bootstrap.JSON_MAPPER.createObjectNode();
idmap.set("groups", JsonUtil.mapToObject(TimingIdentifier.GROUP_MAP.values(), (group) ->
new JsonUtil.JSONPair(group.id, group.name)));
idmap.set("handlers", timings);
Expand All @@ -127,22 +124,21 @@ public static void reportTimings(CommandSender sender) {

//Information about loaded plugins
out.set("plugins", JsonUtil.mapToObject(Server.getInstance().getPluginManager().getAllPlugins(), (plugin) -> {
ObjectNode jsonPlugin = Nukkit.JSON_MAPPER.createObjectNode();
jsonPlugin.put("version", plugin.getVersion());
ObjectNode jsonPlugin = Bootstrap.JSON_MAPPER.createObjectNode();
jsonPlugin.put("version", plugin.getDescription().getVersion());

plugin.getDescription().ifPresent((desc) -> jsonPlugin.put("description", desc));
plugin.getUrl().ifPresent((url) -> jsonPlugin.put("website", url));
jsonPlugin.putPOJO("authors", String.join(", ", plugin.getAuthors()));
return new JsonUtil.JSONPair(plugin.getName(), jsonPlugin);
plugin.getDescription().getDescription().ifPresent((desc) -> jsonPlugin.put("description", desc));
plugin.getDescription().getUrl().ifPresent((url) -> jsonPlugin.put("website", url));
jsonPlugin.putPOJO("authors", String.join(", ", plugin.getDescription().getAuthors()));
return new JsonUtil.JSONPair(plugin.getDescription().getName(), jsonPlugin);
}));

//Information on the users Config
ObjectNode config = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode config = Bootstrap.JSON_MAPPER.createObjectNode();
if (!Timings.getIgnoredConfigSections().contains("all")) {
Map<String, Object> section = new LinkedHashMap<>(Server.getInstance().getConfig().getRootSection());
Timings.getIgnoredConfigSections().forEach(section::remove);
JsonNode cloudburst = JsonUtil.toObject(section);
config.set("cloudburst", cloudburst);
final ObjectNode rootNode = Server.getInstance().getConfig().getCloudburstYaml().getRootNode();
Timings.getIgnoredConfigSections().forEach(rootNode::remove);
config.set("cloudburst", rootNode);
} else {
config.set("cloudburst", null);
}
Expand Down Expand Up @@ -202,7 +198,7 @@ public void run() {
con.setInstanceFollowRedirects(false);

try (GZIPOutputStream outputStream = new GZIPOutputStream(con.getOutputStream())) {
outputStream.write(Nukkit.JSON_MAPPER.writeValueAsBytes(this.out));
outputStream.write(Bootstrap.JSON_MAPPER.writeValueAsBytes(this.out));
}

response = getResponse(con);
Expand Down Expand Up @@ -231,7 +227,7 @@ public void run() {

FileWriter writer = new FileWriter(fileName);
writer.write(Server.getInstance().getLanguage().translate("cloudburst.command.timings.timingsLocation", location) + "\n\n");
writer.write(Nukkit.JSON_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(this.out));
writer.write(Bootstrap.JSON_MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(this.out));
writer.close();

log.info(Server.getInstance().getLanguage().translate("cloudburst.command.timings.timingsWrite", fileName));
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/co/aikar/timings/TimingsHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.val;
import org.cloudburstmc.server.Nukkit;
import org.cloudburstmc.server.Bootstrap;
import org.cloudburstmc.server.Server;
import org.cloudburstmc.server.blockentity.BlockEntity;
import org.cloudburstmc.server.entity.Entity;
Expand Down Expand Up @@ -66,7 +66,7 @@ public class TimingsHistory {
private final MinuteReport[] minuteReports;

private final TimingsHistoryEntry[] entries;
private final ObjectNode levels = Nukkit.JSON_MAPPER.createObjectNode();
private final ObjectNode levels = Bootstrap.JSON_MAPPER.createObjectNode();

TimingsHistory() {
this.endTime = System.currentTimeMillis() / 1000;
Expand Down Expand Up @@ -97,7 +97,7 @@ public class TimingsHistory {
final Map<Identifier, AtomicInteger> blockEntityCounts = new HashMap<>();
// Information about all loaded entities/block entities
for (Level level : Server.getInstance().getLevels()) {
ArrayNode jsonLevel = Nukkit.JSON_MAPPER.createArrayNode();
ArrayNode jsonLevel = Bootstrap.JSON_MAPPER.createArrayNode();
for (Chunk chunk : level.getChunks()) {
entityCounts.clear();
blockEntityCounts.clear();
Expand All @@ -124,7 +124,7 @@ public class TimingsHistory {
continue;
}

ArrayNode jsonChunk = Nukkit.JSON_MAPPER.createArrayNode();
ArrayNode jsonChunk = Bootstrap.JSON_MAPPER.createArrayNode();
jsonChunk.add(chunk.getX());
jsonChunk.add(chunk.getZ());
jsonChunk.add(JsonUtil.mapToObject(entityCounts.entrySet(), (entry) ->
Expand All @@ -151,7 +151,7 @@ static void resetTicks(boolean fullReset) {
}

ObjectNode export() {
ObjectNode json = Nukkit.JSON_MAPPER.createObjectNode();
ObjectNode json = Bootstrap.JSON_MAPPER.createObjectNode();
json.put("s", this.startTime);
json.put("e", this.endTime);
json.put("tk", this.totalTicks);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/cloudburstmc/server/Achievement.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static boolean broadcast(Player player, String achievementId) {
}
String translation = Server.getInstance().getLanguage().translate("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + achievements.get(achievementId).getMessage() + TextFormat.RESET);

if (Server.getInstance().getPropertyBoolean("announce-player-achievements", true)) {
if (Server.getInstance().getConfig().isAnnouncePlayerAchievements()) {
Server.getInstance().broadcastMessage(translation);
} else {
player.sendMessage(translation);
Expand Down Expand Up @@ -64,7 +64,7 @@ public String getMessage() {
public void broadcast(Player player) {
String translation = Server.getInstance().getLanguage().translate("chat.type.achievement", player.getDisplayName(), TextFormat.GREEN + this.getMessage(), null);

if (Server.getInstance().getPropertyBoolean("announce-player-achievements", true)) {
if (Server.getInstance().getConfig().isAnnouncePlayerAchievements()) {
Server.getInstance().broadcastMessage(translation);
} else {
player.sendMessage(translation);
Expand Down
Loading

0 comments on commit 33c3f9b

Please sign in to comment.