Skip to content

Commit

Permalink
New version 1.0.4 📝
Browse files Browse the repository at this point in the history
  • Loading branch information
StaffV77 authored Jun 12, 2024
1 parent 6063d6e commit 4b51e5f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 26 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.sstudiosdev</groupId>
<artifactId>BetterPvP</artifactId>
<version>1.0.3-Stable</version>
<version>1.0.4-Stable</version>
<name>BetterPvP</name>

<!-- Project Properties -->
Expand Down Expand Up @@ -114,4 +114,4 @@
<!-- Maven Command | Clean Install -->
<defaultGoal>clean install</defaultGoal>
</build>
</project>
</project>
5 changes: 3 additions & 2 deletions src/main/java/io/github/sstudiosdev/BetterPvP.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class BetterPvP extends JavaPlugin {
private String currentVersion;
private String latestVersion;

private static final String PLUGIN_VERSION = "1.0.3";
private static final String PLUGIN_VERSION = "1.0.4";

private static final List<String> incompatiblePlugins = Arrays.asList(
"epicplugin-1.0",
Expand Down Expand Up @@ -172,7 +172,7 @@ private void registerEvents() {
*/
private void displayConsoleInfo() {
sendMessageToConsole(" &3_____");
sendMessageToConsole(" &3| __ \\ &3BetterPvP &7v1.0.3-Stable ");
sendMessageToConsole(" &3| __ \\ &3BetterPvP &7v1.0.4-Stable ");
sendMessageToConsole(" &3| | | | &7Running on Bukkit - Paper ");
sendMessageToConsole(" &3| |___ | &fPlugin by &3[srstaff_tv, sstudios, 1vcb, Updated by pichema and more]");
sendMessageToConsole(" &3| |__| | ");
Expand Down Expand Up @@ -204,6 +204,7 @@ private void checkForUpdates() {

latestVersion = response.toString().split("\"tag_name\":\"")[1].split("\",")[0];

// Notificar si hay una nueva versión disponible
if (isNewVersionAvailable()) {
notifyPlayers();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

public class BetterPvPNoPvPCommand extends BaseCommand implements Listener {
private final BetterPvP betterPvP;
private SoundConfig soundConfig;
private final Map<Player, Boolean> pvpStatus = new HashMap<>();
private Map<Player, Long> cooldowns = new HashMap<>();
private final List<String> pvpChangeLog = new ArrayList<>();
Expand All @@ -41,11 +40,11 @@ public class BetterPvPNoPvPCommand extends BaseCommand implements Listener {
private final long pickupCooldownTime = 10000;
private final Map<Player, Long> lastPickupMessageTime = new HashMap<>();
private final Map<Player, BossBar> autoEnableBossBars = new HashMap<>();
private SoundConfig soundConfig = SoundConfig.getInstance();

public BetterPvPNoPvPCommand(final BetterPvP betterPvP) {
super("pvp", new ArrayList<>(), "betterpvp.pvp", true);
this.betterPvP = betterPvP;
this.soundConfig = new SoundConfig(betterPvP, "sound");

PluginManager pluginManager = betterPvP.getServer().getPluginManager();
pluginManager.registerEvents(this, betterPvP);
Expand Down Expand Up @@ -254,4 +253,4 @@ public void run() {
}.runTaskTimer(betterPvP, 0, 20);
pvpAutoEnableTask.put(player, autoEnableTask);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.sstudiosdev.BetterPvP;
import io.github.sstudiosdev.util.ChatColorUtil;
import io.github.sstudiosdev.util.constructors.SoundConfig;
import io.github.sstudiosdev.vault.economy.EconomyManager;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
Expand All @@ -14,6 +15,7 @@ public class PlayerDeathListener implements Listener {
private double defaultReward;
private String killMessage;
private boolean rewardsEnabled;
private SoundConfig soundConfig = SoundConfig.getInstance();

public PlayerDeathListener(BetterPvP betterPvP) {
this.betterPvP = betterPvP;
Expand Down Expand Up @@ -61,6 +63,8 @@ public void onPlayerDeath(PlayerDeathEvent event) {
// Enviar un mensaje al jugador asesino sobre la recompensa
String formattedMessage = killMessage.replace("%bt-give-Money%", String.valueOf(defaultReward));
killer.sendMessage(ChatColorUtil.colorize(BetterPvP.prefix + " " + formattedMessage));

killer.playSound(killer.getLocation(), soundConfig.getSound("money-reward"), 1.0f, 1.0f);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import io.github.sstudiosdev.BetterPvP;
import io.github.sstudiosdev.util.ChatColorUtil;
import io.github.sstudiosdev.util.constructors.SoundConfig;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
Expand All @@ -20,6 +21,7 @@ public class RespawnProtectionListener implements Listener {
private final Set<Player> playersWithRespawnProtection = new HashSet<>();
private final JavaPlugin plugin;
private final FileConfiguration config;
private SoundConfig soundConfig = SoundConfig.getInstance();

public RespawnProtectionListener(JavaPlugin plugin) {
this.plugin = plugin;
Expand Down Expand Up @@ -47,6 +49,7 @@ public void onPlayerRespawn(PlayerRespawnEvent event) {
playersWithRespawnProtection.remove(player);
String respawnMessage = ChatColorUtil.colorize(BetterPvP.prefix + " " + config.getString("respawn_message"));
player.sendMessage(respawnMessage);
player.playSound(player.getLocation(), soundConfig.getSound("respawn-player"), 1.0f, 1.0f);
}, duration * 20L); // Convert seconds to ticks
}

Expand All @@ -58,6 +61,7 @@ public void onEntityDamage(EntityDamageEvent event) {
event.setCancelled(true);
String protectionMessage = ChatColorUtil.colorize(BetterPvP.prefix + " " + config.getString("protection_message"));
player.sendMessage(protectionMessage);
player.playSound(player.getLocation(), soundConfig.getSound("protection-attack"), 1.0f, 1.0f);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ public class SoundConfig {
// Configuración de Bukkit asociada al archivo
private final YamlConfiguration bukkitConfiguration;

@Getter
private static SoundConfig instance;

/**
* Constructor que inicializa el archivo y la configuración de Bukkit.
*
* @param plugin Instancia del plugin JavaPlugin.
* @param fileName Nombre del archivo de configuración (sin la extensión .yml).
*/
public SoundConfig(final JavaPlugin plugin, final String fileName) {
if (instance == null) {
instance = this;
}

this.file = initializeFile(plugin, fileName);
this.bukkitConfiguration = YamlConfiguration.loadConfiguration(file);
}
Expand Down Expand Up @@ -61,11 +68,11 @@ private File initializeFile(final JavaPlugin plugin, final String fileName) {
}

/**
* Verifica si la configuración contiene una clave específica.
*
* @param path La clave a verificar.
* @return true si la clave existe, false si no.
*/
* Verifica si la configuración contiene una clave específica.
*
* @param path La clave a verificar.
* @return true si la clave existe, false si no.
*/
public boolean contains(final String path) {
return bukkitConfiguration.contains(path);
}
Expand Down Expand Up @@ -147,4 +154,4 @@ public void save() {
e.printStackTrace();
}
}
}
}
9 changes: 5 additions & 4 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
prefix: "&8[&3BetterPvP&8]"
load-license-file: true
error-handler: true # It is recommended to have it activated
version: 1.0.3 # Do not touch this part is handled by the version of the plugin with our api.
version: 1.0.4 # Do not touch this part is handled by the version of the plugin with our api.

# ============================================================
# | Messages |
Expand All @@ -32,6 +32,7 @@ no-permission: "&cSorry, but you (%player_name%) do not have permission to execu
onlyPlayers: "&cThis command can only be used by players"
command-disabled-world: "&cThis command is disabled in this world, please wait for them to activate it"
world-not-found: "&cError! The '%bt-world%' world was not found"
dependency-error: "&cThis command requires the %plugin-dependency% plugin to work correctly."
kill-reward: "&aYou have received %bt-give-Money% for killing a player!"
pvptoggle: "&aPvP is now %bt-status%"
pvp-history: "&aPvP Change History:"
Expand Down Expand Up @@ -86,8 +87,8 @@ player-kills:
# this is one of the main modules of the plugins

cooldown:
pvp-cooldown: 60
pvp-auto-enable-time: 300
pvp-cooldown: 300
pvp-auto-enable-time: 60

tools:
enable-pickup-event: true
Expand Down Expand Up @@ -133,4 +134,4 @@ respawn-protection:
duration: 5 # time in seconds

# End Config.yml
# Thank you pichema ❤
# Thank you pichema ❤
2 changes: 1 addition & 1 deletion src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BetterPvP
version: '1.0.3-Stable'
version: '1.0.4-Stable'
main: io.github.sstudiosdev.BetterPvP
api-version: '1.13'
author: Sstudiosdev, staFF6773, Akit, pichema, 1vcbGH and more
Expand Down
35 changes: 27 additions & 8 deletions src/main/resources/sound.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,41 @@
# ============================================================
# | Sound Configuration |
# ============================================================
##########################################################
# #
# SOUND CONFIGURATION #
# #
##########################################################

# Welcome to the sound configuration file
# If you find an error in this file for example that some sounds do not change even when you turn off the server please
# report the error on the discord support server or via gmail or via an issue in the betterpvp GitHub repository.
# If you find an error in this file, for example, that some sounds do not change even when you turn off the server, please
# report the error on the Discord support server or via Gmail or via an issue in the BetterPvP GitHub repository.

# Discord: https://discord.com/invite/F4YVQJQFqQ
# Github issues: https://github.com/Sstudios-Dev/Betterpvp-2.0/issues
# Gmail: [email protected]

# ============================================================
# | PvP toggle |
# ============================================================
# List of official Minecraft sounds you can use in the plugin:
# https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Sound.html

# --------------------------------------------------------
# | PvP toggle
# --------------------------------------------------------

pvpToggle: ENTITY_PLAYER_LEVELUP
pvp-ready-enabled: ENTITY_PLAYER_LEVELUP
pvp-already-disabled: ENTITY_VILLAGER_NO
cooldown-error: BLOCK_ANVIL_LAND
no-permission: ENTITY_VILLAGER_NO
incorrect-usage: BLOCK_NOTE_BLOCK_BASS

# --------------------------------------------------------
# | Player Kills
# --------------------------------------------------------

money-reward: ENTITY_EXPERIENCE_ORB_PICKUP
# More will be added in future updates

# --------------------------------------------------------
# | RespawnProtection
# --------------------------------------------------------

respawn-player: ENTITY_EXPERIENCE_ORB_PICKUP
protection-attack: ENTITY_VILLAGER_NO

0 comments on commit 4b51e5f

Please sign in to comment.