Add checkstyle and add 950 billion comments

This commit is contained in:
Alexander Söderberg 2020-09-11 22:36:51 +02:00
parent 784656b891
commit f90ce38a36
No known key found for this signature in database
GPG key ID: C0207FF7EA146678
47 changed files with 1055 additions and 88 deletions

View file

@ -46,7 +46,7 @@ public class BukkitCommandManager extends CommandManager<BukkitCommandSender, Bu
*/
public BukkitCommandManager(@Nonnull final Plugin owningPlugin,
@Nonnull final Function<CommandTree<BukkitCommandSender, BukkitCommandMeta>,
CommandExecutionCoordinator<BukkitCommandSender, BukkitCommandMeta>> commandExecutionCoordinator)
CommandExecutionCoordinator<BukkitCommandSender, BukkitCommandMeta>> commandExecutionCoordinator)
throws Exception {
super(commandExecutionCoordinator, new BukkitPluginRegistrationHandler());
((BukkitPluginRegistrationHandler) this.getCommandRegistrationHandler()).initialize(this);
@ -63,6 +63,11 @@ public class BukkitCommandManager extends CommandManager<BukkitCommandSender, Bu
return this.owningPlugin;
}
/**
* Create default command meta data
*
* @return Meta data
*/
@Nonnull
@Override
public BukkitCommandMeta createDefaultCommandMeta() {

View file

@ -29,6 +29,11 @@ import javax.annotation.Nonnull;
public class BukkitCommandMeta extends SimpleCommandMeta {
/**
* Bukkit command meta data
*
* @param simpleCommandMeta Simple command meta data instance that gets mirrored
*/
public BukkitCommandMeta(@Nonnull final SimpleCommandMeta simpleCommandMeta) {
super(simpleCommandMeta.getAll());
}

View file

@ -32,15 +32,27 @@ public final class BukkitCommandMetaBuilder {
private BukkitCommandMetaBuilder() {
}
/**
* Create a new builder stage 1
*
* @return Builder instance
*/
@Nonnull public static BuilderStage1 builder() {
return new BuilderStage1();
}
public static final class BuilderStage1 {
private BuilderStage1() {
}
/**
* Set the command description
*
* @param description Command description
* @return Builder instance
*/
@Nonnull public BuilderStage2 withDescription(@Nonnull final String description) {
return new BuilderStage2(description);
}
@ -56,6 +68,11 @@ public final class BukkitCommandMetaBuilder {
this.description = description;
}
/**
* Build the command meta instance
*
* @return Meta instance
*/
@Nonnull public BukkitCommandMeta build() {
return new BukkitCommandMeta(CommandMeta.simple().with("description", this.description).build());
}

View file

@ -77,7 +77,7 @@ public abstract class BukkitCommandSender implements CommandSender {
}
@Override
public boolean equals(final Object o) {
public final boolean equals(final Object o) {
if (this == o) {
return true;
}
@ -89,7 +89,7 @@ public abstract class BukkitCommandSender implements CommandSender {
}
@Override
public int hashCode() {
public final int hashCode() {
return Objects.hashCode(internalSender);
}
@ -120,7 +120,7 @@ public abstract class BukkitCommandSender implements CommandSender {
public abstract Player asPlayer();
@Override
public boolean hasPermission(@Nonnull final String permission) {
public final boolean hasPermission(@Nonnull final String permission) {
return this.internalSender.hasPermission(permission);
}

View file

@ -52,8 +52,8 @@ final class BukkitPluginRegistrationHandler implements CommandRegistrationHandle
final Field knownCommands = SimpleCommandMap.class.getDeclaredField("knownCommands");
knownCommands.setAccessible(true);
@SuppressWarnings("ALL")
final Map<String, org.bukkit.command.Command> bukkitCommands = (Map<String, org.bukkit.command.Command>) knownCommands.get(
commandMap);
final Map<String, org.bukkit.command.Command> bukkitCommands =
(Map<String, org.bukkit.command.Command>) knownCommands.get(commandMap);
this.bukkitCommands = bukkitCommands;
this.bukkitCommandManager = bukkitCommandManager;
}

View file

@ -0,0 +1,28 @@
//
// MIT License
//
// Copyright (c) 2020 Alexander Söderberg
//
// 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.
//
/**
* cloud implementation for Bukkit 1.8-1.16
*/
package com.intellectualsites.commands;