mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-14 04:02:01 +01:00
Code clean up.
Removed commodore for now. Simplified some return statements.
This commit is contained in:
parent
653e94e0b7
commit
67d40462bc
39
pom.xml
39
pom.xml
@ -51,10 +51,6 @@
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>luck-repo</id>
|
||||
<url>https://repo.lucko.me/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
@ -87,12 +83,6 @@
|
||||
<artifactId>mongodb-driver</artifactId>
|
||||
<version>3.8.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.lucko</groupId>
|
||||
<artifactId>commodore</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -109,33 +99,6 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>me.lucko:commodore</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>me.lucko.commodore</pattern>
|
||||
<!-- vvv Replace with the package of your plugin vvv -->
|
||||
<shadedPattern>com.yourdomain.yourplugin.commodore</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
@ -257,7 +220,7 @@
|
||||
<plugin>
|
||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
||||
<artifactId>sonar-maven-plugin</artifactId>
|
||||
<version>5.1</version>
|
||||
<version>LATEST</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
|
@ -5,8 +5,6 @@ import org.bukkit.World;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import me.lucko.commodore.Commodore;
|
||||
import me.lucko.commodore.CommodoreProvider;
|
||||
import world.bentobox.bentobox.api.configuration.Config;
|
||||
import world.bentobox.bentobox.api.configuration.WorldSettings;
|
||||
import world.bentobox.bentobox.api.events.BentoBoxReadyEvent;
|
||||
@ -65,15 +63,8 @@ public class BentoBox extends JavaPlugin {
|
||||
|
||||
private boolean isLoaded;
|
||||
|
||||
private Commodore commodore;
|
||||
|
||||
@Override
|
||||
public void onEnable(){
|
||||
// check if brigadier is supported
|
||||
if (CommodoreProvider.isSupported()) {
|
||||
// get a commodore instance
|
||||
commodore = CommodoreProvider.getCommodore(this);
|
||||
}
|
||||
// Not loaded
|
||||
isLoaded = false;
|
||||
// Store the current millis time so we can tell how many ms it took for BSB to fully load.
|
||||
@ -153,13 +144,6 @@ public class BentoBox extends JavaPlugin {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the commodore
|
||||
*/
|
||||
public Commodore getCommodore() {
|
||||
return commodore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register listeners
|
||||
*/
|
||||
|
@ -54,10 +54,7 @@ public class IslandTeamCoopCommand extends CompositeCommand {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
return false;
|
||||
}
|
||||
if (getSettings().getInviteWait() > 0 && checkCooldown(user, targetUUID)) {
|
||||
return false;
|
||||
}
|
||||
return coopCmd(user, targetUUID);
|
||||
return (getSettings().getInviteWait() <= 0 || !checkCooldown(user, targetUUID)) && coopCmd(user, targetUUID);
|
||||
}
|
||||
|
||||
private boolean coopCmd(User user, UUID targetUUID) {
|
||||
@ -90,7 +87,7 @@ public class IslandTeamCoopCommand extends CompositeCommand {
|
||||
// Don't show every player on the server. Require at least the first letter
|
||||
return Optional.empty();
|
||||
}
|
||||
String lastArg = !args.isEmpty() ? args.get(args.size()-1) : "";
|
||||
String lastArg = args.get(args.size()-1);
|
||||
return Optional.of(Util.tabLimit(Util.getOnlinePlayerList(user), lastArg));
|
||||
}
|
||||
}
|
||||
|
@ -58,10 +58,7 @@ public class IslandTeamTrustCommand extends CompositeCommand {
|
||||
user.sendMessage("general.errors.unknown-player");
|
||||
return false;
|
||||
}
|
||||
if (getSettings().getInviteWait() > 0 && checkCooldown(user, targetUUID)) {
|
||||
return false;
|
||||
}
|
||||
return trustCmd(user, targetUUID);
|
||||
return (getSettings().getInviteWait() <= 0 || !checkCooldown(user, targetUUID)) && trustCmd(user, targetUUID);
|
||||
}
|
||||
|
||||
private boolean trustCmd(User user, UUID targetUUID) {
|
||||
|
@ -148,10 +148,7 @@ public class PlayersManager {
|
||||
* @return true if player is know, otherwise false
|
||||
*/
|
||||
public boolean isKnown(UUID uniqueID) {
|
||||
if (uniqueID == null) {
|
||||
return false;
|
||||
}
|
||||
return playerCache.containsKey(uniqueID) || handler.objectExists(uniqueID.toString());
|
||||
return uniqueID != null && (playerCache.containsKey(uniqueID) || handler.objectExists(uniqueID.toString()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user