Skip to content

Commit

Permalink
Latest version of TaggerNationLib
Browse files Browse the repository at this point in the history
  • Loading branch information
toonystank committed Mar 11, 2022
1 parent 0416067 commit 3467d46
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
26 changes: 25 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.taggernation</groupId>
<artifactId>TaggerNationLib</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1</version>
<packaging>jar</packaging>

<name>TaggerNationLib</name>
Expand Down Expand Up @@ -41,6 +41,30 @@
<pattern>io.papermc.lib</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.paperlib</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>dev.triumphteam.api</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.triumphteamapi</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>net.kyori</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.adventure</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>com.google.code.gson</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.gson</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>io.github.alen_alex</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.alen_alex</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>dev.vankka</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.vankka</shadedPattern> <!-- Replace this -->
</relocation>
<relocation>
<pattern>co.aikar</pattern>
<shadedPattern>com.taggernation.taggernationlib.libs.aikar</shadedPattern> <!-- Replace this -->
</relocation>
</relocations>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import io.github.alen_alex.messageframework.MessageFramework;
import io.github.alen_alex.messageframework.bukkit.framework.FrameworkBuilder;
import lombok.Getter;
import lombok.SneakyThrows;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.bukkit.plugin.java.JavaPlugin;


@Getter
public class TaggerNationLib extends JavaPlugin {

Expand All @@ -24,14 +26,14 @@ public void papiExist() {
papi = "SKIPPED";
}
}
@SneakyThrows
@Override
public void onEnable() {
// Plugin startup logic
plugin = this;
papiHook = new Placeholder();
messageFramework = new FrameworkBuilder().setPlugin(this).withMiniMessageEngine().build();
miniMessage = MiniMessage.builder().build();

papiExist();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public void reload() throws IOException, InvalidConfigurationException {
* @param force boolean enable/disable force copy
*/
public void copy( boolean force) {
plugin.saveResource(file.getName(), force);
if (!file.exists()) {
plugin.saveResource(file.getName(), force);
}
}
/**
* Copy the config to the given path.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.taggernation.taggernationlib.logger;

import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
public class UpdateChecker {
private final Plugin plugin;
private int interval;
private UpdateChecker instance;
private final UpdateChecker instance;
private final Update update;
private List<String> message = new ArrayList<>();
private String permission = null;
Expand All @@ -34,16 +34,15 @@ public UpdateChecker(Plugin plugin, URL url, int interval) throws IOException {
this.plugin = plugin;
this.interval = interval;
this.instance = this;
plugin.getServer().getPluginManager().registerEvents(new UpdateListener(this), plugin);
Gson gson = new Gson();
InputStreamReader reader = new InputStreamReader(url.openStream());
this.update = gson.fromJson(reader, Update.class);
Bukkit.getLogger().info("[TaggerNationLib] Checking for updates for " + plugin.getName() + "..." + this.update.message);
}

private void processMessage() {
List<String> formatter = new ArrayList<>();
for (String list : update.message) {
Bukkit.getLogger().info("[TaggerNationLib] " + list);
if (list.contains("{pluginName}")) {
list = list.replace("{pluginName}", plugin.getName());
}
Expand Down Expand Up @@ -128,9 +127,10 @@ public String getNotificationPermission() {
/**
* Set up the update checker.
*/
public void setup() {
public UpdateChecker setup() {
processMessage();
checkForUpdate();
return this;
}
/**
* Check for an update.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

public class VanishCheck {
/**
*@param player Player to check if they're vanished or not.
**/
* @param player Player to check if they're vanished or not.
* @return true if the player is vanished, false if not.
*/
public boolean isVanished(Player player) {
for (final MetadataValue meta : player.getMetadata("vanished")) {
if (meta.asBoolean()) return true;
Expand Down

0 comments on commit 3467d46

Please sign in to comment.