Skip to content

Commit

Permalink
2018.0.1 LTS merge (#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
Momothereal authored and mastercoms committed Feb 5, 2018
1 parent ee612eb commit 5ffb436
Show file tree
Hide file tree
Showing 489 changed files with 8,538 additions and 6,104 deletions.
10 changes: 8 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ jobs:
- ~/.m2
key: glowstone-{{ checksum "pom.xml" }}

- run: mvn -T 2 -B -s .circleci/maven.xml source:jar javadoc:jar deploy
# Ensure we are on the right repo before attempting a deploy
- run: |
if [ "${CIRCLE_PROJECT_USERNAME}" == "GlowstoneMC" ]; then
mvn -T 2 -B -s .circleci/maven.xml source:jar javadoc:jar deploy
else
mvn -T 2 -B package
fi
- store_test_results:
path: target/surefire-reports
Expand Down Expand Up @@ -92,4 +98,4 @@ workflows:
- build:
filters:
branches:
ignore: dev
ignore: dev
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependency-reduced-pom.xml
.settings
.db
.DS_Store
.vscode
23 changes: 23 additions & 0 deletions docs/CHEATING_AND_ILLEGAL_BEHAVIOR_POLICY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Cheating and Illegal Behavior Policy

## Purpose

The purpose of this Policy is to define guidelines as to the usage of software or services deemed unreasonable in the context of the Glowstone Project.
This Policy affirms the Project's position against cheating and unauthorized use of products and services.


## Extent

This Policy extends to the following actions, deemed unreasonable in the context of the Project:
* The usage of illegally distributed, obtained and/or pirated copies of the *Minecraft* client (commonly known as "*cracked clients*");
* The usage of pirated or stolen *Minecraft* or *Mojang AB* accounts;
* The usage of illegally distributed and/or obtained software, plugins and libraries with the Glowstone server;
* The usage of *Minecraft* clients modified with the foremost purpose of using game exploits and cheating.


## Enforcement

The enforcement of this Policy is under the discretion of the Project's administration, which may include but is not limited to:
* The refusal to provide support to an end-user utilizing software or services deemed unreasonable to the extent of this Policy;
* Support may still be provided if the user accepts to stop utilizing unreasonable software or services in the context of the support request.
* The refusal to provide support to an end-user seeking help to use software or services unreasonably to the extent of this Policy.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions README.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
![Built with Love](http://forthebadge.com/images/badges/built-with-love.svg)
[![Join the Discord chat](https://img.shields.io/badge/discord-glowstone-738bd7.svg?style=flat-square)](https://discord.gg/TFJqhsC)
[![Join the Discord chat](https://img.shields.io/badge/discord-glowstone-7289da.svg?style=flat-square&logo=discord)](https://discord.gg/TFJqhsC)
[![Build Status](https://circleci.com/gh/GlowstoneMC/Glowstone/tree/dev.svg?style=shield)](https://circleci.com/gh/GlowstoneMC/Glowstone/tree/dev)

<img align="right" alt="Glowstone logo" width="100" src="etc/logo/logo.png">
<img align="right" alt="Glowstone logo" width="100" src="../etc/logo/logo.png">

# Glowstone

Expand Down Expand Up @@ -51,9 +51,10 @@ However, there are several drawbacks:
For a current list of features, [check the wiki](https://github.com/GlowstoneMC/Glowstone/wiki/Current-Features).

## Downloads
[![Build Status](https://circleci.com/gh/GlowstoneMC/Glowstone.svg?style=svg)](https://circleci.com/gh/GlowstoneMC/Glowstone)

If you don't want to build from source, pre-built jar files are available to download from [**CircleCI**](https://circleci.com/gh/GlowstoneMC/Glowstone) - click the latest build and then open the "Artifacts" tab **(you must be logged in for this to show)**. The `glowstone.jar` artifact will be under `tmp/circle-artifacts.#######/`.
The latest LTS and monthly releases, as well as a direct link to our latest build can be found on [our website](https://glowstone.net/#downloads).

Older releases can be found on [GitHub](https://github.com/GlowstoneMC/Glowstone/releases).

## Building

Expand Down
11 changes: 6 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>net.glowstone</groupId>
<artifactId>glowstone</artifactId>
<packaging>jar</packaging>
<version>2018.0.1-SNAPSHOT</version>
<version>2018.0.1</version>
<name>Glowstone</name>
<url>https://www.glowstone.net</url>
<description>A fast, customizable and compatible open source Minecraft server.</description>
Expand All @@ -18,6 +18,7 @@
<maven.build.timestamp.format>yyyyMMdd-HHmm</maven.build.timestamp.format>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<kotlin.version>1.2.10</kotlin.version>
</properties>

<repositories>
Expand Down Expand Up @@ -45,7 +46,7 @@
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
<scope>runtime</scope>
</dependency>
Expand Down Expand Up @@ -73,7 +74,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.14.8</version>
<version>1.16.20</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -85,12 +86,12 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>
<version>1.2.0</version>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-reflect</artifactId>
<version>1.2.0</version>
<version>${kotlin.version}</version>
</dependency>
<!-- OpenCL -->
<dependency>
Expand Down
18 changes: 8 additions & 10 deletions src/main/java/net/glowstone/ConsoleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.logging.StreamHandler;
import jline.console.ConsoleReader;
import jline.console.completer.Completer;
import lombok.Getter;
import net.md_5.bungee.api.chat.BaseComponent;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandException;
Expand Down Expand Up @@ -54,6 +55,12 @@ public final class ConsoleManager {
private final ChatColor[] colors = ChatColor.values();

private ConsoleReader reader;
/**
* Returns this ConsoleManager's console as a ConsoleCommandSender.
*
* @return the ConsoleCommandSender instance for this ConsoleManager's console
*/
@Getter
private ConsoleCommandSender sender;

private boolean running = true;
Expand Down Expand Up @@ -135,19 +142,10 @@ public ConsoleManager(GlowServer server) {
replacements.put(ChatColor.RESET, Ansi.ansi().a(Attribute.RESET).toString());
}

/**
* Returns this ConsoleManager's console as a ConsoleCommandSender.
*
* @return the ConsoleCommandSender instance for this ConsoleManager's console
*/
public ConsoleCommandSender getSender() {
return sender;
}

/**
* Starts the console.
*
* @param jline TODO: document this parameter
* @param jline whether the console should use JLine
*/
public void startConsole(boolean jline) {
this.jline = jline;
Expand Down
50 changes: 24 additions & 26 deletions src/main/java/net/glowstone/GlowOfflinePlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import lombok.Getter;
import net.glowstone.entity.meta.profile.PlayerProfile;
import net.glowstone.entity.meta.profile.ProfileCache;
import net.glowstone.io.PlayerDataService.PlayerReader;
Expand All @@ -23,16 +24,21 @@
public final class GlowOfflinePlayer implements OfflinePlayer {

private final GlowServer server;
@Getter
private final PlayerProfile profile;

private boolean hasPlayed;
@Getter
private long firstPlayed;
@Getter
private long lastPlayed;
private String lastName;
private Location bedSpawn;
@Getter
private Location bedSpawnLocation;

/**
* Create a new offline player for the given name. If possible, the player's data will be loaded.
* Create a new offline player for the given name. If possible, the player's data will be
* loaded.
*
* @param server The server of the offline player. Must not be null.
* @param profile The profile associated with the player. Must not be null.
Expand All @@ -46,18 +52,28 @@ public GlowOfflinePlayer(GlowServer server, PlayerProfile profile) {
}

/**
* Returns a Future for a GlowOfflinePlayer by UUID. If possible, the player's data (including name) will be loaded based on the UUID.
* Returns a Future for a GlowOfflinePlayer by UUID. If possible, the player's data (including
* name) will be loaded based on the UUID.
*
* @param server The server of the offline player. Must not be null.
* @param uuid The UUID of the player. Must not be null.
* @return A {@link GlowOfflinePlayer} future.
*/
public static CompletableFuture<GlowOfflinePlayer> getOfflinePlayer(GlowServer server, UUID uuid) {
public static CompletableFuture<GlowOfflinePlayer> getOfflinePlayer(GlowServer server,
UUID uuid) {
checkNotNull(server, "server must not be null");
checkNotNull(uuid, "UUID must not be null");
return ProfileCache.getProfile(uuid).thenApplyAsync((profile) -> new GlowOfflinePlayer(server, profile));
return ProfileCache.getProfile(uuid)
.thenApplyAsync((profile) -> new GlowOfflinePlayer(server, profile));
}

/**
* Required method for configuration serialization.
*
* @param val map to deserialize
* @return deserialized player record
* @see org.bukkit.configuration.serialization.ConfigurationSerializable
*/
@SuppressWarnings("UnusedDeclaration")
public static OfflinePlayer deserialize(Map<String, Object> val) {
if (val.get("name") != null) {
Expand All @@ -78,7 +94,7 @@ private void loadData() {
if (hasPlayed) {
firstPlayed = reader.getFirstPlayed();
lastPlayed = reader.getLastPlayed();
bedSpawn = reader.getBedSpawnLocation();
bedSpawnLocation = reader.getBedSpawnLocation();

String lastName = reader.getLastKnownName();
if (lastName != null) {
Expand Down Expand Up @@ -126,28 +142,9 @@ public boolean hasPlayedBefore() {
return hasPlayed;
}

@Override
public long getFirstPlayed() {
return firstPlayed;
}

@Override
public long getLastPlayed() {
return lastPlayed;
}

public PlayerProfile getProfile() {
return profile;
}

////////////////////////////////////////////////////////////////////////////
// Ban, op, whitelist

@Override
public Location getBedSpawnLocation() {
return bedSpawn;
}

@Override
public boolean isBanned() {
return server.getBanList(Type.NAME).isBanned(getName());
Expand All @@ -169,7 +166,7 @@ public void setWhitelisted(boolean value) {

@Override
public boolean isOp() {
return server.getOpsList().containsUUID(getUniqueId());
return server.getOpsList().containsUuid(getUniqueId());
}

////////////////////////////////////////////////////////////////////////////
Expand All @@ -191,6 +188,7 @@ public Map<String, Object> serialize() {
return ret;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/net/glowstone/GlowPluginTypeDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public GlowPluginTypeDetector(File directory) {
this.directory = directory;
}

/**
* Scans all jars in the plugin directory for their types.
*/
public void scan() {
GlowServer.logger.info("Scanning plugins...");
File[] files = directory.listFiles(new PatternFilenameFilter(".+\\.jar"));
Expand All @@ -42,7 +45,15 @@ public void scan() {
scanFile(file);
}

GlowServer.logger.info("PluginTypeDetector: found " + bukkitPlugins.size() + " Bukkit, " + spongePlugins.size() + " Sponge, " + (forgefPlugins.size() + forgenPlugins.size()) + " Forge, " + canaryPlugins.size() + " Canary, " + unrecognizedPlugins.size() + " unknown plugins (total " + files.length + ")");
GlowServer.logger.info(String.format(
"PluginTypeDetector: found %d Bukkit, %d Sponge, %d Forge, %d Canary, "
+ "%d unknown plugins (total %d)",
bukkitPlugins.size(),
spongePlugins.size(),
forgefPlugins.size() + forgenPlugins.size(),
canaryPlugins.size(),
unrecognizedPlugins.size(),
files.length));

if (!unrecognizedPlugins.isEmpty()) {
for (File file : unrecognizedPlugins) {
Expand Down Expand Up @@ -84,7 +95,8 @@ private void scanFile(File file) {
// Analyze class file
ClassReader classReader = new ClassReader(zip.getInputStream(entryIn));
GlowVisitor visitor = new GlowVisitor();
classReader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
classReader.accept(visitor, ClassReader.SKIP_CODE
| ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);

if (visitor.isSponge) {
isSponge = true;
Expand Down Expand Up @@ -146,6 +158,8 @@ public AnnotationVisitor visitAnnotation(String name, boolean visible) {
case "Lnet/minecraftforge/fml/common/Mod;": // newer
isForgeN = true;
break;
default:
// do nothing
}

return null;
Expand Down
Loading

0 comments on commit 5ffb436

Please sign in to comment.