Skip to content

Commit

Permalink
Merge pull request #20 from efrei-craft/development
Browse files Browse the repository at this point in the history
bump -> 1.0.7
  • Loading branch information
Niilyx authored Oct 28, 2022
2 parents d3ddd46 + 667bd12 commit d7dfcfc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
}

group = 'fr.efreicraft'
version = '1.0.6'
version = '1.0.7'

compileJava.options.encoding "UTF-8"

Expand Down
12 changes: 9 additions & 3 deletions src/main/java/fr/efreicraft/ecatup/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.bukkit.plugin.java.JavaPlugin;

import javax.annotation.Nullable;
import java.awt.*;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -76,8 +77,8 @@ public void onEnable() {
Bukkit.getPluginManager().registerEvents(new LuckPermsListener((Main) INSTANCE, LP), INSTANCE);

// Register commands
if (Bukkit.getPluginManager().getPlugin("ECLobby") == null) {
registerCommand("lobby", new Lobby()); // Only register /lobby if ECLobby is not installed
if (!config.getString("server_name").equals("lobby")) {
registerCommand("lobby", new Lobby()); // Only register /lobby if the server's name is "lobby"
}

registerCommand("chat", new fr.efreicraft.ecatup.commands.Chat());
Expand All @@ -99,7 +100,7 @@ public void onEnable() {
webhook.addEmbed(new DiscordWebhook.EmbedObject()
.setTitle("Serveur")
.setDescription("Le serveur a démarré !")
.setColor(java.awt.Color.decode("#ffffff"))
.setColor(Color.white)
.setFooter("Efrei Craft", "https://efreicraft.fr/img/favicon.png")
);
try {
Expand Down Expand Up @@ -130,6 +131,11 @@ public void onDisable() {
.setColor(java.awt.Color.decode("#ffffff"))
.setFooter("Efrei Craft", "https://efreicraft.fr/img/favicon.png")
);

for (Player player : Bukkit.getOnlinePlayers()) {
sendPlayerToServer(player, "lobby");
}

try {
webhook.execute();
} catch (IOException ignored) {}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/fr/efreicraft/ecatup/listeners/Join.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package fr.efreicraft.ecatup.listeners;

import com.destroystokyo.paper.event.server.PaperServerListPingEvent;
import fr.efreicraft.ecatup.Main;
import fr.efreicraft.ecatup.PreferenceCache;
import fr.efreicraft.ecatup.utils.DiscordWebhook;
Expand Down Expand Up @@ -52,6 +53,10 @@ public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) throws IOExcep

case "Beta Tester" -> LP.getUserManager().getUser(event.getPlayer().getUniqueId()).data().add(Node.builder("group.beta").build());

case "Builder" -> LP.getUserManager().getUser(event.getPlayer().getUniqueId()).data().add(Node.builder("group.builder").build());

case "Responsable 1P" -> LP.getUserManager().getUser(event.getPlayer().getUniqueId()).data().add(Node.builder("group.respo1p").build());

case "Responsable Event", "Responsable Dev", "Responsable Infra", "Responsable Comm", "Responsable Build", "Responsable Design" -> {
LP.getUserManager().getUser(event.getPlayer().getUniqueId()).data().add(Node.builder("group.be").build());
LP.getUserManager().getUser(event.getPlayer().getUniqueId()).data().add(Node.builder("prefix.10.&c&l[" + rank + "] &c").build());
Expand Down Expand Up @@ -128,4 +133,5 @@ public void onJoin(org.bukkit.event.player.PlayerJoinEvent event) throws IOExcep
webhook.execute();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.luckperms.api.LuckPerms;
import net.luckperms.api.event.EventBus;
import net.luckperms.api.event.user.UserDataRecalculateEvent;
import net.luckperms.api.model.user.User;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
Expand All @@ -25,6 +26,9 @@ private void onUserDataRecalculate(UserDataRecalculateEvent event) {
if (player != null) {
player.displayName(Component.text(colorize(event.getUser().getCachedData().getMetaData().getPrefix()) + player.getName()));
player.playerListName(player.displayName());
User user = Main.LP.getUserManager().getUser(event.getUser().getUsername());
if (user != null)
user.getCachedData().invalidate();
}
}
}

0 comments on commit d7dfcfc

Please sign in to comment.