Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] License clarification and rewrite code samples #691

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) SpongePowered <https://www.spongepowered.org>
Copyright (c) contributors

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.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ The latest version may be viewed in full by visiting [Sponge Docs](https://docs.

Instructions and Guidelines on how to contribute can be found on [the Docs themselves](https://docs.spongepowered.org/en/contributing/spongedocs.html).

## Licensing

The Sponge Documentation is licensed under the [Creative Commons - Share-Alike license](LICENSE.txt),
while all code samples are licensed under the [MIT license](MIT-LICENSE.txt).

You can read more about our licensing situation on the [documentation itself](https://docs.spongepowered.org/stable/en/about/license.html).

## Translations

We're eagerly looking for translators! Please visit the [CrowdIn translation page](https://crowdin.com/project/sponge-docs), sign up, join the team, and start translating.
Expand Down
4 changes: 3 additions & 1 deletion source/about/assets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Art Assets
==========

This page provides the official SpongePowered logo and mascot. Feel free to use them to spread the word about Sponge.
However note that these images are **not** provided under the MIT License.
However note that these images are **not** provided under the MIT License, but rather are held under the
`Creative Commons - Non Commercial, No Derivatives license <https://creativecommons.org/licenses/by-nc-nd/4.0/>`_.
Refer to below for a clarification of our desires.

.. note::
If you're reading a translated version, please note that the English license is the one which counts. Translated
Expand Down
2 changes: 1 addition & 1 deletion source/about/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For Everyone
What is Sponge?
---------------

Sponge is a new versatile Minecraft: Java Edition API. It was made to enrich your Minecraft experience by allowing
Sponge is a versatile Minecraft: Java Edition API. It was made to enrich your Minecraft experience by allowing
plugins to add functionality to Minecraft. Read more about Sponge here: :doc:`introduction` and about the history of
Sponge here: :doc:`history`

Expand Down
2 changes: 2 additions & 0 deletions source/about/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Sponge
The name of the entire project.
SpongeAPI
The Minecraft Plugin API developed by the Sponge project.
SpongeAuth
The authentication panel and SSO solution for all of the Sponge websites. https://auth.spongepowered.org/
SpongeCommon
A repository of code common to the official SpongeAPI implementations, used in building them. SpongeVanilla and SpongeForge
use this repository.
Expand Down
17 changes: 14 additions & 3 deletions source/about/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
License
=======

SpongeForge, SpongeVanilla, SpongeCommon and the Sponge API are licensed under the MIT license. There is no contributor
license agreement, and contributions to the Sponge project are welcome. We also explicitly grant permission to distribute
SpongeForge in any third-party modpack.
SpongeForge, SpongeVanilla, SpongeCommon, and the Sponge API are licensed under the MIT license. There is no contributor
license agreement, and all contributions to the Sponge projects are welcome. We also explicitly grant permission to
distribute SpongeForge in any third-party modpack.

The MIT license is an extremely permissive license, placing almost no restrictions on what can be done with Sponge.
The only requirement is that the copyright header must be left intact.

There is true value in licensing Sponge under the MIT license, especially when considering the fate of other projects
with goals similar to those of Sponge. The license offers peace-of-mind in ensuring Sponge has a bright future. Further
details on the license can be found at https://choosealicense.com/licenses/mit/.

The SpongeDocs are licensed differently under the `Creative Commons - Share-Alike license <https://creativecommons.org/licenses/by-sa/4.0/>`_,
while all code samples are licensed under the MIT license similar to the
Sponge projects themselves.

If there is extensive usage of documentation example code, please fulfill the MIT requirements, otherwise if used solely
as an educational resource we will interpret the usage as Fair Use.

Art assets are held under the `Creative Commons - Non Commercial, No Derivatives license <https://creativecommons.org/licenses/by-nc-nd/4.0/>`_.

Contributions to the projects implicitly accept their respective licenses.
22 changes: 12 additions & 10 deletions source/about/structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,25 @@ before going into detail:
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| Project | Description | What is done in the repository? |
+===================================================================+=======================================================+=================================================================================+
| `SpongeAPI <https://github.com/Spongepowered/SpongeAPI>`_ | The API itself | Development of the API itself |
| `SpongeAPI <https://github.com/SpongePowered/SpongeAPI>`_ | The API itself | Development of the API itself |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeForge <https://github.com/Spongepowered/SpongeForge>`_ | A SpongeAPI implementation built on top of Forge | Development of the parts of SpongeForge which rely on Forge |
| `SpongeForge <https://github.com/SpongePowered/SpongeForge>`_ | A SpongeAPI implementation built on top of Forge | Development of the parts of SpongeForge which rely on Forge |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeVanilla <https://github.com/Spongepowered/SpongeVanilla>`_ | A SpongeAPI implementation built directly on top | Development of the Vanilla Counterpart of the SpongeForge repository |
| `SpongeVanilla <https://github.com/SpongePowered/SpongeVanilla>`_ | A SpongeAPI implementation built directly on top | Development of the Vanilla Counterpart of the SpongeForge repository |
| | of Vanilla Minecraft | |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeCommon <https://github.com/Spongepowered/SpongeCommon>`_ | The shared code between SpongeForge and SpongeVanilla | Development of all code which is shared between SpongeForge and SpongeVanilla |
| `SpongeCommon <https://github.com/SpongePowered/SpongeCommon>`_ | The shared code between SpongeForge and SpongeVanilla | Development of all code which is shared between SpongeForge and SpongeVanilla |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `Mixin <https://github.com/Spongepowered/Mixin>`_ | The tool used to inject the implementations into | Development of our solution to hook Sponge into the Minecraft server |
| `Mixin <https://github.com/SpongePowered/Mixin>`_ | The tool used to inject the implementations into | Development of our solution to hook Sponge into the Minecraft server |
| | the underlying code structure | |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeDocs <https://github.com/Spongepowered/SpongeDocs>`_ | The official SpongeProject Documentation | Expanding, fixing and writing the SpongeDocs |
| `SpongeDocs <https://github.com/SpongePowered/SpongeDocs>`_ | The official SpongeProject Documentation | Expanding, fixing and writing the SpongeDocs |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeHome <https://github.com/Spongepowered/SpongeHome>`_ | The website for the SpongeProject | Development of our website |
| `SpongeHome <https://github.com/SpongePowered/SpongeHome>`_ | The website for the SpongeProject | Development of our website |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `Ore <https://github.com/Spongepowered/Ore>`_ | Plugin hosting solution | Development of our plugin hosting solution |
| `Ore <https://github.com/SpongePowered/Ore>`_ | Plugin hosting solution | Development of our plugin hosting solution |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+
| `SpongeAuth <https://github.com/SpongePowered/SpongeAuth>`_ | The authentication portal and SSO for our websites | Development of our authentication portal and SSO solution |
+-------------------------------------------------------------------+-------------------------------------------------------+---------------------------------------------------------------------------------+

SpongeCommon, SpongeForge and SpongeVanilla
Expand All @@ -41,13 +43,13 @@ building SpongeForge or SpongeVanilla from the repository *without* including Sp
SpongeHome
==========

SpongeHome is the SpongeProject's website. It's written in Golang, using the go-macaron library. It uses SCSS as it's
SpongeHome is the Sponge Project's website. It's written in Golang, using the go-macaron library. It uses SCSS as it's
CSS preprocessor.

Ore
===

Ore is our very own plugin hosting solution. It's written in Scala, based on the Play Framework and of course open-source!
Ore is our very own plugin hosting solution. It's written in Scala, based on the Play Framework and of course open source!

How everything is tied together
===============================
Expand Down
146 changes: 89 additions & 57 deletions source/contributing/implementation/codestyle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ few additions and modifications, which are described herein.

* File headers

* File headers must contain the license headers for the project. Use the ``licenseFormat`` Gradle task to add them
automatically.
* File headers must contain the license headers for the project. Use the ``updateLicenses`` Gradle task to add them
automatically

* Imports

Expand Down Expand Up @@ -61,6 +61,10 @@ few additions and modifications, which are described herein.
* Capitalize the first letter in the descriptions within each "at clause", i.e. ``@param name Player to affect``, no
periods

* End of file

* Each file should end with an empty line

Code Conventions
================

Expand All @@ -80,73 +84,101 @@ started quickly, here is an example of properly formatted code:
.. code-block:: java

/*
* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered.org <https://www.spongepowered.org>
* Copyright (c) contributors
*
* 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.
*/
package com.example.java;

* This file is part of Sponge, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* 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.
*/
package org.spongepowered.example;

import static com.google.common.base.Preconditions.checkNotNull;

import com.google.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Random;
import java.util.Optional;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

import javax.annotation.Nullable;

/**
* An example class which generates a new ID based on a specified base string
* and a randomly generated integer.
*
* <p>There is a chance the integer purposely fails to generate, in which case
* you can choose to provide a backup integer.</p>
*/
public class Example {

private static final Logger log = LoggerFactory.getLogger(Example.class);
private static final Random random = new Random();
private final String id = "test";
private static final long SEED = 4815162342L;

@Inject
private Logger logger;

private final String base;
private final Random random;

public Example(String base) {
checkNotNull(base, "The specified base string cannot be null!");
this.base = base;
this.random = ThreadLocalRandom.current();
this.random.setSeed(SEED);
}

/**
* Returns an identifier approximately half of the time.
*
* <p>A static instance of {@link Random} is used to calculate the
* outcome with a 50% chance.</p>
*
* @return The ID, if available
*/
public Optional<String> resolveId() {
log.info("ID requested");

if (random.nextBoolean()) {
return Optional.of(this.id);
} else {
return Optional.empty();
* Generates and returns an ID using the base string specified on creation
* or the alternative string if specified as well as a randomly generated
* integer, which purposely fails to generate around 50% of the time.
*
* <p>A {@link ThreadLocalRandom} is used to check if the integer should
* be generated and generates the integer itself if so.</p>
*
* @param alternate An alternate base string which will be used if not null
* @return The generated ID, if available
*/
public Optional<String> generateId(@Nullable String alternate) {
if (this.random.nextBoolean()) {
return Optional.of(alternate == null ? this.base : alternate + " - " + this.random.nextInt());
}

return Optional.empty();
}

/**
* Returns an identifier approximately half of the time.
*
* <p>A static instance of {@link Random} is used to calculate the
* outcome with a 50% chance. If the outcome is to not return the ID,
* the given fallback ID is returned.</p>
*
* @param fallback A fallback name to return
* @return The ID half of the time, the given fallback the other half
*/
public String resolveId(String fallback) {
return resolveId().orElse(fallback);
* Generates and returns an ID using the base string specified on creation,
* using a randomly generated integer if it was generated successfully, or
* using the backup integer you specify.
*
* <p>A {@link ThreadLocalRandom} is used to check if the integer should
* be generated and generates the integer itself if so. If it was not
* generated, that is when your backup integer will be used.</p>
*
* @param backup A backup integer to use to create the ID with
* @return The generated ID using the generated integer or the ID created
* using the backup integer specified
*/
public String generateId(int backup) {
return generateId(null).orElse(this.base + " - " + backup);
}

}

Loading