mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-28 19:39:06 +00:00
1.2.4
This commit is contained in:
@@ -4,7 +4,7 @@ plugins {
|
||||
}
|
||||
|
||||
group = 'net.momirealms'
|
||||
version = '1.2.3'
|
||||
version = '1.2.4'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
package net.momirealms.customfishing.commands;
|
||||
|
||||
|
||||
import net.momirealms.customfishing.commands.subcmd.CompetitionCommand;
|
||||
import net.momirealms.customfishing.commands.subcmd.ImportCommand;
|
||||
import net.momirealms.customfishing.commands.subcmd.ItemsCommand;
|
||||
import net.momirealms.customfishing.commands.subcmd.ReloadCommand;
|
||||
import net.momirealms.customfishing.commands.subcmd.*;
|
||||
import net.momirealms.customfishing.manager.MessageManager;
|
||||
import net.momirealms.customfishing.util.AdventureUtil;
|
||||
import org.bukkit.command.Command;
|
||||
@@ -62,6 +59,7 @@ public class PluginCommand implements TabExecutor {
|
||||
regSubCommand(ItemsCommand.INSTANCE);
|
||||
regSubCommand(CompetitionCommand.INSTANCE);
|
||||
regSubCommand(ImportCommand.INSTANCE);
|
||||
regSubCommand(SellShopCommand.INSTANCE);
|
||||
}
|
||||
|
||||
public void regSubCommand(SubCommand executor) {
|
||||
|
||||
@@ -42,8 +42,9 @@ public class RodCommand extends AbstractSubCommand {
|
||||
public boolean onCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() < 2) {
|
||||
AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.lackArgs);
|
||||
return true;
|
||||
}
|
||||
else if (args.get(0).equalsIgnoreCase("get")) {
|
||||
if (args.get(0).equalsIgnoreCase("get")) {
|
||||
if (sender instanceof Player player){
|
||||
if (!BonusManager.RODITEMS.containsKey(args.get(1))){
|
||||
AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.itemNotExist);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.momirealms.customfishing.commands.subcmd;
|
||||
|
||||
import net.momirealms.customfishing.CustomFishing;
|
||||
import net.momirealms.customfishing.commands.AbstractSubCommand;
|
||||
import net.momirealms.customfishing.commands.SubCommand;
|
||||
import net.momirealms.customfishing.manager.MessageManager;
|
||||
import net.momirealms.customfishing.util.AdventureUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SellShopCommand extends AbstractSubCommand {
|
||||
|
||||
public static final SubCommand INSTANCE = new SellShopCommand();
|
||||
|
||||
public SellShopCommand() {
|
||||
super("sellshop", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, List<String> args) {
|
||||
if (args.size() < 1) {
|
||||
AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.lackArgs);
|
||||
return true;
|
||||
}
|
||||
|
||||
Player player = Bukkit.getPlayer(args.get(0));
|
||||
if (player == null) {
|
||||
AdventureUtil.sendMessage(sender, MessageManager.prefix + MessageManager.notOnline.replace("{Player}", args.get(0)));
|
||||
return true;
|
||||
}
|
||||
|
||||
player.closeInventory();
|
||||
CustomFishing.plugin.getSellManager().openGuiForPlayer(player);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> onTabComplete(CommandSender sender, List<String> args) {
|
||||
return online_players();
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,7 @@ public class ConfigManager {
|
||||
public static boolean addTagToFish;
|
||||
public static boolean logEarning;
|
||||
public static boolean vaultHook;
|
||||
public static boolean disableBar;
|
||||
public static String fishingBagTitle;
|
||||
public static HashSet<Material> bagWhiteListItems;
|
||||
|
||||
@@ -94,6 +95,7 @@ public class ConfigManager {
|
||||
}
|
||||
worlds = worldList.toArray(new World[0]);
|
||||
|
||||
disableBar = config.getBoolean("mechanics.disable-bar-mechanic", false);
|
||||
alwaysFishingBar = config.getBoolean("mechanics.other-loots.fishing-bar", true);
|
||||
otherLootBar = config.getBoolean("mechanics.other-loots.fishing-bar", true);
|
||||
enableVanillaLoot = config.getBoolean("mechanics.other-loots.vanilla.enable", true);
|
||||
|
||||
@@ -337,6 +337,11 @@ public class FishingManager extends Function {
|
||||
final Player player = event.getPlayer();
|
||||
if (!(event.getCaught() instanceof Item item)) return;
|
||||
|
||||
if (ConfigManager.disableBar) {
|
||||
noBarWaterReelIn(event);
|
||||
return;
|
||||
}
|
||||
|
||||
FishingPlayer fishingPlayer = fishingPlayerCache.remove(player);
|
||||
if (fishingPlayer == null) {
|
||||
|
||||
@@ -385,12 +390,66 @@ public class FishingManager extends Function {
|
||||
}
|
||||
}
|
||||
|
||||
private void noBarWaterReelIn(PlayerFishEvent event) {
|
||||
Entity entity = event.getCaught();
|
||||
if (!(entity instanceof Item item)) {
|
||||
return;
|
||||
}
|
||||
entity.remove();
|
||||
event.setExpToDrop(0);
|
||||
final Player player = event.getPlayer();
|
||||
Loot loot = nextLoot.remove(player);
|
||||
VanillaLoot vanilla = vanillaLoot.remove(player);
|
||||
Bonus bonus = nextBonus.remove(player);
|
||||
if (vanilla != null) {
|
||||
dropVanillaLoot(player, vanilla, item.getLocation(), bonus.getDoubleLoot() > Math.random());
|
||||
return;
|
||||
}
|
||||
if (loot instanceof Mob mob) {
|
||||
summonMob(player, loot, item.getLocation(), mob, bonus.getScore());
|
||||
return;
|
||||
}
|
||||
if (loot instanceof DroppedItem droppedItem){
|
||||
if (ConfigManager.enableMcMMOLoot && Math.random() < ConfigManager.mcMMOLootChance){
|
||||
if (dropMcMMOLoot(player, item.getLocation(), bonus.getDoubleLoot() > Math.random())){
|
||||
return;
|
||||
}
|
||||
}
|
||||
dropCustomFishingLoot(player, item.getLocation(), droppedItem, bonus.getDoubleLoot() > Math.random(), bonus.getScore());
|
||||
}
|
||||
}
|
||||
|
||||
private void noBarLavaReelIn(PlayerFishEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
BobberCheckTask bobberCheckTask = bobberTaskCache.remove(player);
|
||||
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
||||
Loot loot = nextLoot.remove(player);
|
||||
VanillaLoot vanilla = vanillaLoot.remove(player);
|
||||
Bonus bonus = nextBonus.remove(player);
|
||||
if (vanilla != null) {
|
||||
dropVanillaLoot(player, vanilla, event.getHook().getLocation(), bonus.getDoubleLoot() > Math.random());
|
||||
return;
|
||||
}
|
||||
if (loot instanceof Mob mob) {
|
||||
summonMob(player, loot, event.getHook().getLocation(), mob, bonus.getScore());
|
||||
return;
|
||||
}
|
||||
if (loot instanceof DroppedItem droppedItem){
|
||||
if (ConfigManager.enableMcMMOLoot && Math.random() < ConfigManager.mcMMOLootChance){
|
||||
if (dropMcMMOLoot(player, event.getHook().getLocation(), bonus.getDoubleLoot() > Math.random())){
|
||||
return;
|
||||
}
|
||||
}
|
||||
dropCustomFishingLoot(player, event.getHook().getLocation(), droppedItem, bonus.getDoubleLoot() > Math.random(), bonus.getScore());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void proceedReelIn(PlayerFishEvent event, Player player, FishingPlayer fishingPlayer) {
|
||||
fishingPlayer.cancel();
|
||||
Loot loot = nextLoot.remove(player);
|
||||
VanillaLoot vanilla = vanillaLoot.remove(player);
|
||||
player.removePotionEffect(PotionEffectType.SLOW);
|
||||
|
||||
if (fishingPlayer.isSuccess()) {
|
||||
if (ConfigManager.rodLoseDurability) loseDurability(player);
|
||||
Location location = event.getHook().getLocation();
|
||||
@@ -421,12 +480,19 @@ public class FishingManager extends Function {
|
||||
|
||||
public void onReelIn(PlayerFishEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (ConfigManager.disableBar) {
|
||||
noBarLavaReelIn(event);
|
||||
return;
|
||||
}
|
||||
//in fishing
|
||||
FishingPlayer fishingPlayer = fishingPlayerCache.remove(player);
|
||||
if (fishingPlayer != null) {
|
||||
proceedReelIn(event, player, fishingPlayer);
|
||||
bobberTaskCache.remove(player);
|
||||
return;
|
||||
}
|
||||
//not in fishing
|
||||
BobberCheckTask bobberCheckTask = bobberTaskCache.get(player);
|
||||
if (bobberCheckTask != null && bobberCheckTask.isHooked()) {
|
||||
showPlayerBar(player, nextLoot.get(player));
|
||||
@@ -500,7 +566,7 @@ public class FishingManager extends Function {
|
||||
if (itemStack.getType() == Material.AIR) return;
|
||||
Entity item = location.getWorld().dropItem(location, itemStack);
|
||||
Vector vector = player.getLocation().subtract(location).toVector().multiply(0.1);
|
||||
vector = vector.setY((vector.getY()+0.25) * 1.2);
|
||||
vector = vector.setY((vector.getY()+0.18) * 1.15);
|
||||
item.setVelocity(vector);
|
||||
if (isDouble) {
|
||||
Entity item2 = location.getWorld().dropItem(location, itemStack);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# don't change
|
||||
config-version: '11'
|
||||
config-version: '12'
|
||||
|
||||
# chinese/english/spanish
|
||||
lang: english
|
||||
@@ -48,6 +48,10 @@ worlds:
|
||||
|
||||
# Mechanic settings
|
||||
mechanics:
|
||||
|
||||
# Disable the fishing bar totally
|
||||
disable-bar-mechanic: false
|
||||
|
||||
other-loots:
|
||||
# Should other loots have the same fishing mechanic CustomFishing provides
|
||||
# 其他战利品是否有插件提供的钓鱼特性
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# Fish got from command can't be sold! Only those from fishing would have special price NBT tags
|
||||
|
||||
container-title: '<gradient:#A52A2A:#800000:#A52A2A>Sell Fish</gradient>'
|
||||
|
||||
rows: 6
|
||||
|
||||
Reference in New Issue
Block a user