9
0
mirror of https://github.com/Xiao-MoMi/Custom-Fishing.git synced 2025-12-29 03:49:07 +00:00

rename entity & optimize market

This commit is contained in:
XiaoMoMi
2023-09-11 04:24:05 +08:00
parent c878ec7c4a
commit 2068a3b178
35 changed files with 196 additions and 129 deletions

View File

@@ -33,7 +33,7 @@ public abstract class CustomFishingPlugin extends JavaPlugin {
protected LootManager lootManager;
protected FishingManager fishingManager;
protected EffectManager effectManager;
protected MobManager mobManager;
protected EntityManager entityManager;
protected BlockManager blockManager;
protected AdventureManager adventure;
protected BagManager bagManager;
@@ -87,8 +87,8 @@ public abstract class CustomFishingPlugin extends JavaPlugin {
return blockManager;
}
public MobManager getMobManager() {
return mobManager;
public EntityManager getEntityManager() {
return entityManager;
}
public ItemManager getItemManager() {

View File

@@ -18,15 +18,15 @@
package net.momirealms.customfishing.api.manager;
import net.momirealms.customfishing.api.mechanic.loot.Loot;
import net.momirealms.customfishing.api.mechanic.mob.MobLibrary;
import net.momirealms.customfishing.api.mechanic.entity.EntityLibrary;
import org.bukkit.Location;
public interface MobManager {
boolean registerMobLibrary(MobLibrary mobLibrary);
public interface EntityManager {
boolean registerEntityLibrary(EntityLibrary entityLibrary);
boolean unregisterMobLibrary(String lib);
boolean unregisterEntityLibrary(String lib);
boolean unregisterMobLibrary(MobLibrary mobLibrary);
boolean unregisterEntityLibrary(EntityLibrary entityLibrary);
void summonMob(Location hookLocation, Location playerLocation, Loot loot);
void summonEntity(Location hookLocation, Location playerLocation, Loot loot);
}

View File

@@ -11,7 +11,7 @@ import java.util.Map;
public class GlobalSettings {
public static HashMap<ActionTrigger, Action[]> lootActions = new HashMap<>();
public static HashMap<ActionTrigger, Action[]> itemActions = new HashMap<>();
public static HashMap<ActionTrigger, Action[]> rodActions = new HashMap<>();
public static HashMap<ActionTrigger, Action[]> baitActions = new HashMap<>();
@@ -21,7 +21,7 @@ public class GlobalSettings {
if (entry.getValue() instanceof ConfigurationSection inner) {
HashMap<ActionTrigger, Action[]> map = CustomFishingPlugin.get().getActionManager().getActionMap(inner);
switch (entry.getKey()) {
case "loot" -> lootActions = map;
case "item" -> itemActions = map;
case "rod" -> rodActions = map;
case "bait" -> baitActions = map;
}
@@ -30,13 +30,13 @@ public class GlobalSettings {
}
public static void unload() {
lootActions.clear();
itemActions.clear();
rodActions.clear();
baitActions.clear();
}
public static void triggerLootActions(ActionTrigger trigger, Condition condition) {
Action[] actions = lootActions.get(trigger);
public static void triggerItemActions(ActionTrigger trigger, Condition condition) {
Action[] actions = itemActions.get(trigger);
if (actions != null) {
for (Action action : actions) {
action.trigger(condition);

View File

@@ -15,13 +15,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customfishing.api.mechanic.mob;
package net.momirealms.customfishing.api.mechanic.entity;
import java.util.Map;
public class MobConfig implements MobSettings {
public class EntityConfig implements EntitySettings {
private String mob;
private String entity;
private double horizontalVector;
private double verticalVector;
private Map<String, Object> propertyMap;
@@ -43,8 +43,8 @@ public class MobConfig implements MobSettings {
}
@Override
public String getMobID() {
return mob;
public String getEntityID() {
return entity;
}
@Override
@@ -54,14 +54,14 @@ public class MobConfig implements MobSettings {
public static class Builder {
private final MobConfig config;
private final EntityConfig config;
public Builder() {
this.config = new MobConfig();
this.config = new EntityConfig();
}
public Builder mobID(String value) {
this.config.mob = value;
public Builder entityID(String value) {
this.config.entity = value;
return this;
}
@@ -85,7 +85,7 @@ public class MobConfig implements MobSettings {
return this;
}
public MobConfig build() {
public EntityConfig build() {
return config;
}
}

View File

@@ -15,16 +15,16 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customfishing.api.mechanic.mob;
package net.momirealms.customfishing.api.mechanic.entity;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import java.util.Map;
public interface MobLibrary {
public interface EntityLibrary {
String identification();
Entity spawn(Location location, String id, Map<String, Object> mobPropertyMap);
Entity spawn(Location location, String id, Map<String, Object> propertyMap);
}

View File

@@ -15,18 +15,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package net.momirealms.customfishing.api.mechanic.mob;
package net.momirealms.customfishing.api.mechanic.entity;
import java.util.Map;
public interface MobSettings {
public interface EntitySettings {
boolean isPersist();
double getHorizontalVector();
double getVerticalVector();
String getMobID();
String getEntityID();
Map<String, Object> getPropertyMap();
}

View File

@@ -19,8 +19,8 @@ package net.momirealms.customfishing.api.mechanic.loot;
public enum LootType {
LOOT,
MOB,
ITEM,
ENTITY,
BLOCK,
GLOBAL
}