Skip to content

Commit

Permalink
Fixed craft amount and added force resourcepack
Browse files Browse the repository at this point in the history
Closes #590, closes #588
  • Loading branch information
Lorenzo0111 committed Nov 8, 2024
1 parent 606239e commit 517a806
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.zombie_striker</groupId>
<artifactId>QualityArmory</artifactId>
<version>2.0.16-SNAPSHOT</version>
<version>2.0.16</version>
<name>QualityArmory</name>

<properties>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/me/zombie_striker/qg/QAMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,10 @@ else if (sender instanceof Player)
}

removeForIngre(player, g);
player.getInventory().addItem(QualityArmory.getCustomItemAsItemStack(g));
ItemStack result = QualityArmory.getCustomItemAsItemStack(g);
result.setAmount(g.getCraftingReturn());

player.getInventory().addItem(result);

return true;
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/me/zombie_striker/qg/api/QualityArmory.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ public void run() {
}
} catch (Error | Exception re4) {
}
player.setResourcePack(CustomItemManager.getResourcepack());

if (QAMain.isVersionHigherThan(1, 19))
player.setResourcePack(CustomItemManager.getResourcepack(), null, QAMain.kickIfDeniedRequest);
else player.setResourcePack(CustomItemManager.getResourcepack());

} catch (Error | Exception e4) {

Expand Down Expand Up @@ -643,7 +646,7 @@ public static ItemStack getIronSightsItemStack() {
return OLD_ItemFact.getIronSights();
}




public static int getAmmoInInventory(Player player, Ammo a) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
package me.zombie_striker.qg.handlers;

import me.zombie_striker.qg.QAMain;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerResourcePackStatusEvent;

import me.zombie_striker.qg.QAMain;
public class Update19resourcepackhandler implements Listener {

public class Update19resourcepackhandler implements Listener{
@EventHandler
public void onResourcePackStatus(PlayerResourcePackStatusEvent event) {
QAMain.sentResourcepack.remove(event.getPlayer().getUniqueId());

if (event.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED
|| event.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) {
QAMain.resourcepackReq.add(event.getPlayer().getUniqueId());
}

@EventHandler
public void onResourcepackStatusEvent(PlayerResourcePackStatusEvent event) {
QAMain.sentResourcepack.remove(event.getPlayer().getUniqueId());
if (event.getStatus() == PlayerResourcePackStatusEvent.Status.ACCEPTED
|| event.getStatus() == PlayerResourcePackStatusEvent.Status.SUCCESSFULLY_LOADED) {
QAMain.resourcepackReq.add(event.getPlayer().getUniqueId());
}else if (QAMain.kickIfDeniedRequest) {
Bukkit.getScheduler().runTask(QAMain.getInstance(), () -> event.getPlayer().kickPlayer(QAMain.S_KICKED_FOR_RESOURCEPACK));
}
if (event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
if (QAMain.kickIfDeniedRequest) {
Bukkit.getScheduler().runTask(QAMain.getInstance(), () -> event.getPlayer().kickPlayer(QAMain.S_KICKED_FOR_RESOURCEPACK));
}

if (event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED) {
QAMain.resourcepackReq.add(event.getPlayer().getUniqueId()); // Add to the list, so it doesn't keep spamming the title
}
}
// Add to the list, so it doesn't keep spamming the title
QAMain.resourcepackReq.add(event.getPlayer().getUniqueId());
}
}
}
6 changes: 6 additions & 0 deletions src/main/resources/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2.0.16
- Fixed invalid air drop
- 1.21.3 support
- Fixed craft amount
- Added force resourcepack support

2.0.15
- Fixed 1.21 support
- Fixed BurstFire charging
Expand Down

0 comments on commit 517a806

Please sign in to comment.