Permalink
Browse files

Re-enabled checkstyle, do some cleanup.

  • Loading branch information...
wizjany committed Jan 27, 2019
1 parent 0102dbb commit c6442e6669deda82ff5843e01771f4e9b85c61fb
@@ -77,7 +77,7 @@ artifactoryPublish.skip = true
subprojects {
apply plugin: 'java'
apply plugin: 'maven'
// apply plugin: 'checkstyle' TODO Fix
apply plugin: 'checkstyle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.jfrog.artifactory'

@@ -86,8 +86,8 @@ subprojects {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

// checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
// checkstyle.toolVersion = '7.6.1'
checkstyle.configFile = new File(rootProject.projectDir, "config/checkstyle/checkstyle.xml")
checkstyle.toolVersion = '7.6.1'

repositories {
mavenLocal()
@@ -121,8 +121,8 @@ subprojects {
archives javadocJar
}

// build.dependsOn(checkstyleMain)
// build.dependsOn(checkstyleTest)
build.dependsOn(checkstyleMain)
build.dependsOn(checkstyleTest)
build.dependsOn(sourcesJar)
build.dependsOn(javadocJar)

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

@@ -25,7 +25,6 @@
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.commands.CommandUtils;

import java.util.Iterator;
import java.util.List;
@@ -53,7 +52,7 @@
* Match player names.
*
* 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 starts with {@code name}
*
@@ -72,7 +71,7 @@
*/
default Iterable<? extends LocalPlayer> checkPlayerMatch(List<? extends LocalPlayer> players) throws CommandException {
// Check to see if there were any matches
if (players.size() == 0) {
if (players.isEmpty()) {
throw new CommandException("No players matched query.");
}

@@ -1,29 +1,34 @@
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.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldguard.LocalPlayer;
import com.sk89q.worldguard.WorldGuard;
import com.sk89q.worldguard.session.handler.EntryFlag;
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 com.sk89q.worldguard.session.handler.*;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.ref.WeakReference;
import java.util.Arrays;
import java.util.HashSet;
@@ -33,8 +38,7 @@
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;

public abstract class AbstractSessionManager implements SessionManager {

@@ -221,6 +221,7 @@ public World getWorldByName(String worldName) {
return BukkitAdapter.adapt(Bukkit.getServer().getWorld(worldName));
}

@Override
public String replaceMacros(Actor sender, String message) {
Collection<? extends Player> online = Bukkit.getServer().getOnlinePlayers();

@@ -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
* @return the same event

0 comments on commit c6442e6

Please sign in to comment.