diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/model/EffectData.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/model/EffectData.java deleted file mode 100644 index 48e74e738..000000000 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/model/EffectData.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * SoulFire - * Copyright (C) 2024 AlexProgrammerDE - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.soulfiremc.server.protocol.bot.model; - -import com.soulfiremc.server.data.EffectType; - -public record EffectData( - EffectType effect, - int amplifier, - int duration, - boolean ambient, - boolean showParticles, - boolean showIcon, - boolean blend) {} diff --git a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/EntityEffectState.java b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/EntityEffectState.java index e9181f145..156ae3fa4 100644 --- a/server/src/main/java/com/soulfiremc/server/protocol/bot/state/EntityEffectState.java +++ b/server/src/main/java/com/soulfiremc/server/protocol/bot/state/EntityEffectState.java @@ -18,7 +18,6 @@ package com.soulfiremc.server.protocol.bot.state; import com.soulfiremc.server.data.EffectType; -import com.soulfiremc.server.protocol.bot.model.EffectData; import lombok.AllArgsConstructor; import lombok.Data; import lombok.Getter; @@ -30,7 +29,7 @@ @Data public class EntityEffectState { - private final Map effects = new HashMap<>(); + private final Map effects = new HashMap<>(); public void updateEffect( EffectType effect, @@ -42,7 +41,7 @@ public void updateEffect( boolean blend) { effects.put( effect, - new InternalEffectState(amplifier, ambient, showParticles, showIcon, blend, duration)); + new EffectState(effect, amplifier, ambient, showParticles, showIcon, blend, duration)); } public void removeEffect(EffectType effect) { @@ -53,26 +52,8 @@ public boolean hasEffect(EffectType effect) { return effects.containsKey(effect); } - public Optional getEffect(EffectType effect) { - var state = effects.get(effect); - - if (state == null) { - return Optional.empty(); - } - - return Optional.of( - new EffectData( - effect, - state.amplifier(), - state.duration(), - state.ambient(), - state.showParticles(), - state.showIcon(), - state.blend())); - } - - public int getEffectAmplifier(EffectType effect) { - return getEffect(effect).map(EffectData::amplifier).orElse(0); + public Optional getEffect(EffectType effect) { + return Optional.ofNullable(effects.get(effect)); } public void tick() { @@ -82,7 +63,8 @@ public void tick() { @Getter @Setter @AllArgsConstructor - public static class InternalEffectState { + public static class EffectState { + private final EffectType effect; private final int amplifier; private final boolean ambient; private final boolean showParticles;