Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Update for 1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniFoldi committed Jun 14, 2021
1 parent e83039d commit ef164aa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'com.danifoldi'
version '1.2.2'
version '1.2.4'
sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand All @@ -28,11 +28,10 @@ dependencies {
exclude module: 'snakeyaml'
}

implementation'org.jetbrains:annotations:20.1.0'
compileOnly 'org.jetbrains:annotations:20.1.0'
implementation 'javax.inject:javax.inject:1'
implementation 'com.google.dagger:dagger:2.37'
annotationProcessor 'com.google.dagger:dagger-compiler:2.37'

}

processResources {
Expand All @@ -50,5 +49,7 @@ shadowJar {
relocate 'org.jetbrains.annotations', 'com.danifoldi.bungeegui.lib.annotations'
relocate 'javax.inject', 'com.danifoldi.bungeegui.lib.inject'
relocate 'dagger', 'com.danifoldi.bungeegui.lib.dagger'
relocate 'com.electronwill.night-config', 'com.danifoldi.bungeegui.lib.nightconfig'

archiveFileName.set("${project.name}-${project.version}.jar")
}
12 changes: 6 additions & 6 deletions src/main/java/com/danifoldi/bungeegui/gui/GuiGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
import java.util.stream.Collectors;

public class GuiGrid {
private final Map<Integer, GuiItem> items;
private final @NotNull Map<Integer, GuiItem> items;
private final boolean isTargeted;
private final List<String> commandAliases;
private final String permission;
private final @NotNull List<String> commandAliases;
private final @NotNull String permission;
private final int guiSize;
private final String title;
private final @NotNull String title;
private final boolean selfTarget;
private final boolean ignoreVanished;
private final boolean requireOnlineTarget;
private final List<String> whitelistServers;
private final List<String> blacklistServers;
private final @NotNull List<String> whitelistServers;
private final @NotNull List<String> blacklistServers;
private final boolean placeholdersTarget;
private final @Nullable GuiSound openSound;
private final boolean targetBypass;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/danifoldi/bungeegui/gui/GuiItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class GuiItem {
private final int amount;
private final @NotNull String name;
private final @NotNull List<String> lore;
private final String data;
private final @NotNull String data;
private final @NotNull List<String> commands;
private final boolean enchanted;
private final @Nullable GuiSound clickSound;
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/danifoldi/bungeegui/util/VanishUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class VanishUtil {
public static boolean isVanished(ProxiedPlayer player) {
Plugin premiumvanishPlugin = ProxyServer.getInstance().getPluginManager().getPlugin("PremiumVanish");
public static boolean isVanished(final @NotNull ProxiedPlayer player) {
final @Nullable Plugin premiumvanishPlugin = ProxyServer.getInstance().getPluginManager().getPlugin("PremiumVanish");
if (premiumvanishPlugin == null) {
return false;
}
Expand Down
18 changes: 15 additions & 3 deletions src/main/java/com/danifoldi/bungeegui/util/VersionUtil.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.danifoldi.bungeegui.util;

import org.jetbrains.annotations.NotNull;

import java.util.Arrays;

public enum VersionUtil {
UNKNOWN (999),
v1_17 (755),
v1_16_5 (754),
v1_16_4 (754),
v1_16_3 (753),
Expand Down Expand Up @@ -35,6 +38,15 @@ public enum VersionUtil {
v1_9_2 (109),
v1_9_1 (108),
v1_9 (107),
v1_8_9 (47),
v1_8_8 (47),
v1_8_7 (47),
v1_8_6 (47),
v1_8_5 (47),
v1_8_4 (47),
v1_8_3 (47),
v1_8_2 (47),
v1_8_1 (47),
v1_8 (47),
v1_7_10 (5),
v1_7_9 (5),
Expand All @@ -55,15 +67,15 @@ public enum VersionUtil {

private final int protocolVersion;

VersionUtil(int protocolVersion) {
VersionUtil(final int protocolVersion) {
this.protocolVersion = protocolVersion;
}

public static VersionUtil find(int protocolVersion) {
public static @NotNull VersionUtil find(final int protocolVersion) {
return Arrays.stream(VersionUtil.values()).filter(p -> p.protocolVersion == protocolVersion).findFirst().orElse(UNKNOWN);
}

public String getVersion() {
public @NotNull String getVersion() {
for (VersionUtil version: VersionUtil.values()) {
if (version.protocolVersion == protocolVersion) {
return version.toString().replace("v", "").replace("_", ".");
Expand Down

0 comments on commit ef164aa

Please sign in to comment.