Skip to content

Commit

Permalink
#minor Back to stability (#80)
Browse files Browse the repository at this point in the history
* Bump version from 2.0.12 to 2.0.12-SNAPSHOT0

* Fixed Detective bow glitches away on startup

* Fixed gold removing and therefore not working mystery cauldrons and prayers on newer mc versions

* Fixed prayer grants new gold after usage

* Bump version from 2.0.12-SNAPSHOT0 to 2.0.12-SNAPSHOT1

* Updated MiniGamesBox to 1.3.14

* Bump version from 2.0.12-SNAPSHOT1 to 2.0.12-SNAPSHOT2

---------

Co-authored-by: version-bump[github-action] <41898282+version-bump[github-action]@users.noreply.github.com>
  • Loading branch information
Tigerpanzer02 and version-bump[github-action] authored Jul 13, 2024
1 parent c0acbf3 commit 2f565bc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 16 deletions.
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ repositories {
}

dependencies {
implementation("plugily.projects:MiniGamesBox-Classic:1.3.13") { isTransitive = false }
implementation("plugily.projects:MiniGamesBox-Classic:1.3.14") { isTransitive = false }
compileOnly("org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT")
compileOnly("org.jetbrains:annotations:24.0.1")
compileOnly(files("lib/CorpseReborn.jar"))
}

group = "plugily.projects"
version = "2.0.12"
version = "2.0.12-SNAPSHOT2"
description = "MurderMystery"

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import plugily.projects.minigamesbox.api.arena.IArenaState;
import plugily.projects.minigamesbox.api.user.IUser;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.user.User;
import plugily.projects.minigamesbox.classic.utils.helper.ItemBuilder;
import plugily.projects.minigamesbox.classic.utils.helper.ItemUtils;
import plugily.projects.minigamesbox.classic.utils.misc.complement.ComplementAccessor;
Expand Down Expand Up @@ -124,7 +123,7 @@ private void onCauldronClick(PlayerInteractEvent event) {
item.setPickupDelay(10000);
Bukkit.getScheduler().runTaskLater(plugin, item::remove, 20);
user.adjustStatistic("LOCAL_GOLD", -1);
ItemPosition.addItem(user, ItemPosition.GOLD_INGOTS, new ItemStack(Material.GOLD_INGOT, -1));
ItemPosition.removeItem(user, new ItemStack(Material.GOLD_INGOT, 1));
ItemPosition.setItem(user, ItemPosition.POTION, new ItemBuilder(XMaterial.POTION.parseItem()).name(MysteryPotionRegistry.getRandomPotion().getName()).build());
}

Expand All @@ -145,8 +144,8 @@ private void onPrayerClick(PlayerInteractEvent event) {
new MessageBuilder("IN_GAME_MESSAGES_ARENA_PLAYING_SPECIAL_BLOCKS_PRAY_CHAT").asKey().player(event.getPlayer()).sendPlayer();
user.adjustStatistic("LOCAL_PRAISES", 1);
VersionUtils.sendParticles("FIREWORKS_SPARK", event.getPlayer(), event.getClickedBlock().getLocation(), 10);
user.adjustStatistic("LOCAL_GOLD", 1);
ItemPosition.addItem(user, ItemPosition.GOLD_INGOTS, new ItemStack(Material.GOLD_INGOT, -1));
user.adjustStatistic("LOCAL_GOLD", -1);
ItemPosition.removeItem(user, new ItemStack(Material.GOLD_INGOT, 1));
}

private void onPrayLeverClick(PlayerInteractEvent event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package plugily.projects.murdermystery.arena.states;

import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.entity.Player;
Expand All @@ -27,7 +28,6 @@
import plugily.projects.minigamesbox.classic.arena.states.PluginStartingState;
import plugily.projects.minigamesbox.classic.handlers.language.MessageBuilder;
import plugily.projects.minigamesbox.classic.handlers.language.TitleBuilder;
import plugily.projects.minigamesbox.classic.user.User;
import plugily.projects.minigamesbox.classic.utils.version.VersionUtils;
import plugily.projects.murdermystery.arena.Arena;
import plugily.projects.murdermystery.arena.ArenaUtils;
Expand Down Expand Up @@ -116,8 +116,10 @@ private void addRole(Arena arena, Role role, Set<Player> playersToSet) {
} else if(role == Role.DETECTIVE) {
arena.getDetectiveList().add(userPlayer);
userPlayer.getInventory().setHeldItemSlot(0);
ItemPosition.setItem(user, ItemPosition.BOW, new ItemStack(Material.BOW, 1));
ItemPosition.setItem(user, ItemPosition.INFINITE_ARROWS, new ItemStack(Material.ARROW, getPlugin().getConfig().getInt("Bow.Amount.Arrows.Detective", 3)));
Bukkit.getScheduler().runTaskLater(arena.getPlugin(), () -> {
ItemPosition.setItem(user, ItemPosition.BOW, new ItemStack(Material.BOW, 1));
ItemPosition.setItem(user, ItemPosition.INFINITE_ARROWS, new ItemStack(Material.ARROW, getPlugin().getConfig().getInt("Bow.Amount.Arrows.Detective", 3)));
}, 20);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import plugily.projects.minigamesbox.api.user.IUser;
import plugily.projects.minigamesbox.classic.user.User;
import plugily.projects.murdermystery.arena.role.Role;

/**
Expand All @@ -46,15 +45,15 @@ public enum ItemPosition {
* Adds target item to specified hotbar position sorta different for each role.
* Item will be added if there is already set or will be set when no item is set in the position.
*
* @param user player to add item to
* @param user player to add item to
* @param itemPosition position of item to set/add
* @param itemStack itemstack to be added at itemPostion or set at itemPosition
*/
public static void addItem(IUser user, ItemPosition itemPosition, ItemStack itemStack) {
int itemPos = Role.isRole(Role.MURDERER, user) ? itemPosition.getMurdererItemPosition()
: itemPosition.getOtherRolesItemPosition();
: itemPosition.getOtherRolesItemPosition();

if (itemPos < 0) {
if(itemPos < 0) {
return;
}

Expand All @@ -73,18 +72,23 @@ public static void addItem(IUser user, ItemPosition itemPosition, ItemStack item
* Sets target item in specified hotbar position sorta different for each role.
* If item there is already set it will be incremented by itemStack amount if possible.
*
* @param user player to set item to
* @param user player to set item to
* @param itemPosition position of item to set
* @param itemStack itemstack to set at itemPosition
*/
public static void setItem(IUser user, ItemPosition itemPosition, ItemStack itemStack) {
if(itemPosition.getMurdererItemPosition() >= 0 && Role.isRole(Role.MURDERER, user)) {
if(Role.isRole(Role.MURDERER, user)) {
user.getPlayer().getInventory().setItem(itemPosition.getMurdererItemPosition(), itemStack);
} else if (itemPosition.getOtherRolesItemPosition() >= 0) {
} else {
user.getPlayer().getInventory().setItem(itemPosition.getOtherRolesItemPosition(), itemStack);
}
}

public static void removeItem(IUser user, ItemStack itemStack) {
user.getPlayer().getInventory().removeItem(itemStack);
}


public int getMurdererItemPosition() {
return murdererItemPosition;
}
Expand Down

0 comments on commit 2f565bc

Please sign in to comment.