Skip to content

Commit 3489d28

Browse files
authored
Merge pull request #7 from Cold-Development/development
Development
2 parents ee625b7 + 2fcbd89 commit 3489d28

8 files changed

Lines changed: 74 additions & 46 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>dev.padrewin</groupId>
88
<artifactId>confirm2drop</artifactId>
9-
<version>1.3.1</version>
9+
<version>1.4</version>
1010
<packaging>jar</packaging>
1111

1212
<name>confirm2drop</name>

src/main/java/dev/padrewin/confirm2Drop/commands/ToggleCommand.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public void execute(Confirm2Drop plugin, CommandSender sender, String[] args) {
6262
);
6363
}
6464

65-
6665
@Override
6766
public List<String> tabComplete(Confirm2Drop plugin, CommandSender sender, String[] args) {
6867
return Collections.emptyList();

src/main/java/dev/padrewin/confirm2Drop/listeners/DropListener.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ public void onItemDrop(PlayerDropItemEvent event) {
5858
long timeoutEnd = confirmationTimeouts.getOrDefault(playerUUID, 0L);
5959

6060
if (areItemsEqual(pendingItem, item) && currentTime < timeoutEnd) {
61-
debug("Player " + player.getName() + " confirmed the drop for item: " + item.getType());
61+
if (isInventoryFull(player)) {
62+
dropItemToGround(player, item);
63+
event.getItemDrop().remove();
64+
} else {
65+
debug("Player " + player.getName() + " confirmed the drop for item: " + item.getType());
66+
}
6267
pendingConfirmation.remove(playerUUID);
6368
confirmationTimeouts.remove(playerUUID);
6469
return;
@@ -79,8 +84,26 @@ public void onItemDrop(PlayerDropItemEvent event) {
7984
requestConfirmation(player, item);
8085
}
8186

87+
88+
private boolean isInventoryFull(Player player) {
89+
return player.getInventory().firstEmpty() == -1;
90+
}
91+
92+
private void dropItemToGround(Player player, ItemStack item) {
93+
player.getWorld().dropItemNaturally(player.getLocation(), item);
94+
debug("Player " + player.getName() + "'s inventory is full. Dropped item " + item.getType() + " to the ground.");
95+
plugin.getManager(LocaleManager.class).sendMessage(player, "inventory-full-drop-message");
96+
}
97+
8298
private void requestConfirmation(Player player, ItemStack item) {
8399
UUID playerUUID = player.getUniqueId();
100+
101+
if (isInventoryFull(player)) {
102+
debug("Player " + player.getName() + "'s inventory is full. Dropping item to the ground.");
103+
dropItemToGround(player, item);
104+
return;
105+
}
106+
84107
pendingConfirmation.put(playerUUID, item.clone());
85108

86109
int timeoutSeconds = plugin.getConfig().getInt("confirmation-timeout", 10);
@@ -91,6 +114,7 @@ private void requestConfirmation(Player player, ItemStack item) {
91114
plugin.getManager(LocaleManager.class).sendMessage(player, "drop-confirmation-message");
92115
}
93116

117+
94118
private boolean shouldRequireConfirmation(ItemStack item) {
95119
boolean toolsBlacklist = plugin.getConfig().getBoolean("blacklist.tools", true);
96120
boolean armorBlacklist = plugin.getConfig().getBoolean("blacklist.armor", true);

src/main/resources/locale/en_US.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ no-permission: '&cYou don''t have permission for that!'
1414
unknown-command: '&cUnknown command &4%input%&c.'
1515
invalid-command-usage: '&cInvalid command usage.'
1616
player-only-command: '&cThis command can only be used by players!'
17-
drop-confirmation-message: "&7You need to drop the item again to confirm the action. To disable confirmation, use &c/confirm2drop toggle&7."
17+
drop-confirmation-message: '&7You need to drop the item again to confirm the action. To disable confirmation, use &c/confirm2drop toggle&7.'
1818
plugin-disabled-message: '&cOops! This feature is currently turned off in the server settings. Contact the server owner.'
19-
placeholder-status-enabled: "&aenabled"
20-
placeholder-status-disabled: "&cdisabled"
19+
placeholder-status-enabled: '&aenabled'
20+
placeholder-status-disabled: '&cdisabled'
21+
inventory-full-drop-message: '&cYour inventory is full! &nThe item has been dropped on the ground.'
2122

2223
# Toggle Command Message
2324
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Toggles drop confirmation for the player'
24-
command-toggle-usage: "&7Usage: &c/confirm2drop toggle confirm"
25-
command-toggle-warning: "&eWARNING: &7Are you sure you want to toggle drop confirmation? Use &c/confirm2drop toggle confirm &7to proceed."
25+
command-toggle-usage: '&7Usage: &c/confirm2drop toggle confirm'
26+
command-toggle-warning: '&eWARNING: &7Are you sure you want to toggle drop confirmation? Use &c/confirm2drop toggle confirm &7to proceed.'
2627
command-toggle-status: '&7Drop confirmation is now: %confirm2drop_toggle_status%&7.'
2728

2829
# Reload Command

src/main/resources/locale/fr_FR.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@ prefix: '&8「&#635AA7C&#7D72B7o&#978BC7n&#B2A3D8f&#CCBCE8i&#E6D4F8r&#D8B8F8m&#C
33

44
# Base Command Message
55
base-command-color: '&7'
6-
base-command-help: '&7Utilisez &c/confirm2drop help &7pour les informations sur les commandes.'
6+
base-command-help: '&7Utilisez &c/confirm2drop help &7pour plus d''informations sur les commandes.'
77

88
# Help Command
99
command-help-description: '&8 - &c/confirm2drop help &7- Affiche le menu d''aide'
10-
command-help-title: '&cCommandes disponibles :'
10+
command-help-title: '&cCommandes Disponibles :'
1111

1212
# Misc
1313
no-permission: '&cVous n''avez pas la permission de faire cela !'
1414
unknown-command: '&cCommande inconnue &4%input%&c.'
1515
invalid-command-usage: '&cUtilisation invalide de la commande.'
16-
player-only-command: '&cCette commande ne peut être utilisée que par des joueurs !'
17-
drop-confirmation-message: "&7Vous devez déposer l''objet à nouveau pour confirmer l''action. Pour désactiver la confirmation, utilisez &c/confirm2drop toggle&7."
18-
plugin-disabled-message: '&cOups ! Cette fonctionnalité est actuellement désactivée dans les paramètres du serveur. Contactez l''administrateur.'
16+
player-only-command: '&cCette commande est réservée aux joueurs !'
17+
drop-confirmation-message: "&7Vous devez relâcher l'objet à nouveau pour confirmer l'action. Pour désactiver la confirmation, utilisez &c/confirm2drop toggle&7."
18+
plugin-disabled-message: '&cOups ! Cette fonctionnalité est désactivée dans les paramètres du serveur. Contactez l''administrateur.'
1919
placeholder-status-enabled: "&aactivé"
2020
placeholder-status-disabled: "&cdésactivé"
21+
inventory-full-drop-message: "&cVotre inventaire est plein ! &nL''objet a été déposé au sol."
2122

2223
# Toggle Command Message
23-
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Active ou désactive la confirmation des dépôts pour le joueur'
24+
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Active ou désactive la confirmation de dépôt pour le joueur'
2425
command-toggle-usage: "&7Utilisation : &c/confirm2drop toggle confirm"
25-
command-toggle-warning: "&eATTENTION : &7Êtes-vous sûr de vouloir basculer la confirmation des dépôts ? Utilisez &c/confirm2drop toggle confirm &7pour continuer."
26-
command-toggle-status: '&7La confirmation des dépôts est réglée sur : %confirm2drop_toggle_status%&7 !'
26+
command-toggle-warning: "&eATTENTION : &7Êtes-vous sûr de vouloir basculer la confirmation de dépôt ? Utilisez &c/confirm2drop toggle confirm &7pour continuer."
27+
command-toggle-status: '&7La confirmation de dépôt est maintenant : %confirm2drop_toggle_status%&7.'
2728

2829
# Reload Command
2930
command-reload-description: '&8 - &c/confirm2drop reload &7- Recharge le plugin'
3031
command-reload-usage: '&7Utilisation : &c/confirm2drop reload'
31-
command-reload-success: '&7Les fichiers de configuration et de langue ont été rechargés avec succès.'
32+
command-reload-success: '&7Les fichiers de configuration et de localisation ont été rechargés avec succès.'
3233

3334
# Version Command
34-
command-version-description: '&8 - &c/confirm2drop version &7- Affiche les informations de version de Confirm2Drop'
35+
command-version-description: '&8 - &c/confirm2drop version &7- Affiche les informations de version pour Confirm2Drop'

src/main/resources/locale/pt_PT.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@ prefix: '&8「&#635AA7C&#7D72B7o&#978BC7n&#B2A3D8f&#CCBCE8i&#E6D4F8r&#D8B8F8m&#C
33

44
# Base Command Message
55
base-command-color: '&7'
6-
base-command-help: '&7Use &c/confirm2drop help &7para informações sobre comandos.'
6+
base-command-help: '&7Use &c/confirm2drop help &7para mais informações sobre os comandos.'
77

88
# Help Command
99
command-help-description: '&8 - &c/confirm2drop help &7- Mostra o menu de ajuda'
1010
command-help-title: '&cComandos Disponíveis:'
1111

1212
# Misc
13-
no-permission: '&cVocê não tem permissão para fazer isso!'
13+
no-permission: '&cVocê não tem permissão para isso!'
1414
unknown-command: '&cComando desconhecido &4%input%&c.'
1515
invalid-command-usage: '&cUso inválido do comando.'
1616
player-only-command: '&cEste comando só pode ser usado por jogadores!'
1717
drop-confirmation-message: "&7Você precisa soltar o item novamente para confirmar a ação. Para desativar a confirmação, use &c/confirm2drop toggle&7."
18-
plugin-disabled-message: '&cOps! Este recurso está desativado nas configurações do servidor. Contate o administrador.'
18+
plugin-disabled-message: '&cOps! Este recurso está desativado nas configurações do servidor. Entre em contato com o administrador.'
1919
placeholder-status-enabled: "&aativado"
2020
placeholder-status-disabled: "&cdesativado"
21+
inventory-full-drop-message: "&cSeu inventário está cheio! &nO item foi jogado no chão."
2122

2223
# Toggle Command Message
23-
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Ativa ou desativa a confirmação de soltar para o jogador'
24+
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Ativa ou desativa a confirmação de drop para o jogador'
2425
command-toggle-usage: "&7Uso: &c/confirm2drop toggle confirm"
25-
command-toggle-warning: "&eAVISO: &7Tem certeza de que deseja alternar a confirmação de soltar? Use &c/confirm2drop toggle confirm &7para continuar."
26-
command-toggle-status: '&7A confirmação de soltar foi definida para: %confirm2drop_toggle_status%&7!'
26+
command-toggle-warning: "&eAVISO: &7Tem certeza de que deseja alternar a confirmação de drop? Use &c/confirm2drop toggle confirm &7para continuar."
27+
command-toggle-status: '&7A confirmação de drop agora está: %confirm2drop_toggle_status%&7.'
2728

2829
# Reload Command
2930
command-reload-description: '&8 - &c/confirm2drop reload &7- Recarrega o plugin'
3031
command-reload-usage: '&7Uso: &c/confirm2drop reload'
31-
command-reload-success: '&7Os arquivos de configuração e idioma foram recarregados com sucesso.'
32+
command-reload-success: '&7Os arquivos de configuração e localização foram recarregados com sucesso.'
3233

3334
# Version Command
34-
command-version-description: '&8 - &c/confirm2drop version &7- Mostra as informações de versão do Confirm2Drop'
35+
command-version-description: '&8 - &c/confirm2drop version &7- Mostra as informações da versão do Confirm2Drop'

src/main/resources/locale/ro_RO.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,28 @@ prefix: '&8「&#635AA7C&#7D72B7o&#978BC7n&#B2A3D8f&#CCBCE8i&#E6D4F8r&#D8B8F8m&#C
33

44
# Base Command Message
55
base-command-color: '&7'
6-
base-command-help: '&7Folosiți &c/confirm2drop help &7pentru informații despre comenzi.'
6+
base-command-help: '&7Folosește &c/confirm2drop help &7pentru mai multe informații despre comenzi.'
77

88
# Help Command
99
command-help-description: '&8 - &c/confirm2drop help &7- Afișează meniul de ajutor'
10-
command-help-title: '&cComenzi disponibile:'
10+
command-help-title: '&cComenzi Disponibile:'
1111

1212
# Misc
13-
no-permission: '&cNu aveți permisiunea necesară pentru asta!'
13+
no-permission: '&cNu ai permisiunea necesară pentru asta!'
1414
unknown-command: '&cComandă necunoscută &4%input%&c.'
1515
invalid-command-usage: '&cUtilizare invalidă a comenzii.'
1616
player-only-command: '&cAceastă comandă poate fi folosită doar de jucători!'
17-
drop-confirmation-message: "&7Trebuie să aruncați din nou obiectul pentru a confirma acțiunea. Pentru a dezactiva confirmarea, utilizați &c/confirm2drop toggle&7."
18-
plugin-disabled-message: '&cUps! Această funcție este dezactivată în setările serverului. Contactați administratorul.'
17+
drop-confirmation-message: "&7Trebuie să arunci din nou obiectul pentru a confirma acțiunea. Pentru a dezactiva confirmarea, folosește &c/confirm2drop toggle&7."
18+
plugin-disabled-message: '&cOops! Această funcție este dezactivată în setările serverului. Contactează administratorul.'
1919
placeholder-status-enabled: "&aactivat"
2020
placeholder-status-disabled: "&cdezactivat"
21+
inventory-full-drop-message: "&cInventarul tău este plin! &nObiectul a fost aruncat pe jos."
2122

2223
# Toggle Command Message
23-
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Activează sau dezactivează confirmarea aruncării pentru jucător'
24+
command-toggle-description: '&8 - &c/confirm2drop toggle &7- Activează sau dezactivează confirmarea drop-ului pentru jucător'
2425
command-toggle-usage: "&7Utilizare: &c/confirm2drop toggle confirm"
25-
command-toggle-warning: "&eAVERTISMENT: &7Ești sigur că vrei să modifici starea confirmării? Folosește &c/confirm2drop toggle confirm &7pentru a continua."
26-
command-toggle-status: '&7Confirmarea aruncării: %confirm2drop_toggle_status%&7.'
26+
command-toggle-warning: "&eATENȚIE: &7Ești sigur că vrei să comuți confirmarea drop-ului? Folosește &c/confirm2drop toggle confirm &7pentru a continua."
27+
command-toggle-status: '&7Confirmarea drop-ului este acum: %confirm2drop_toggle_status%&7.'
2728

2829
# Reload Command
2930
command-reload-description: '&8 - &c/confirm2drop reload &7- Reîncarcă pluginul'

src/main/resources/locale/zh_CN.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ prefix: '&8「&#635AA7C&#7D72B7o&#978BC7n&#B2A3D8f&#CCBCE8i&#E6D4F8r&#D8B8F8m&#C
33

44
# Base Command Message
55
base-command-color: '&7'
6-
base-command-help: '&7使用 &c/confirm2drop help &7查看命令信息'
6+
base-command-help: '&7使用 &c/confirm2drop help &7获取命令信息'
77

88
# Help Command
99
command-help-description: '&8 - &c/confirm2drop help &7- 显示帮助菜单'
@@ -13,22 +13,23 @@ command-help-title: '&c可用命令:'
1313
no-permission: '&c你没有权限执行此操作!'
1414
unknown-command: '&c未知命令 &4%input%&c。'
1515
invalid-command-usage: '&c无效的命令用法。'
16-
player-only-command: '&c此命令只能由玩家使用!'
17-
drop-confirmation-message: "&7您需要再次丢弃物品以确认操作。要禁用确认功能,请使用 &c/confirm2drop toggle&7。"
18-
plugin-disabled-message: '&c抱歉!此功能已在服务器设置中禁用。请联系服务器管理员。'
19-
placeholder-status-enabled: "&a启用"
20-
placeholder-status-disabled: "&c禁用"
16+
player-only-command: '&c该命令只能由玩家使用!'
17+
drop-confirmation-message: "&7你需要再次丢弃该物品以确认操作。要禁用确认,请使用 &c/confirm2drop toggle&7。"
18+
plugin-disabled-message: '&c哎呀!此功能已在服务器设置中禁用。请联系服务器管理员。'
19+
placeholder-status-enabled: "&a已启用"
20+
placeholder-status-disabled: "&c已禁用"
21+
inventory-full-drop-message: "&c你的背包已满!&n物品已掉落在地上。"
2122

2223
# Toggle Command Message
23-
command-toggle-description: '&8 - &c/confirm2drop toggle &7- 切换玩家的丢弃确认功能'
24-
command-toggle-usage: "&7用法: &c/confirm2drop toggle confirm"
25-
command-toggle-warning: "&e警告: &7确定要切换丢弃确认功能吗?使用 &c/confirm2drop toggle confirm &7继续。"
26-
command-toggle-status: '&7丢弃确认已设置为:%confirm2drop_toggle_status%&7'
24+
command-toggle-description: '&8 - &c/confirm2drop toggle &7- 为玩家启用或禁用物品丢弃确认'
25+
command-toggle-usage: "&7用法:&c/confirm2drop toggle confirm"
26+
command-toggle-warning: "&e警告:&7你确定要切换物品丢弃确认吗?使用 &c/confirm2drop toggle confirm &7继续。"
27+
command-toggle-status: '&7物品丢弃确认状态:%confirm2drop_toggle_status%&7'
2728

2829
# Reload Command
2930
command-reload-description: '&8 - &c/confirm2drop reload &7- 重新加载插件'
30-
command-reload-usage: '&7用法: &c/confirm2drop reload'
31-
command-reload-success: '&7配置文件和本地化文件已成功重新加载'
31+
command-reload-usage: '&7用法:&c/confirm2drop reload'
32+
command-reload-success: '&7配置文件和语言文件已成功重新加载'
3233

3334
# Version Command
3435
command-version-description: '&8 - &c/confirm2drop version &7- 显示 Confirm2Drop 的版本信息'

0 commit comments

Comments
 (0)