Re-enabled checkstyle, do some cleanup.

This commit is contained in:
wizjany 2019-01-27 16:13:34 -05:00
parent 0102dbb9bc
commit c6442e6669
6 changed files with 33 additions and 28 deletions

View File

@ -77,7 +77,7 @@
subprojects { subprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'maven' apply plugin: 'maven'
// apply plugin: 'checkstyle' TODO Fix apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow' apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.jfrog.artifactory' apply plugin: 'com.jfrog.artifactory'
@ -86,8 +86,8 @@
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8
// checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml") checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
// checkstyle.toolVersion = '7.6.1' checkstyle.toolVersion = '7.6.1'
repositories { repositories {
mavenLocal() mavenLocal()
@ -121,8 +121,8 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
archives javadocJar archives javadocJar
} }
// build.dependsOn(checkstyleMain) build.dependsOn(checkstyleMain)
// build.dependsOn(checkstyleTest) build.dependsOn(checkstyleTest)
build.dependsOn(sourcesJar) build.dependsOn(sourcesJar)
build.dependsOn(javadocJar) build.dependsOn(javadocJar)

View File

@ -8,6 +8,7 @@
<allow pkg="org.junit"/> <allow pkg="org.junit"/>
<allow pkg="org.hamcrest"/> <allow pkg="org.hamcrest"/>
<allow pkg="org.mockito"/> <allow pkg="org.mockito"/>
<allow pkg="junit.framework"/>
<allow pkg="com.sk89q"/> <allow pkg="com.sk89q"/>
<allow pkg="com.google.common"/> <allow pkg="com.google.common"/>

View File

@ -25,7 +25,6 @@
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.commands.CommandUtils;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -53,7 +52,7 @@ public interface StringMatcher {
* Match player names. * Match player names.
* *
* The filter string uses the following format: * The filter string uses the following format:
* @[name] looks up all players with the exact {@code name} * \@[name] looks up all players with the exact {@code name}
* *[name] matches any player whose name contains {@code name} * *[name] matches any player whose name contains {@code name}
* [name] matches any player whose name starts with {@code name} * [name] matches any player whose name starts with {@code name}
* *
@ -72,7 +71,7 @@ public interface StringMatcher {
*/ */
default Iterable<? extends LocalPlayer> checkPlayerMatch(List<? extends LocalPlayer> players) throws CommandException { default Iterable<? extends LocalPlayer> checkPlayerMatch(List<? extends LocalPlayer> players) throws CommandException {
// Check to see if there were any matches // Check to see if there were any matches
if (players.size() == 0) { if (players.isEmpty()) {
throw new CommandException("No players matched query."); throw new CommandException("No players matched query.");
} }

View File

@ -1,6 +1,23 @@
package com.sk89q.worldguard.session; /*
* WorldGuard, a suite of tools for Minecraft
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldGuard team and contributors
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
* Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import static com.google.common.base.Preconditions.checkNotNull; package com.sk89q.worldguard.session;
import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader; import com.google.common.cache.CacheLoader;
@ -8,22 +25,10 @@
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer; import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard; import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.session.handler.EntryFlag; import com.sk89q.worldguard.session.handler.*;
import com.sk89q.worldguard.session.handler.ExitFlag;
import com.sk89q.worldguard.session.handler.FarewellFlag;
import com.sk89q.worldguard.session.handler.FeedFlag;
import com.sk89q.worldguard.session.handler.GameModeFlag;
import com.sk89q.worldguard.session.handler.GodMode;
import com.sk89q.worldguard.session.handler.GreetingFlag;
import com.sk89q.worldguard.session.handler.Handler;
import com.sk89q.worldguard.session.handler.HealFlag;
import com.sk89q.worldguard.session.handler.InvincibilityFlag;
import com.sk89q.worldguard.session.handler.NotifyEntryFlag;
import com.sk89q.worldguard.session.handler.NotifyExitFlag;
import com.sk89q.worldguard.session.handler.TimeLockFlag;
import com.sk89q.worldguard.session.handler.WaterBreathing;
import com.sk89q.worldguard.session.handler.WeatherLockFlag;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -33,8 +38,7 @@
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.logging.Level; import java.util.logging.Level;
import javax.annotation.Nonnull; import static com.google.common.base.Preconditions.checkNotNull;
import javax.annotation.Nullable;
public abstract class AbstractSessionManager implements SessionManager { public abstract class AbstractSessionManager implements SessionManager {

View File

@ -221,6 +221,7 @@ public World getWorldByName(String worldName) {
return BukkitAdapter.adapt(Bukkit.getServer().getWorld(worldName)); return BukkitAdapter.adapt(Bukkit.getServer().getWorld(worldName));
} }
@Override
public String replaceMacros(Actor sender, String message) { public String replaceMacros(Actor sender, String message) {
Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers(); Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers();

View File

@ -126,7 +126,7 @@ public DelegateEvent setSilent(boolean silent) {
} }
/** /**
* Set the event to {@link Result#ALLOW} if {@code allowed} is true. * Set the event to {@link org.bukkit.event.Event.Result#ALLOW} if {@code allowed} is true.
* *
* @param allowed true to set the result * @param allowed true to set the result
* @return the same event * @return the same event