mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-26 18:39:11 +00:00
2.0.11
This commit is contained in:
@@ -459,10 +459,14 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
var fishingPreparation = temp.getPreparation();
|
||||
fishingPreparation.setLocation(event.getHook().getLocation());
|
||||
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.BITE, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.BITE, fishingPreparation);
|
||||
fishingPreparation.triggerActions(ActionTrigger.BITE);
|
||||
|
||||
if (loot.instanceGame() && !loot.disableGame()) {
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.HOOK, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.HOOK, fishingPreparation);
|
||||
fishingPreparation.triggerActions(ActionTrigger.HOOK);
|
||||
startFishingGame(player, fishingPreparation, temp.getEffect());
|
||||
@@ -500,11 +504,14 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
var temp = getTempFishingState(uuid);
|
||||
if (temp != null ) {
|
||||
Loot loot = temp.getLoot();
|
||||
loot.triggerActions(ActionTrigger.HOOK, temp.getPreparation());
|
||||
temp.getPreparation().triggerActions(ActionTrigger.HOOK);
|
||||
var fishingPreparation = temp.getPreparation();
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.HOOK, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.HOOK, fishingPreparation);
|
||||
fishingPreparation.triggerActions(ActionTrigger.HOOK);
|
||||
if (!loot.disableGame()) {
|
||||
event.setCancelled(true);
|
||||
startFishingGame(player, temp.getPreparation(), temp.getEffect());
|
||||
startFishingGame(player, fishingPreparation, temp.getEffect());
|
||||
} else {
|
||||
success(temp, event.getHook());
|
||||
}
|
||||
@@ -586,7 +593,8 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
return;
|
||||
}
|
||||
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.FAILURE, fishingPreparation);
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.FAILURE, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.FAILURE, fishingPreparation);
|
||||
fishingPreparation.triggerActions(ActionTrigger.FAILURE);
|
||||
|
||||
@@ -662,11 +670,16 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
case ENTITY -> plugin.getEntityManager().summonEntity(hook.getLocation(), player.getLocation(), loot);
|
||||
case BLOCK -> plugin.getBlockManager().summonBlock(player, hook.getLocation(), player.getLocation(), loot);
|
||||
case ENTITY -> {
|
||||
plugin.getEntityManager().summonEntity(hook.getLocation(), player.getLocation(), loot);
|
||||
doSuccessActions(loot, effect, fishingPreparation, player);
|
||||
}
|
||||
case BLOCK -> {
|
||||
plugin.getBlockManager().summonBlock(player, hook.getLocation(), player.getLocation(), loot);
|
||||
doSuccessActions(loot, effect, fishingPreparation, player);
|
||||
}
|
||||
}
|
||||
|
||||
doSuccessActions(loot, effect, fishingPreparation, player);
|
||||
if (player.getGameMode() != GameMode.CREATIVE) {
|
||||
ItemStack rod = state.getPreparation().getRodItemStack();
|
||||
ItemUtils.decreaseHookDurability(rod, 1, false);
|
||||
@@ -720,7 +733,8 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
}
|
||||
|
||||
// events and actions
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.SUCCESS, fishingPreparation);
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.SUCCESS, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.SUCCESS, fishingPreparation);
|
||||
fishingPreparation.triggerActions(ActionTrigger.SUCCESS);
|
||||
|
||||
@@ -738,7 +752,8 @@ public class FishingManagerImpl implements Listener, FishingManager {
|
||||
String size = fishingPreparation.getArg("{SIZE}");
|
||||
if (size != null)
|
||||
if (it.setSizeIfHigher(loot.getStatisticKey().getSizeKey(), Float.parseFloat(size))) {
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.NEW_SIZE_RECORD, fishingPreparation);
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.NEW_SIZE_RECORD, fishingPreparation);
|
||||
loot.triggerActions(ActionTrigger.NEW_SIZE_RECORD, fishingPreparation);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -905,7 +905,8 @@ public class ItemManagerImpl implements ItemManager, Listener {
|
||||
Loot loot = plugin.getLootManager().getLoot(id);
|
||||
if (loot != null) {
|
||||
Condition condition = new Condition(event.getPlayer());
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.CONSUME, condition);
|
||||
if (!loot.disableGlobalAction())
|
||||
GlobalSettings.triggerLootActions(ActionTrigger.CONSUME, condition);
|
||||
loot.triggerActions(ActionTrigger.CONSUME, condition);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,6 +269,7 @@ public class LootManagerImpl implements LootManager {
|
||||
.disableGames(section.getBoolean("disable-game", CFConfig.globalDisableGame))
|
||||
.instantGame(section.getBoolean("instant-game", CFConfig.globalInstantGame))
|
||||
.showInFinder(section.getBoolean("show-in-fishfinder", CFConfig.globalShowInFinder))
|
||||
.disableGlobalActions(section.getBoolean("disable-global-event", false))
|
||||
.score(section.getDouble("score"))
|
||||
.lootGroup(ConfigUtils.stringListArgs(section.get("group")).toArray(new String[0]))
|
||||
.nick(section.getString("nick", section.getString("display.name", key)))
|
||||
|
||||
Reference in New Issue
Block a user