Compare commits

...

No commits in common. "master" and "main" have entirely different histories.
master ... main

6 changed files with 15 additions and 27 deletions

View File

@ -24,9 +24,9 @@ repositories {
} }
dependencies { dependencies {
compileOnly "org.spigotmc:spigot-api:1.20.6-R0.1-SNAPSHOT" compileOnly "org.spigotmc:spigot-api:1.20.1-R0.1-SNAPSHOT"
implementation 'com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4' implementation 'com.github.Carleslc.Simple-YAML:Simple-Yaml:1.8.4'
compileOnly 'me.clip:placeholderapi:2.11.4' compileOnly 'me.clip:placeholderapi:2.11.3'
} }
def targetJavaVersion = 17 def targetJavaVersion = 17
@ -59,6 +59,6 @@ tasks {
// Configure the Minecraft version for our task. // Configure the Minecraft version for our task.
// This is the only required configuration besides applying the plugin. // This is the only required configuration besides applying the plugin.
// Your plugin's jar (or shadowJar if present) will be used automatically. // Your plugin's jar (or shadowJar if present) will be used automatically.
minecraftVersion("1.20.2") minecraftVersion("1.20.1")
} }
} }

View File

@ -14,16 +14,9 @@ public class ChatReformatting implements Listener {
if (Config.getFieldBool(Config.Chat.CHAT_FORMAT_ENABLED)) { if (Config.getFieldBool(Config.Chat.CHAT_FORMAT_ENABLED)) {
event.setCancelled(true); event.setCancelled(true);
String messagePre = UnEssentials.color( String messagePre = UnEssentials.color(
Config.getFieldString(Config.Chat.CHAT_FORMAT).replace( PlaceholderAPI.setPlaceholders(event
"%MESSAGE%", event.getMessage()).replace("%NAME%", event.getPlayer().getName())); .getPlayer(),
if (UnEssentials.PAPI) { Config.getFieldString(Config.Chat.CHAT_FORMAT).replace("%MESSAGE%", event.getMessage()).replace("%NAME%", event.getPlayer().getName())));
messagePre = UnEssentials.color(
PlaceholderAPI.setPlaceholders(event
.getPlayer(),
Config.getFieldString(Config.Chat.CHAT_FORMAT).replace("%MESSAGE%", event.getMessage()).replace("%NAME%", event.getPlayer().getName())));
}
UnEssentials.plugin.getServer().broadcastMessage(messagePre); UnEssentials.plugin.getServer().broadcastMessage(messagePre);
} }
} }

View File

@ -173,7 +173,7 @@ public class CoolCommands {
int entityCount = 0; int entityCount = 0;
for (Entity entity : nearbyEntities) { for (Entity entity : nearbyEntities) {
if (entity instanceof LivingEntity livingEntity) { if (entity instanceof LivingEntity livingEntity) {
if (!(entity instanceof Player)) livingEntity.remove(); livingEntity.remove();
entityCount++; entityCount++;
} }
} }

View File

@ -6,7 +6,6 @@ import java.util.List;
import com.the5gi.unessentials.UnEssentials; import com.the5gi.unessentials.UnEssentials;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.attribute.Attribute;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -43,7 +42,7 @@ public class GameModesCommands implements TabCompleter {
assert player != null; assert player != null;
player.setGameMode(GameMode.SURVIVAL); player.setGameMode(GameMode.SURVIVAL);
String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s"; String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s";
sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to SURVIVAL.")); sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&c" + UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to SURVIVAL."));
player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to SURVIVAL.")); player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to SURVIVAL."));
return false; return false;
} }
@ -68,7 +67,7 @@ public class GameModesCommands implements TabCompleter {
assert player != null; assert player != null;
player.setGameMode(GameMode.CREATIVE); player.setGameMode(GameMode.CREATIVE);
String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s"; String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s";
sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to CREATIVE.")); sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&c" + UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to CREATIVE."));
player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to CREATIVE.")); player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to CREATIVE."));
return false; return false;
} }
@ -93,7 +92,7 @@ public class GameModesCommands implements TabCompleter {
assert player != null; assert player != null;
player.setGameMode(GameMode.SPECTATOR); player.setGameMode(GameMode.SPECTATOR);
String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s"; String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s";
sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to SPECTATOR.")); sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&c" + UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to SPECTATOR."));
player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to SPECTATOR.")); player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to SPECTATOR."));
return false; return false;
} }
@ -118,7 +117,7 @@ public class GameModesCommands implements TabCompleter {
assert player != null; assert player != null;
player.setGameMode(GameMode.ADVENTURE); player.setGameMode(GameMode.ADVENTURE);
String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s"; String apostropheCheck = player.getName().endsWith("s") ? "'" : "'s";
sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to ADVENTURE.")); sender.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&c" + UnEssentials.PREFIX + player.getName() + apostropheCheck + " gamemode was set to ADVENTURE."));
player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to ADVENTURE.")); player.sendMessage(UnEssentials.color(UnEssentials.PREFIX + "&cYour gamemode was updated to ADVENTURE."));
return false; return false;
} }

View File

@ -64,11 +64,7 @@ public class UnEssentials extends JavaPlugin {
public static void tickCycle() { public static void tickCycle() {
for (Player player : plugin.getServer().getOnlinePlayers()) { for (Player player : plugin.getServer().getOnlinePlayers()) {
String preName = player.getName();; String preName = player.getName();;
if (Config.getFieldBool(Config.Tab.TAB_FORMAT_ENABLED)) { if (UnEssentials.PAPI && Config.getFieldBool(Config.Tab.TAB_FORMAT_ENABLED)) preName = color(PlaceholderAPI.setPlaceholders(player, Config.getFieldString(Config.Tab.TAB_FORMAT).replace("%NAME%", player.getName())));
preName = color(Config.getFieldString(Config.Tab.TAB_FORMAT).replace("%NAME%", player.getName()));
if (UnEssentials.PAPI) preName = color(PlaceholderAPI.setPlaceholders(player, Config.getFieldString(Config.Tab.TAB_FORMAT).replace("%NAME%", player.getName())));
}
//old system: ignored if PAPI wasn't installed : if (UnEssentials.PAPI && Config.getFieldBool(Config.Tab.TAB_FORMAT_ENABLED)) preName = color(PlaceholderAPI.setPlaceholders(player, Config.getFieldString(Config.Tab.TAB_FORMAT).replace("%NAME%", player.getName())));
player.setPlayerListName(preName); player.setPlayerListName(preName);
} }
} }

View File

@ -2,9 +2,9 @@ name: UnEssentials
version: '1.0.0' version: '1.0.0'
main: com.the5gi.unessentials.UnEssentials main: com.the5gi.unessentials.UnEssentials
api-version: 1.20 api-version: 1.20
authors: [s5gi] authors: [the5gi]
description: essentials but not gay asf description: essentials but not gay
website: 5gi.dev website: 5labs.us
commands: commands:
unessentials: unessentials:
aliases: aliases: