9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-27 02:49:17 +00:00
This commit is contained in:
XiaoMoMi
2023-09-25 22:25:30 +08:00
parent 2c69d7e2a5
commit 194b8851d2
5 changed files with 48 additions and 28 deletions

View File

@@ -45,7 +45,6 @@ public class BattlePassHook implements Listener {
register();
}
private static class BPFishingQuest extends ActionQuestExecutor {
public BPFishingQuest(JavaPlugin plugin) {
super(plugin, "customfishing");

View File

@@ -365,7 +365,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: message-nearby");
return null;
return EmptyAction.instance;
}
});
registerAction("random-message", (args, chance) -> {
@@ -435,7 +435,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: command-nearby");
return null;
return EmptyAction.instance;
}
});
}
@@ -491,7 +491,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: command-nearby");
return null;
return EmptyAction.instance;
}
});
}
@@ -573,7 +573,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: hologram");
return null;
return EmptyAction.instance;
}
});
}
@@ -591,7 +591,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: item-amount");
return null;
return EmptyAction.instance;
}
});
}
@@ -612,8 +612,8 @@ public class ActionManagerImpl implements ActionManager {
}
};
} else {
LogUtils.warn("Illegal value format found at action: item-durability");
return null;
LogUtils.warn("Illegal value format found at action: durability");
return EmptyAction.instance;
}
});
}
@@ -630,7 +630,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: give-item");
return null;
return EmptyAction.instance;
}
});
}
@@ -656,8 +656,8 @@ public class ActionManagerImpl implements ActionManager {
);
};
} else {
LogUtils.warn("Illegal value format found at action: hologram");
return null;
LogUtils.warn("Illegal value format found at action: fake-item");
return EmptyAction.instance;
}
});
}
@@ -747,7 +747,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: title");
return null;
return EmptyAction.instance;
}
});
registerAction("title-nearby", (args, chance) -> {
@@ -781,7 +781,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: title-nearby");
return null;
return EmptyAction.instance;
}
});
registerAction("random-title", (args, chance) -> {
@@ -804,7 +804,7 @@ public class ActionManagerImpl implements ActionManager {
};
} else {
LogUtils.warn("Illegal value format found at action: random-title");
return null;
return EmptyAction.instance;
}
});
}
@@ -821,9 +821,10 @@ public class ActionManagerImpl implements ActionManager {
if (Math.random() > chance) return;
condition.getPlayer().addPotionEffect(potionEffect);
};
} else {
LogUtils.warn("Illegal value format found at action: potion-effect");
return EmptyAction.instance;
}
LogUtils.warn("Illegal value format found at action: potion-effect");
return null;
});
}
@@ -852,9 +853,10 @@ public class ActionManagerImpl implements ActionManager {
if (Math.random() > chance) return;
AdventureManagerImpl.getInstance().sendSound(condition.getPlayer(), sound);
};
} else {
LogUtils.warn("Illegal value format found at action: sound");
return EmptyAction.instance;
}
LogUtils.warn("Illegal value format found at action: sound");
return null;
});
}
@@ -871,14 +873,14 @@ public class ActionManagerImpl implements ActionManager {
return;
}
}
if (actions != null)
for (Action action : actions) {
action.trigger(condition);
}
for (Action action : actions) {
action.trigger(condition);
}
};
} else {
LogUtils.warn("Illegal value format found at action: conditional");
return EmptyAction.instance;
}
LogUtils.warn("Illegal value format found at action: conditional");
return null;
});
}
@@ -910,9 +912,10 @@ public class ActionManagerImpl implements ActionManager {
return;
}
};
} else {
LogUtils.warn("Illegal value format found at action: priority");
return EmptyAction.instance;
}
LogUtils.warn("Illegal value format found at action: conditional");
return null;
});
}
@@ -928,8 +931,10 @@ public class ActionManagerImpl implements ActionManager {
it.addXp(condition.getPlayer(), target, exp);
}, () -> LogUtils.warn("Plugin (" + pluginName + "'s) level is not compatible. Please double check if it's a problem caused by pronunciation."));
};
} else {
LogUtils.warn("Illegal value format found at action: plugin-exp");
return EmptyAction.instance;
}
return null;
});
}
@@ -950,4 +955,18 @@ public class ActionManagerImpl implements ActionManager {
};
});
}
private void registerTempEffectAction() {
registerAction("temp-effects", (args, chance) -> {
if (args instanceof ConfigurationSection section) {
return condition -> {
if (Math.random() > chance) return;
};
} else {
LogUtils.warn("Illegal value format found at action: temp-effects");
return EmptyAction.instance;
}
});
}
}

View File

@@ -233,6 +233,8 @@ public class ItemManagerImpl implements ItemManager, Listener {
@NotNull
@Override
public String getAnyPluginItemID(ItemStack itemStack) {
if (itemStack == null || itemStack.getType() == Material.AIR)
return "AIR";
for (String plugin : CFConfig.itemDetectOrder) {
ItemLibrary itemLibrary = itemLibraryMap.get(plugin);
if (itemLibrary != null) {