diff --git a/Bootstrap/Spigot/src/main/java/cz/neumimto/rpg/SpigotRpgBootstrap.java b/Bootstrap/Spigot/src/main/java/cz/neumimto/rpg/SpigotRpgBootstrap.java index e745c15c5..93f3381bc 100644 --- a/Bootstrap/Spigot/src/main/java/cz/neumimto/rpg/SpigotRpgBootstrap.java +++ b/Bootstrap/Spigot/src/main/java/cz/neumimto/rpg/SpigotRpgBootstrap.java @@ -28,7 +28,6 @@ ) @DependsOn( value = { - @Dependency("EffectLib"), @Dependency("ProtocolLib") } ) diff --git a/Common/src/main/java/cz/neumimto/rpg/common/AbstractRpg.java b/Common/src/main/java/cz/neumimto/rpg/common/AbstractRpg.java index 733e542ef..a25b8646d 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/AbstractRpg.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/AbstractRpg.java @@ -257,10 +257,10 @@ public void init(Path workingDirPath, Object commandManager, try { for (RpgAddon addon : rpgAddons) { - bindings.putAll(addon.getBindings()); - Map map = new HashMap<>(); - map.put("WORKINGDIR", workingDirPath.toAbsolutePath().toString()); - providers = addon.getProviders(map); //TODO something definitely wrong with this + bindings.putAll(addon.getBindings()); + Map map = new HashMap<>(); + map.put("WORKINGDIR", workingDirPath.toAbsolutePath().toString()); + providers = addon.getProviders(map); //TODO something definitely wrong with this } injector = Guice.createInjector(fnInjProv.apply(bindings, providers)); } catch (Exception e) { diff --git a/Common/src/main/java/cz/neumimto/rpg/common/ResourceManagerImpl.java b/Common/src/main/java/cz/neumimto/rpg/common/ResourceManagerImpl.java index 08ae00890..a5cbaef1b 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/ResourceManagerImpl.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/ResourceManagerImpl.java @@ -8,11 +8,9 @@ import cz.neumimto.rpg.api.effects.IGlobalEffect; import cz.neumimto.rpg.api.effects.model.EffectModelFactory; import cz.neumimto.rpg.api.effects.model.EffectModelMapper; -import cz.neumimto.rpg.api.localization.Localization; import cz.neumimto.rpg.api.localization.LocalizationService; import cz.neumimto.rpg.api.logging.Log; import cz.neumimto.rpg.api.scripting.IRpgScriptEngine; -import cz.neumimto.rpg.api.services.ILocalization; import cz.neumimto.rpg.api.services.IPropertyContainer; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.api.skills.SkillService; @@ -24,10 +22,10 @@ import javax.inject.Inject; import java.io.*; import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.*; +import java.util.Locale; +import java.util.Map; +import java.util.Properties; +import java.util.ServiceLoader; import java.util.stream.Stream; import static cz.neumimto.rpg.api.logging.Log.info; diff --git a/Common/src/main/java/cz/neumimto/rpg/common/assets/AssetService.java b/Common/src/main/java/cz/neumimto/rpg/common/assets/AssetService.java index 893a44505..f8051b35c 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/assets/AssetService.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/assets/AssetService.java @@ -3,7 +3,6 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.nio.file.Paths; public abstract class AssetService { @@ -41,6 +40,7 @@ public void copyDefaultClasses(Path path) { copyToFileIfMissing("defaults/classes/races/Elf.conf", path.resolve("races/Rogue.conf")); copyToFileIfMissing("defaults/classes/races/Human.conf", path.resolve("races/Human.conf")); } + private Path tempDirectory; public Path getTempWorkingDir() { diff --git a/Common/src/main/java/cz/neumimto/rpg/common/commands/AdminCommands.java b/Common/src/main/java/cz/neumimto/rpg/common/commands/AdminCommands.java index d170bed50..38b5b564e 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/commands/AdminCommands.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/commands/AdminCommands.java @@ -120,7 +120,7 @@ public void addExperiencesCommand(CommandIssuer executor, OnlineOtherPlayer targ @Subcommand("skill") @CommandCompletion("@skilltree @nothing @skillskctx") - public void adminExecuteSkillCommand(IActiveCharacter character, SkillTree tree, int level, ISkill skill) { + public void adminExecuteSkillCommand(IActiveCharacter character, SkillTree tree, int level, ISkill skill) { long e = System.nanoTime(); commandExecuteSkill(character, tree, skill, level); if (Rpg.get().getPluginConfig().DEBUG.isBalance()) { @@ -130,7 +130,7 @@ public void adminExecuteSkillCommand(IActiveCharacter character, SkillTree tree, @Subcommand("cast-skill-as") @CommandCompletion("@skilltree @nothing @skillskctx") - public void adminExecuteSkillCommandAs(OnlineOtherPlayer executor, SkillTree tree, int level, ISkill skill) { + public void adminExecuteSkillCommandAs(OnlineOtherPlayer executor, SkillTree tree, int level, ISkill skill) { commandExecuteSkill(executor.character, tree, skill, level); } @@ -424,7 +424,7 @@ public void commandAddUniqueSkillpoint(IActiveCharacter character, String classT if (result.isOk()) { characterService.putInSaveQueue(character.getCharacterBase()); } else { - Log.warn("Character " + character.getUUID() + " could not gain unique sp ClassType: " + classType + " " +result.getMessage()); + Log.warn("Character " + character.getUUID() + " could not gain unique sp ClassType: " + classType + " " + result.getMessage()); } } } diff --git a/Common/src/main/java/cz/neumimto/rpg/common/commands/CharacterCommandFacade.java b/Common/src/main/java/cz/neumimto/rpg/common/commands/CharacterCommandFacade.java index bb8ec7f00..d725305db 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/commands/CharacterCommandFacade.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/commands/CharacterCommandFacade.java @@ -159,6 +159,7 @@ public void openSKillTreeMenu(IActiveCharacter character, ClassDefinition classD private static class CommandSyncCallback implements Runnable { private final IActiveCharacter character; private CharacterCommandFacade facade; + private CommandSyncCallback(IActiveCharacter character, CharacterCommandFacade facade) { this.character = character; this.facade = facade; diff --git a/Common/src/main/java/cz/neumimto/rpg/common/configuration/SkillTreeLoaderImpl.java b/Common/src/main/java/cz/neumimto/rpg/common/configuration/SkillTreeLoaderImpl.java index 37ac3eb0e..056a45c45 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/configuration/SkillTreeLoaderImpl.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/configuration/SkillTreeLoaderImpl.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.configuration; import com.google.inject.Injector; @@ -101,7 +99,7 @@ public void loadAsciiMaps(Config config, SkillTree skillTree) { try { ConfigList asciiMap = config.getList("AsciiMap"); - int length = ((ConfigList)asciiMap.get(0)).size(); + int length = ((ConfigList) asciiMap.get(0)).size(); int rows = asciiMap.size(); short[][] array = new short[rows][length]; int i = 0; @@ -119,7 +117,8 @@ public void loadAsciiMaps(Config config, SkillTree skillTree) { ISkillTreeInterfaceModel guiModelByCharacter = skillService.getGuiModelByCharacter(c1.charAt(0)); if (guiModelByCharacter != null) { array[i][j] = guiModelByCharacter.getId(); - } if (MathUtils.isNumeric(c1)) { + } + if (MathUtils.isNumeric(c1)) { array[i][j] = Short.parseShort(c1); } j++; @@ -393,7 +392,8 @@ private void loadSkill(SkillTree skillTree, Config c, SkillData info) { } Log.warn("Skill Upgrade for " + info.getSkillName() + " missing SkillId, skipping"); } - } catch (ConfigException missing) {} + } catch (ConfigException missing) { + } try { List preprocessors = c.getObjectList("CastConditions"); @@ -485,7 +485,7 @@ private SkillData getSkillInfo(String id, SkillTree tree) { private SkillData createSkillInfo(SkillTree tree, String lowercased) { - ISkill skill = Rpg.get().getSkillService().getSkillById(lowercased.replaceAll("\"","")); + ISkill skill = Rpg.get().getSkillService().getSkillById(lowercased.replaceAll("\"", "")); if (skill == null) { throw new InvalidSkillTreeException("Could not find a skill " + lowercased + " referenced in the skilltree " + tree.getId()); } diff --git a/Common/src/main/java/cz/neumimto/rpg/common/effects/AbstractEffectService.java b/Common/src/main/java/cz/neumimto/rpg/common/effects/AbstractEffectService.java index 7043ce344..ac218f084 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/effects/AbstractEffectService.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/effects/AbstractEffectService.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.effects; import cz.neumimto.rpg.api.Rpg; @@ -167,7 +165,7 @@ public boolean addEffect(T effect, IEffectSourceProvider eff @Override public boolean addEffect(T effect, IEffectSourceProvider effectSourceProvider, IEntity entitySource) { IEffectContainer eff = effect.getConsumer().getEffect(effect.getName()); - if (Rpg.get().getPluginConfig().DEBUG.isDevelop()) { + if (Rpg.get().getPluginConfig().DEBUG.isDevelop()) { IEffectConsumer consumer1 = effect.getConsumer(); if (consumer1 instanceof IActiveCharacter) { IActiveCharacter chara = (IActiveCharacter) consumer1; @@ -393,7 +391,8 @@ public void purgeEffectCache() { for (IEffect iEffect : effectSet) { try { iEffect.onRemove(iEffect); - } catch (Throwable t){} + } catch (Throwable t) { + } } effectSet.clear(); pendingAdditions.clear(); diff --git a/Common/src/main/java/cz/neumimto/rpg/common/effects/core/DefaultManaRegeneration.java b/Common/src/main/java/cz/neumimto/rpg/common/effects/core/DefaultManaRegeneration.java index 9ebc001eb..5f612999f 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/effects/core/DefaultManaRegeneration.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/effects/core/DefaultManaRegeneration.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.effects.core; import cz.neumimto.rpg.api.Rpg; diff --git a/Common/src/main/java/cz/neumimto/rpg/common/entity/parties/PartyServiceImpl.java b/Common/src/main/java/cz/neumimto/rpg/common/entity/parties/PartyServiceImpl.java index 3198a7237..9b322b2ae 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/entity/parties/PartyServiceImpl.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/entity/parties/PartyServiceImpl.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.entity.parties; diff --git a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/AbstractCharacterService.java b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/AbstractCharacterService.java index 8d083d4bb..225d52a5d 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/AbstractCharacterService.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/AbstractCharacterService.java @@ -1,4 +1,3 @@ - package cz.neumimto.rpg.common.entity.players; import cz.neumimto.rpg.api.IRpgElement; @@ -667,7 +666,6 @@ public void upgradeSkill(T character, PlayerSkillContext playerSkillContext, ISk } - /** * @param character * @param skill diff --git a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/ActiveCharacter.java b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/ActiveCharacter.java index 7edb166b2..ee08bb3cf 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/ActiveCharacter.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/ActiveCharacter.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.entity.players; import cz.neumimto.rpg.api.Rpg; @@ -308,7 +306,7 @@ public Map getCooldowns() { @Override public boolean hasCooldown(String thing) { - return cooldowns.getOrDefault(thing,0L) > System.currentTimeMillis(); + return cooldowns.getOrDefault(thing, 0L) > System.currentTimeMillis(); } private void mergeWeapons(ClassDefinition g) { diff --git a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/CharacterMana.java b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/CharacterMana.java index d7e1d37ec..178b4545c 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/CharacterMana.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/CharacterMana.java @@ -33,7 +33,7 @@ public double getMaxValue() { @Override public void setMaxValue(double f) { - character.setProperty(CommonProperties.max_mana, f); + character.setProperty(CommonProperties.max_mana, f); } @Override diff --git a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/PreloadCharacter.java b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/PreloadCharacter.java index f4e6ce3b6..c91fafb1f 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/entity/players/PreloadCharacter.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/entity/players/PreloadCharacter.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.entity.players; import cz.neumimto.rpg.api.Rpg; diff --git a/Common/src/main/java/cz/neumimto/rpg/common/persistance/dao/ClassDefinitionDao.java b/Common/src/main/java/cz/neumimto/rpg/common/persistance/dao/ClassDefinitionDao.java index 21229a303..6a7de913c 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/persistance/dao/ClassDefinitionDao.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/persistance/dao/ClassDefinitionDao.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.persistance.dao; import com.electronwill.nightconfig.core.Config; @@ -44,7 +42,6 @@ public Path getClassDirectory() { } - public Set parseClassFiles(Path path) { Set set = new HashSet<>(); try { @@ -86,7 +83,7 @@ private Map preloadClassDefs(Path path, Set set) Map map = new HashMap<>(); Files.walk(path) - .filter(f -> Files.isRegularFile(f) || (Files.isSymbolicLink(f) && ! Files.isDirectory(f))) + .filter(f -> Files.isRegularFile(f) || (Files.isSymbolicLink(f) && !Files.isDirectory(f))) .forEach(p -> { info("Preloading class definition file " + p.getFileName()); diff --git a/Common/src/main/java/cz/neumimto/rpg/common/scripting/DummyScriptEngine.java b/Common/src/main/java/cz/neumimto/rpg/common/scripting/DummyScriptEngine.java index 93e14fee0..d707783d4 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/scripting/DummyScriptEngine.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/scripting/DummyScriptEngine.java @@ -1,6 +1,6 @@ package cz.neumimto.rpg.common.scripting; -public class DummyScriptEngine extends AbstractRpgScriptEngine{ +public class DummyScriptEngine extends AbstractRpgScriptEngine { @Override public void prepareEngine() { diff --git a/Common/src/main/java/cz/neumimto/rpg/common/scripting/GraalVmScriptEngine.java b/Common/src/main/java/cz/neumimto/rpg/common/scripting/GraalVmScriptEngine.java index c14f074d0..256544934 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/scripting/GraalVmScriptEngine.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/scripting/GraalVmScriptEngine.java @@ -11,13 +11,10 @@ import cz.neumimto.rpg.common.utils.Java12FieldUtils; import org.graalvm.polyglot.*; import org.graalvm.polyglot.impl.AbstractPolyglotImpl; -import sun.misc.Unsafe; -import javax.script.ScriptEngineManager; import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.nio.file.Path; import java.util.*; import java.util.function.Function; @@ -179,7 +176,9 @@ public SkillResult init(IActiveCharacter caster, PlayerSkillContext context) { public interface ScriptLib { Map getSkillHandlers(); + List getGlobalEffects(); + List getEventListeners(); } diff --git a/Common/src/main/java/cz/neumimto/rpg/common/skills/reagents/ISkillCastMechanic.java b/Common/src/main/java/cz/neumimto/rpg/common/skills/reagents/ISkillCastMechanic.java index 8519c5768..eab348dfc 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/skills/reagents/ISkillCastMechanic.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/skills/reagents/ISkillCastMechanic.java @@ -7,13 +7,15 @@ public interface ISkillCastMechanic { - default SkillResult processBefore(IActiveCharacter character, PlayerSkillContext context){ + default SkillResult processBefore(IActiveCharacter character, PlayerSkillContext context) { return SkillResult.OK; } - default void processAfterSuccess(IActiveCharacter character, PlayerSkillContext context){} + default void processAfterSuccess(IActiveCharacter character, PlayerSkillContext context) { + } boolean isValidForContext(SkillData skillData); - default void notifyFailure(IActiveCharacter character, PlayerSkillContext context) {} + default void notifyFailure(IActiveCharacter character, PlayerSkillContext context) { + } } diff --git a/Common/src/main/java/cz/neumimto/rpg/common/skills/scripting/CustomSkillGenerator.java b/Common/src/main/java/cz/neumimto/rpg/common/skills/scripting/CustomSkillGenerator.java index d37c84190..498db3523 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/skills/scripting/CustomSkillGenerator.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/skills/scripting/CustomSkillGenerator.java @@ -21,7 +21,6 @@ import it.unimi.dsi.fastutil.objects.Object2DoubleOpenHashMap; import org.codehaus.janino.SimpleCompiler; - import javax.inject.Inject; import javax.inject.Singleton; import java.lang.annotation.Annotation; @@ -56,7 +55,7 @@ public Class generate(ScriptSkillModel scriptSkillModel, Class .addAnnotation(AnnotationSpec.builder(ResourceLoader.Skill.class).addMember("value", "$S", scriptSkillModel.getId()).build()); if (scriptSkillModel.getSuperType() == null) { - type.superclass(ParameterizedTypeName.get(ClassName.get(ActiveSkill.class), ClassName.get(characterClassImpl()))) + type.superclass(ParameterizedTypeName.get(ClassName.get(ActiveSkill.class), ClassName.get(characterClassImpl()))) .addModifiers(PUBLIC); type.addMethod(MethodSpec.methodBuilder("cast").addModifiers(PUBLIC) @@ -98,7 +97,7 @@ public Class generate(ScriptSkillModel scriptSkillModel, Class Class x = (Class) sc.getClassLoader().loadClass(packagee + "." + className); return x; - } catch (Exception e) { + } catch (Exception e) { e.printStackTrace(); } return null; @@ -111,8 +110,8 @@ private CodeBlock parseSkillMeta(ScriptSkillModel scriptSkillModel) { } if (scriptSkillModel.getSkillTypes() != null) { for (String skillType : scriptSkillModel.getSkillTypes()) { - Stream.of(SkillType.values()).filter(a->a.getId().equalsIgnoreCase(skillType)).findFirst() - .ifPresent(a-> builder.addStatement("addSkillType($T.$L)",SkillType.class, a.name().toUpperCase())); + Stream.of(SkillType.values()).filter(a -> a.getId().equalsIgnoreCase(skillType)).findFirst() + .ifPresent(a -> builder.addStatement("addSkillType($T.$L)", SkillType.class, a.name().toUpperCase())); } } @@ -126,6 +125,7 @@ private static class MethodHandler { final Method relevantMethod; final Class returnType; final String methodName; + private MethodHandler(Class mechanic, String fieldName, Method relevantMethod, Class returnType, String methodName) { this.mechanic = mechanic; this.fieldName = fieldName; @@ -150,6 +150,7 @@ static MethodHandler of(Object mechanic) { } } + private CodeBlock parseModel(ScriptSkillModel scriptSkillModel) { CodeBlock.Builder builder = CodeBlock.builder() .addStatement("$T caster = ($T) caster0", characterClassImpl(), characterClassImpl()) //janino cant handle generics @@ -313,7 +314,8 @@ private ParsedScript findLocalVarsAndFields(Config config) { try { parseLocalVarsAndFields(config, parsedScript); - } catch (Exception ignored) {} + } catch (Exception ignored) { + } if (config.contains("Mechanics")) { List list = config.get("Mechanics"); @@ -480,7 +482,7 @@ protected Object filterMechanicById(Config config) { if (type == null) { type = config.get("Target-Selector"); } - if (type!=null && type.startsWith("#")) { + if (type != null && type.startsWith("#")) { return null; } @@ -488,13 +490,14 @@ protected Object filterMechanicById(Config config) { } protected static class MechanicParams { - public Map methodArgs = new LinkedHashMap<>(); - public List consumed = new ArrayList<>(); + public Map methodArgs = new LinkedHashMap<>(); + public List consumed = new ArrayList<>(); public boolean available(String l) { return !consumed.contains(l); } } + protected MechanicParams filterMechanicParams(Object mechanic, String str) { Pattern compile = Pattern.compile("(([a-zA-Y]*)=([a-zA-Y]*)?((\\([^)]+\\))|'(.*?)')|([a-zA-Z=.]*))"); Matcher matcher = compile.matcher(str); diff --git a/Common/src/main/java/cz/neumimto/rpg/common/utils/GraalInstaller.java b/Common/src/main/java/cz/neumimto/rpg/common/utils/GraalInstaller.java index bbd84795a..83005e83e 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/utils/GraalInstaller.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/utils/GraalInstaller.java @@ -11,12 +11,12 @@ public class GraalInstaller { -//https://medium.com/graalvm/graalvms-javascript-engine-on-jdk11-with-high-performance-3e79f968a819 + //https://medium.com/graalvm/graalvms-javascript-engine-on-jdk11-with-high-performance-3e79f968a819 public static void downloadTo(Path root, Consumer callback) { var r = (Runnable) () -> { String version = "21.1.0"; - String[][] files = new String[][] { - {"https://repo1.maven.org/maven2/org/graalvm/sdk/graal-sdk/%s/graal-sdk-%s.jar","graal-sdk-%s.jar"}, + String[][] files = new String[][]{ + {"https://repo1.maven.org/maven2/org/graalvm/sdk/graal-sdk/%s/graal-sdk-%s.jar", "graal-sdk-%s.jar"}, {"https://repo1.maven.org/maven2/org/graalvm/js/js/%s/js-%s.jar", "graal-js-%s.jar"}, {"https://repo1.maven.org/maven2/org/graalvm/truffle/truffle-api/%s/truffle-api-%s.jar", "graal-truffle-api-%s.jar"}, {"https://repo1.maven.org/maven2/org/graalvm/regex/regex/%s/regex-%s.jar", "graal-regex-%s.jar"}, @@ -24,7 +24,8 @@ public static void downloadTo(Path root, Consumer callback) { }; try { - for (String[] file : files) {; + for (String[] file : files) { + ; String download = file[0].replaceAll("%s", version); Path target = root.resolve(file[1].replaceAll("%s", version)); callback.accept("Downloading " + download + " to " + target); diff --git a/Common/src/main/java/cz/neumimto/rpg/common/utils/ResourceClassLoader.java b/Common/src/main/java/cz/neumimto/rpg/common/utils/ResourceClassLoader.java index 8c3a2744f..a6552fe9b 100644 --- a/Common/src/main/java/cz/neumimto/rpg/common/utils/ResourceClassLoader.java +++ b/Common/src/main/java/cz/neumimto/rpg/common/utils/ResourceClassLoader.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.common.utils; import java.net.URL; diff --git a/Common/src/main/resources/assets/nt-rpg/defaults/skilltrees/magetree.conf b/Common/src/main/resources/assets/nt-rpg/defaults/skilltrees/magetree.conf index 8982839b4..4f104ae51 100644 --- a/Common/src/main/resources/assets/nt-rpg/defaults/skilltrees/magetree.conf +++ b/Common/src/main/resources/assets/nt-rpg/defaults/skilltrees/magetree.conf @@ -4,7 +4,7 @@ AsciiMap: [[".",".","12",".",".",".",".","."],[".",".","^",".",".",".",".","."], Skills: [ { - SkillId: "ntrpg:lightning" + SkillId: "ntrpg:lightningstrike" Name: "Lightningbolt" SkillTreeId: 1 Icon: "minecraft:iron_ingot" diff --git a/Implementations/Spigot/build.gradle b/Implementations/Spigot/build.gradle index 12ca88888..ad0b21eef 100644 --- a/Implementations/Spigot/build.gradle +++ b/Implementations/Spigot/build.gradle @@ -41,7 +41,7 @@ dependencies { compileOnly project(':Bootstrap-Common') - // api 'com.github.stefvanschie.inventoryframework:IF:' + project.if + // api 'com.github.stefvanschie.inventoryframework:IF:' + project.if // runtimeOnly fileTree(dir: 'lib', include: '*.jar') @@ -50,17 +50,17 @@ dependencies { compileOnly "org.spigotmc:spigot-api:" + project.spigotapi - compileOnly ("org.spigotmc:plugin-annotations:" + project.pluginannotations){ + compileOnly("org.spigotmc:plugin-annotations:" + project.pluginannotations) { exclude group: "org.bukkit", module: "bukkit" } - compileOnly ("com.comphenix.protocol:ProtocolLib:" + project.protocollib) { + compileOnly("com.comphenix.protocol:ProtocolLib:" + project.protocollib) { exclude group: "com.comphenix.executors", module: "BukkitExecutors" } //runtimeOnly 'com.github.dmulloy2:ProtocolLib:master' - compileOnly 'com.github.Slikey:EffectLib:' + project.effectlib - // compileOnly 'placeholderapi.me.clip:placeholderapi:' + project.papi + api 'com.elmakers.mine.bukkit:EffectLib:' + project.effectlib + // compileOnly 'placeholderapi.me.clip:placeholderapi:' + project.papi compileOnly 'com.gmail.filoghost.holographicdisplays:holographicdisplays-api:' + project.hdisplays compileOnly "co.aikar:acf-paper:" + project.acf @@ -75,7 +75,7 @@ dependencies { compileOnly 'com.gitlab.SamB440:RPGRegions-2:' + project.rpgregions - testImplementation ('com.github.NeumimTo:MockBukkit:e92bb7bbd1') { + testImplementation('com.github.NeumimTo:MockBukkit:e92bb7bbd1') { exclude group: "org.spigotmc", module: "spigot-api" exclude group: "org.jetbrains", module: "annotations" } @@ -86,7 +86,7 @@ shadowJar { archiveFileName = "NT-RPG-Spigot-16.x-${p_spigot_version}.jar" relocate 'com.electronwill', 'rpgshaded.com.electronwill' - //todo relocate 'com.github.stefvanschie', 'rpgshaded.com.github.stefvanschie' + //todo relocate 'com.github.stefvanschie', 'rpgshaded.com.github.stefvanschie' relocate 'com.google.inject', 'rpgshaded.com.google.inject' relocate 'com.squareup.javapoet', 'rpgshaded.com.squareup.javapoet' relocate 'com.typesafe.config', 'rpgshaded.com.typesafe.config' @@ -94,7 +94,7 @@ shadowJar { relocate 'net.bytebuddy', 'rpgshaded.net.bytebuddy' relocate 'org.aopalliance', 'rpgshaded.org.aopalliance' relocate 'org.codehaus', 'rpgshaded.org.codehaus' - + relocate 'de.slikey.effectlib', 'rpgshaded.de.slikey.effectlib' relocate 'de.tr7zw', 'rpgshaded.de.tr7zw' diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/Resourcepack.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/Resourcepack.java index 729164dfa..8c9a93af9 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/Resourcepack.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/Resourcepack.java @@ -12,7 +12,6 @@ import org.bukkit.inventory.meta.ItemMeta; import java.util.concurrent.ThreadLocalRandom; -import java.util.function.Function; public class Resourcepack { @@ -52,18 +51,19 @@ public class Resourcepack { public static ItemStack ICICLE_06; public static ItemStack ICICLE_07; private static ItemStack[] icicles; + public static void init() { SLASH_01 = tag(Material.LAPIS_LAZULI, 2457); - ICICLE_01 = tag(Material.STICK,12350); - ICICLE_02 = tag(Material.STICK,12351); - ICICLE_03 = tag(Material.STICK,12352); - ICICLE_04 = tag(Material.STICK,12353); - ICICLE_05 = tag(Material.STICK,12354); - ICICLE_06 = tag(Material.STICK,12355); - ICICLE_07 = tag(Material.STICK,12356); + ICICLE_01 = tag(Material.STICK, 12350); + ICICLE_02 = tag(Material.STICK, 12351); + ICICLE_03 = tag(Material.STICK, 12352); + ICICLE_04 = tag(Material.STICK, 12353); + ICICLE_05 = tag(Material.STICK, 12354); + ICICLE_06 = tag(Material.STICK, 12355); + ICICLE_07 = tag(Material.STICK, 12356); - icicles = new ItemStack[] {ICICLE_01, ICICLE_02, ICICLE_03, ICICLE_04, ICICLE_05, ICICLE_06, ICICLE_07}; + icicles = new ItemStack[]{ICICLE_01, ICICLE_02, ICICLE_03, ICICLE_04, ICICLE_05, ICICLE_06, ICICLE_07}; } public static ItemStack randomIcicle() { @@ -80,7 +80,6 @@ private static ItemStack tag(Material material, int tag) { } - public static ArmorStand summonArmorStand(Location location) { World world = location.getWorld(); ArmorStand entity = (ArmorStand) world.spawnEntity(location, EntityType.ARMOR_STAND); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpg.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpg.java index 2be0088a3..ccebfb86a 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpg.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpg.java @@ -119,7 +119,7 @@ public void doImplSpecificreload() { ServiceLoader.load(ConfigurableInventoryGui.class, getClass().getClassLoader()) .stream() .map(ServiceLoader.Provider::get) - .forEach(a-> { + .forEach(a -> { try { injector.injectMembers(a); a.clearCache(); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpgPlugin.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpgPlugin.java index 64f7f788a..f3d08444d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpgPlugin.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/SpigotRpgPlugin.java @@ -1,6 +1,9 @@ package cz.neumimto.rpg.spigot; -import co.aikar.commands.*; +import co.aikar.commands.ACFBukkitUtil; +import co.aikar.commands.CommandIssuer; +import co.aikar.commands.CommandManager; +import co.aikar.commands.InvalidCommandArgument; import com.google.auto.service.AutoService; import com.google.inject.Injector; import cz.neumimto.FireworkHandler; @@ -29,6 +32,7 @@ import cz.neumimto.rpg.spigot.gui.SpellbookListener; import cz.neumimto.rpg.spigot.gui.SpigotGui; import cz.neumimto.rpg.spigot.gui.SpigotGuiHelper; +import cz.neumimto.rpg.spigot.gui.SpigotSkillTreeViewModel; import cz.neumimto.rpg.spigot.listeners.skillbinds.OnKeyPress; import cz.neumimto.rpg.spigot.packetwrapper.PacketHandler; import cz.neumimto.rpg.spigot.resources.SpigotGuiceModule; @@ -44,7 +48,6 @@ import org.bukkit.scheduler.BukkitScheduler; import org.jetbrains.annotations.NotNull; - import java.io.File; import java.nio.file.Path; import java.util.Collection; @@ -66,7 +69,7 @@ public static JavaPlugin getInstance() { public static final ExecutorService executor = Executors.newFixedThreadPool(5); //Disable inventories due to nbtapi - public static boolean testEnv ; + public static boolean testEnv; private File dataFolder; private static Injector injector; @@ -76,8 +79,8 @@ public static Injector getInjector() { @NotNull public File getDataFolder() { - return dataFolder; - } + return dataFolder; + } @Override public void enable(Data data) { @@ -163,7 +166,7 @@ public void enable(Data data) { mme.init(injector.getInstance(SpigotEntityService.class)); Bukkit.getPluginManager().registerEvents(mme, getInstance()); } - + if (Bukkit.getPluginManager().isPluginEnabled("RPGRegions")) { Log.info("RPGRegions installed - registering experience extension"); RpgRegionsClassExpReward.init(); @@ -224,6 +227,7 @@ public void enable(Data data) { Rpg.get().registerListeners(injector.getInstance(OnKeyPress.class)); PacketHandler.init(); + new SpigotSkillTreeViewModel(); //just to call static block }); if (!testEnv) { @@ -247,7 +251,6 @@ public static EffectManager getEffectManager() { } - public void disable() { executor.shutdown(); CharacterService characterService = Rpg.get().getCharacterService(); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/assets/SpigotAssetService.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/assets/SpigotAssetService.java index ea065818a..bb6bb95a4 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/assets/SpigotAssetService.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/assets/SpigotAssetService.java @@ -60,9 +60,9 @@ public void copyDefaultGuis(Path workingDir) { ServiceLoader.load(ConfigurableInventoryGui.class, getClass().getClassLoader()) .stream() .map(ServiceLoader.Provider::get) - .forEach(a->{ + .forEach(a -> { String fileName = a.getFileName(); - copyToFileIfMissing("gui/"+fileName, root.resolve(fileName)); + copyToFileIfMissing("gui/" + fileName, root.resolve(fileName)); }); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/HolographicDisplaysExpansion.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/HolographicDisplaysExpansion.java index b6ae280b4..32075b38e 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/HolographicDisplaysExpansion.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/HolographicDisplaysExpansion.java @@ -25,7 +25,6 @@ import org.bukkit.util.Vector; import javax.inject.Inject; -import javax.inject.Singleton; import java.util.HashMap; import java.util.Iterator; import java.util.Map; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mmoitems/MMOItemsExpansion.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mmoitems/MMOItemsExpansion.java index e924d0a54..4be82358a 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mmoitems/MMOItemsExpansion.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mmoitems/MMOItemsExpansion.java @@ -7,7 +7,6 @@ import cz.neumimto.rpg.api.entity.players.classes.PlayerClassData; import cz.neumimto.rpg.api.items.ItemService; import cz.neumimto.rpg.api.skills.ISkill; -import cz.neumimto.rpg.spigot.bridges.mmoitems.MMOItemWrapperFactory; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import cz.neumimto.rpg.spigot.entities.players.SpigotCharacterService; import cz.neumimto.rpg.spigot.events.character.SpigotCharacterGainedLevelEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mythicalmobs/MythicalMobsExpansion.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mythicalmobs/MythicalMobsExpansion.java index 59d470d5b..829ce1762 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mythicalmobs/MythicalMobsExpansion.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/bridges/mythicalmobs/MythicalMobsExpansion.java @@ -1,7 +1,6 @@ package cz.neumimto.rpg.spigot.bridges.mythicalmobs; import com.google.inject.Injector; -import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.common.entity.AbstractEntityService; import cz.neumimto.rpg.common.entity.configuration.MobSettingsDao; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/commands/SpigotCharacterCommands.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/commands/SpigotCharacterCommands.java index a28cc50d5..2115348f7 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/commands/SpigotCharacterCommands.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/commands/SpigotCharacterCommands.java @@ -1,8 +1,10 @@ package cz.neumimto.rpg.spigot.commands; import co.aikar.commands.BaseCommand; -import co.aikar.commands.annotation.*; +import co.aikar.commands.annotation.CommandAlias; import co.aikar.commands.annotation.Optional; +import co.aikar.commands.annotation.Private; +import co.aikar.commands.annotation.Subcommand; import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.configuration.AttributeConfig; import cz.neumimto.rpg.api.entity.players.IActiveCharacter; @@ -22,7 +24,9 @@ import javax.inject.Inject; import javax.inject.Singleton; -import java.util.*; +import java.util.Map; +import java.util.Stack; +import java.util.UUID; @Singleton @CommandAlias("char|c") @@ -72,7 +76,7 @@ public void spellbookCommit(Player executor) { ISpigotCharacter character = characterService.getCharacter(executor); int i = 27; - String[][] persisted = new String[character.getSpellbook().length -1][character.getSpellbook()[0].length -1]; + String[][] persisted = new String[character.getSpellbook().length - 1][character.getSpellbook()[0].length - 1]; for (int w = 0; w < character.getSpellbook().length; w++) { ItemStack[] page = character.getSpellbook()[w]; @@ -118,7 +122,7 @@ public void back(Player executor, @Optional String arg) { list.pop(); if (!list.empty()) { Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotRpgPlugin.getInstance(), - () -> Bukkit.dispatchCommand(executor, list.pop()), + () -> Bukkit.dispatchCommand(executor, list.pop()), 1L); } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/damage/SpigotDamageService.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/damage/SpigotDamageService.java index 48776c56b..0c6bc5df2 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/damage/SpigotDamageService.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/damage/SpigotDamageService.java @@ -43,7 +43,7 @@ public SpigotDamageService() { @Override public void damageEntity(ISpigotEntity entity, double value) { entity.getEntity().damage(value); - //todo workaround bukkit stupidity entity.setLastDamageCause + //todo workaround bukkit stupidity entity.setLastDamageCause } @Override diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/BleedingEffect.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/BleedingEffect.java index c219f866b..65d217ee2 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/BleedingEffect.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/BleedingEffect.java @@ -3,15 +3,11 @@ import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.effects.EffectBase; import cz.neumimto.rpg.api.effects.IEffect; -import cz.neumimto.rpg.api.entity.IEffectConsumer; import cz.neumimto.rpg.api.entity.IEntity; -import cz.neumimto.rpg.spigot.SpigotRpgPlugin; import de.slikey.effectlib.effect.BleedEffect; -import de.slikey.effectlib.util.DynamicLocation; import de.slikey.effectlib.util.RandomUtils; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; public class BleedingEffect extends EffectBase { @@ -21,6 +17,7 @@ public class BleedingEffect extends EffectBase { private double damage; private BleedEffect effect; private LivingEntity livingEntity; + public BleedingEffect(IEntity consumer, long duration, long period, double damage) { super(name, consumer); setDuration(duration); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/FireResistanceEffect.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/FireResistanceEffect.java index 0b7d1722f..b504e2958 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/FireResistanceEffect.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/FireResistanceEffect.java @@ -2,7 +2,6 @@ import cz.neumimto.rpg.api.effects.EffectBase; import cz.neumimto.rpg.api.effects.IEffect; -import cz.neumimto.rpg.api.entity.CommonProperties; import cz.neumimto.rpg.api.entity.IEffectConsumer; public class FireResistanceEffect extends EffectBase { @@ -20,7 +19,6 @@ public void onApply(IEffect self) { } - @Override public void onRemove(IEffect self) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/ManaShieldEffect.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/ManaShieldEffect.java index a85732aa6..4f5b6f18b 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/ManaShieldEffect.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/ManaShieldEffect.java @@ -1,6 +1,5 @@ package cz.neumimto.rpg.spigot.effects.common; -import com.google.common.collect.ImmutableSet; import cz.neumimto.rpg.api.effects.*; import cz.neumimto.rpg.api.entity.IEffectConsumer; import cz.neumimto.rpg.api.skills.scripting.JsBinding; @@ -26,6 +25,7 @@ public class ManaShieldEffect extends EffectBase implements IEffectConta public static Vector[] circle; public static Particle.DustOptions dustOptions; + static { circle = VectorUtils.circle(new Vector[30], 2); dustOptions = new Particle.DustOptions(Color.fromRGB(66, 120, 245), 1); @@ -45,7 +45,7 @@ public double getMultiplier() { @Override public void onTick(IEffect self) { - tickCount ++; + tickCount++; display(tickCount); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/Rage.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/Rage.java index 510f93f2d..4980432da 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/Rage.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/Rage.java @@ -22,6 +22,7 @@ public class Rage extends EffectBase { public static Set removeTypes; RageEffect rageEffect; + static { removeTypes = new HashSet<>(); removeTypes.add(CommonEffectTypes.SLOW); @@ -63,11 +64,11 @@ public void onRun() { loc = getTarget(); display(Particle.CLOUD, - loc.clone().add(Math.cos(it), Math.sin(it) +1, Math.sin(it)), + loc.clone().add(Math.cos(it), Math.sin(it) + 1, Math.sin(it)), Color.RED); display(Particle.REDSTONE, - loc.clone().add(Math.cos(it + Math.PI), Math.sin(it) +1, Math.sin(it + Math.PI)), + loc.clone().add(Math.cos(it + Math.PI), Math.sin(it) + 1, Math.sin(it + Math.PI)), Color.BLACK); } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBar.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBar.java index 4ecef1073..c46c071bd 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBar.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBar.java @@ -4,6 +4,8 @@ public interface ManaBar { String name = "ManaBar"; + void notifyManaChange(); + IEffect asEffect(); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBarText.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBarText.java index c03f18976..e5bd36da5 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBarText.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/effects/common/def/ManaBarText.java @@ -60,7 +60,7 @@ public void onTick(IEffect self) { double percentage = MathUtils.getPercentage(character.getMana().getValue(), character.getMana().getMaxValue()); percentage = percentage > 100 ? 100 : percentage; percentage = percentage < 0 ? 0 : percentage; - BaseComponent[] stringg = ROWS[(int)Math.round(percentage / 5)]; + BaseComponent[] stringg = ROWS[(int) Math.round(percentage / 5)]; player.spigot().sendMessage(ChatMessageType.ACTION_BAR, stringg); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/ProjectileCache.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/ProjectileCache.java index c146ef501..9b2fbc28f 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/ProjectileCache.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/ProjectileCache.java @@ -8,7 +8,6 @@ import java.util.Map; import java.util.WeakHashMap; -import java.util.function.BiConsumer; import java.util.function.Consumer; public class ProjectileCache { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/ISpigotCharacter.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/ISpigotCharacter.java index d17a71f78..98896a61c 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/ISpigotCharacter.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/ISpigotCharacter.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.List; import java.util.Map; import java.util.Stack; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotCharacter.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotCharacter.java index 100b0ced3..8ff0d1e68 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotCharacter.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotCharacter.java @@ -13,7 +13,9 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -import java.util.*; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; public class SpigotCharacter extends ActiveCharacter implements ISpigotCharacter { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotPreloadCharacter.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotPreloadCharacter.java index 342b6f917..4a5df053f 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotPreloadCharacter.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/entities/players/SpigotPreloadCharacter.java @@ -131,5 +131,4 @@ public String getPlayerAccountName() { } - } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterManaRegainEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterManaRegainEvent.java index b3096cfcd..e4e6f53af 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterManaRegainEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterManaRegainEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.character; import cz.neumimto.rpg.api.IRpgElement; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillLearnAttemptEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillLearnAttemptEvent.java index 62a8655d2..ca203cd20 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillLearnAttemptEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillLearnAttemptEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.character; import cz.neumimto.rpg.api.events.character.CharacterSkillLearnAttemptEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillRefundAttemptEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillRefundAttemptEvent.java index f0677bf72..f8828c150 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillRefundAttemptEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillRefundAttemptEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.character; import cz.neumimto.rpg.api.events.character.CharacterSkillRefundAttemptEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillUpgradeEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillUpgradeEvent.java index 630ccc70f..82eae31a7 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillUpgradeEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotCharacterSkillUpgradeEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.character; import cz.neumimto.rpg.api.events.character.CharacterSkillUpgradeEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotEventCharacterArmorPostUpdate.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotEventCharacterArmorPostUpdate.java index affb40e16..dd67932b1 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotEventCharacterArmorPostUpdate.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/character/SpigotEventCharacterArmorPostUpdate.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.character; import cz.neumimto.rpg.api.events.character.EventCharacterArmorPostUpdate; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotHealEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotHealEvent.java index 9e277066e..d59b2a9e8 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotHealEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotHealEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.skill; import cz.neumimto.rpg.api.IRpgElement; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPostUsageEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPostUsageEvent.java index 7cb20092f..bcfd908a3 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPostUsageEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPostUsageEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.skill; import cz.neumimto.rpg.api.entity.IEntity; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPreUsageEvent.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPreUsageEvent.java index ff438118e..7fedf771f 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPreUsageEvent.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/events/skill/SpigotSkillPreUsageEvent.java @@ -1,5 +1,3 @@ - - package cz.neumimto.rpg.spigot.events.skill; import cz.neumimto.rpg.api.entity.IEntity; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/ItemLoreFactory.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/ItemLoreFactory.java index 1fca930e3..5dad6aa6e 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/ItemLoreFactory.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/ItemLoreFactory.java @@ -87,7 +87,8 @@ public List toLore(AttributeConfig attributeConfig, int base, int curren for (Map.Entry e : propBonus.entrySet()) { String nameById = propertyService.getNameById(e.getKey()); Float value = e.getValue(); - list.add(line(" " + ChatColor.WHITE + nameById.replaceAll("_", " ") + " " + formatPropertyValue(value)));; + list.add(line(" " + ChatColor.WHITE + nameById.replaceAll("_", " ") + " " + formatPropertyValue(value))); + ; } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpellbookListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpellbookListener.java index 855112e49..76db94a1c 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpellbookListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpellbookListener.java @@ -159,6 +159,7 @@ private static class State { private Map sorted; private Map icons; + public State(Map sorted) { icons = new HashMap<>(); this.sorted = sorted; @@ -166,7 +167,6 @@ public State(Map sorted) { } - @EventHandler public void onInventoryClose(InventoryCloseEvent event) { Inventory inventory = event.getInventory(); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGui.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGui.java index 3b58c9f67..58ca3e526 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGui.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGui.java @@ -2,12 +2,10 @@ import com.github.stefvanschie.inventoryframework.gui.type.ChestGui; import cz.neumimto.rpg.api.Rpg; -import cz.neumimto.rpg.api.configuration.AttributeConfig; import cz.neumimto.rpg.api.effects.EffectService; import cz.neumimto.rpg.api.effects.EffectStatusType; import cz.neumimto.rpg.api.effects.IEffect; import cz.neumimto.rpg.api.effects.IEffectContainer; -import cz.neumimto.rpg.api.entity.players.IActiveCharacter; import cz.neumimto.rpg.api.entity.players.classes.ClassDefinition; import cz.neumimto.rpg.api.entity.players.classes.PlayerClassData; import cz.neumimto.rpg.api.gui.IPlayerMessage; @@ -25,7 +23,6 @@ import cz.neumimto.rpg.spigot.effects.common.def.ManaBarText; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import cz.neumimto.rpg.spigot.gui.inventoryviews.*; -import net.Indyuce.mmoitems.api.interaction.weapon.Weapon; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.ChatMessageType; import net.md_5.bungee.api.chat.BaseComponent; @@ -55,7 +52,7 @@ public boolean isClientSideGui() { @Override public void sendCooldownMessage(ISpigotCharacter player, String message, double cooldown) { player.sendMessage(localizationService.translate(LocalizationKeys.ON_COOLDOWN, - Arg.arg("skill", message).with("time", String.format("%.2f",cooldown)))); + Arg.arg("skill", message).with("time", String.format("%.2f", cooldown)))); } @Override @@ -184,7 +181,7 @@ public void moveSkillTreeMenu(ISpigotCharacter character) { @Override public void displaySkillDetailsInventoryMenu(ISpigotCharacter character, SkillTree tree, String command) { - SpigotGuiHelper.createSkillDetailInventoryView(character, tree, tree.getSkillById(command)); + SpigotGuiHelper.createSkillDetailInventoryView(character, tree, tree.getSkillById(command)); } @Override diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGuiHelper.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGuiHelper.java index b68b5c1a5..200c4982a 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGuiHelper.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/SpigotGuiHelper.java @@ -3,7 +3,6 @@ import com.github.stefvanschie.inventoryframework.gui.type.ChestGui; import com.github.stefvanschie.inventoryframework.pane.StaticPane; import cz.neumimto.rpg.api.Rpg; -import cz.neumimto.rpg.api.configuration.AttributeConfig; import cz.neumimto.rpg.api.configuration.ItemString; import cz.neumimto.rpg.api.entity.players.IActiveCharacter; import cz.neumimto.rpg.api.entity.players.classes.ClassDefinition; @@ -70,21 +69,21 @@ public static void initInventories() { attributButtonSlots = new int[]{10, 11, 12, 13, 14, 15, 16, 36, 37, 38, 39, 40, 41, 42, 43, 45}; - damageTypeToItemStack.put(ENTITY_ATTACK, unclickableIcon(Material.STONE_SWORD, 354,"ENTITY_ATTACK")); - damageTypeToItemStack.put(ENTITY_SWEEP_ATTACK, unclickableIcon(Material.STONE_SWORD, 354,"ENTITY_SWEEP_ATTACK")); - damageTypeToItemStack.put(CONTACT, unclickableIcon(Material.CACTUS, 354,"CONTACT")); - damageTypeToItemStack.put(CUSTOM, unclickableIcon(Material.BARRIER, 354,"CUSTOM")); - damageTypeToItemStack.put(DROWNING, unclickableIcon(Material.WATER, 354,"DROWNING")); - damageTypeToItemStack.put(ENTITY_EXPLOSION, unclickableIcon(Material.TNT, 354,"ENTITY_EXPLOSION")); - damageTypeToItemStack.put(BLOCK_EXPLOSION, unclickableIcon(Material.TNT, 354,"BLOCK_EXPLOSION")); - damageTypeToItemStack.put(FALL, unclickableIcon(Material.IRON_BOOTS, 354,"FALL")); - damageTypeToItemStack.put(FIRE, unclickableIcon(Material.BLAZE_POWDER, 354,"FIRE")); - damageTypeToItemStack.put(STARVATION, unclickableIcon(Material.ROTTEN_FLESH, 354,"STARVATION")); - damageTypeToItemStack.put(LAVA, unclickableIcon(Material.LAVA, 354,"LAVA")); - damageTypeToItemStack.put(PROJECTILE, unclickableIcon(Material.TIPPED_ARROW, 354,"PROJECTILE")); - damageTypeToItemStack.put(VOID, unclickableIcon(Material.NETHER_PORTAL, 354,"VOID")); - damageTypeToItemStack.put(MAGIC, unclickableIcon(Material.ENCHANTED_BOOK, 354,"MAGIC")); - damageTypeToItemStack.put(LIGHTNING, unclickableIcon(Material.NETHER_STAR, 354,"LIGHTNING")); + damageTypeToItemStack.put(ENTITY_ATTACK, unclickableIcon(Material.STONE_SWORD, 354, "ENTITY_ATTACK")); + damageTypeToItemStack.put(ENTITY_SWEEP_ATTACK, unclickableIcon(Material.STONE_SWORD, 354, "ENTITY_SWEEP_ATTACK")); + damageTypeToItemStack.put(CONTACT, unclickableIcon(Material.CACTUS, 354, "CONTACT")); + damageTypeToItemStack.put(CUSTOM, unclickableIcon(Material.BARRIER, 354, "CUSTOM")); + damageTypeToItemStack.put(DROWNING, unclickableIcon(Material.WATER, 354, "DROWNING")); + damageTypeToItemStack.put(ENTITY_EXPLOSION, unclickableIcon(Material.TNT, 354, "ENTITY_EXPLOSION")); + damageTypeToItemStack.put(BLOCK_EXPLOSION, unclickableIcon(Material.TNT, 354, "BLOCK_EXPLOSION")); + damageTypeToItemStack.put(FALL, unclickableIcon(Material.IRON_BOOTS, 354, "FALL")); + damageTypeToItemStack.put(FIRE, unclickableIcon(Material.BLAZE_POWDER, 354, "FIRE")); + damageTypeToItemStack.put(STARVATION, unclickableIcon(Material.ROTTEN_FLESH, 354, "STARVATION")); + damageTypeToItemStack.put(LAVA, unclickableIcon(Material.LAVA, 354, "LAVA")); + damageTypeToItemStack.put(PROJECTILE, unclickableIcon(Material.TIPPED_ARROW, 354, "PROJECTILE")); + damageTypeToItemStack.put(VOID, unclickableIcon(Material.NETHER_PORTAL, 354, "VOID")); + damageTypeToItemStack.put(MAGIC, unclickableIcon(Material.ENCHANTED_BOOK, 354, "MAGIC")); + damageTypeToItemStack.put(LIGHTNING, unclickableIcon(Material.NETHER_STAR, 354, "LIGHTNING")); CACHED_MENU_TEMPLATES.clear(); CACHED_MENUS.clear(); @@ -497,12 +496,12 @@ public static void createSkillDetailInventoryView(ISpigotCharacter character, Sk Player player = character.getPlayer(); - ItemStack backButton = item(Material.PAPER, back,12345); + ItemStack backButton = item(Material.PAPER, back, 12345); SpigotSkillTreeViewModel model = character.getLastTimeInvokedSkillTreeView(); background.addItem(new GuiCommand( backButton, "skilltree view " + model.getViewedClass().getName(), - player),0,0); + player), 0, 0); if (skillData instanceof SkillPathData) { @@ -511,7 +510,7 @@ public static void createSkillDetailInventoryView(ISpigotCharacter character, Sk ItemStack of = new ItemStack(Material.PAPER); ItemMeta itemMeta = of.getItemMeta(); itemMeta.setDisplayName("Tier " + data.getTier()); - background.addItem(new Icon(of), 1,1); + background.addItem(new Icon(of), 1, 1); SkillService skillService = Rpg.get().getSkillService(); @@ -526,7 +525,7 @@ public static void createSkillDetailInventoryView(ISpigotCharacter character, Sk + String.format("%+d", entry.getValue()) + " | " + entry.getKey()); itemStack.setItemMeta(itemMeta1); - background.addItem(new Icon(itemStack),x,y); + background.addItem(new Icon(itemStack), x, y); x++; if (x % 8 == 0) { x = 1; @@ -538,7 +537,7 @@ public static void createSkillDetailInventoryView(ISpigotCharacter character, Sk } else { String type = skillData.getSkill().getDamageType(); if (type != null) { - background.addItem(new Icon(damageTypeToItemStack(EntityDamageEvent.DamageCause.valueOf(type))),1,1); + background.addItem(new Icon(damageTypeToItemStack(EntityDamageEvent.DamageCause.valueOf(type))), 1, 1); } int x = 1; @@ -546,7 +545,7 @@ public static void createSkillDetailInventoryView(ISpigotCharacter character, Sk List itemStacks = configurationToItemStacks(skillData); for (ItemStack itemStack : itemStacks) { - background.addItem(new Icon(itemStack),x,y); + background.addItem(new Icon(itemStack), x, y); x++; if (x % 8 == 0) { x = 1; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ArmorGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ArmorGuiView.java index 86d4d94cb..af2c4640c 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ArmorGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ArmorGuiView.java @@ -9,12 +9,9 @@ import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import cz.neumimto.rpg.spigot.entities.players.SpigotCharacterService; import cz.neumimto.rpg.spigot.gui.elements.GuiCommand; -import net.Indyuce.mmoitems.stat.Armor; import net.md_5.bungee.api.ChatColor; import org.bukkit.Material; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Entity; -import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/CharacterAttributesGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/CharacterAttributesGuiView.java index a45516050..4c1662f6f 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/CharacterAttributesGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/CharacterAttributesGuiView.java @@ -4,7 +4,6 @@ import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.configuration.AttributeConfig; -import cz.neumimto.rpg.api.entity.players.IActiveCharacter; import cz.neumimto.rpg.api.localization.Arg; import cz.neumimto.rpg.api.localization.LocalizationKeys; import cz.neumimto.rpg.api.localization.LocalizationService; @@ -134,7 +133,7 @@ private static void handleEvent(InventoryClickEvent event) { List lore = itemLoreFactory.toLore(aConfig, attributeValue + 1, transientVal); itemMeta.setLore(lore); event.getClickedInventory().setItem(slot, item); - attributesTransaction.compute(aConfig.getId(), (s, integer) -> integer == null ? 1 : integer +1); + attributesTransaction.compute(aConfig.getId(), (s, integer) -> integer == null ? 1 : integer + 1); } else if (click.isRightClick() && (baseValue == null || baseValue > 1) && (attributesTransaction.get(aConfig.getId()) == null || attributesTransaction.get(aConfig.getId()) > 0)) { List lore = itemLoreFactory.toLore(aConfig, attributeValue - 1, transientVal); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassArmorGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassArmorGuiView.java index 3d8e70171..2367ff6d1 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassArmorGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassArmorGuiView.java @@ -2,7 +2,6 @@ import com.github.stefvanschie.inventoryframework.gui.type.ChestGui; import com.google.auto.service.AutoService; -import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.classes.ClassService; import cz.neumimto.rpg.api.entity.players.classes.ClassDefinition; import cz.neumimto.rpg.api.items.ClassItem; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassAttributesGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassAttributesGuiView.java index 48484389e..2532fc539 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassAttributesGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassAttributesGuiView.java @@ -7,7 +7,6 @@ import cz.neumimto.rpg.api.configuration.AttributeConfig; import cz.neumimto.rpg.api.entity.PropertyService; import cz.neumimto.rpg.api.entity.players.classes.ClassDefinition; -import cz.neumimto.rpg.api.entity.players.classes.DependencyGraph; import cz.neumimto.rpg.api.localization.LocalizationKeys; import cz.neumimto.rpg.api.localization.LocalizationService; import cz.neumimto.rpg.spigot.gui.elements.GuiCommand; @@ -20,13 +19,15 @@ import javax.inject.Inject; import javax.inject.Singleton; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import static cz.neumimto.rpg.spigot.gui.ItemLoreFactory.header; import static cz.neumimto.rpg.spigot.gui.ItemLoreFactory.line; import static cz.neumimto.rpg.spigot.gui.SpigotGuiHelper.formatPropertyValue; -import static cz.neumimto.rpg.spigot.gui.SpigotGuiHelper.itemLoreFactory; @Singleton @AutoService(ConfigurableInventoryGui.class) @@ -83,9 +84,9 @@ public Map> getPaneData(CommandSender commandSender, St private List toList(Map a) { return a.entrySet().stream() - .filter(w->!w.getKey().isHidden()) + .filter(w -> !w.getKey().isHidden()) .sorted((o1, o2) -> o1.getKey().getName().compareToIgnoreCase(o2.getKey().getName())) - .map(w-> attributeConfigToItemStack(w.getKey(), w.getValue())) + .map(w -> attributeConfigToItemStack(w.getKey(), w.getValue())) .map(GuiCommand::new) .collect(Collectors.toList()); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassDepedenciesGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassDepedenciesGuiView.java index e0b075e7c..305862fa9 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassDepedenciesGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassDepedenciesGuiView.java @@ -5,22 +5,17 @@ import cz.neumimto.rpg.api.classes.ClassService; import cz.neumimto.rpg.api.entity.players.classes.ClassDefinition; import cz.neumimto.rpg.api.entity.players.classes.DependencyGraph; -import cz.neumimto.rpg.api.gui.Gui; -import cz.neumimto.rpg.api.items.ClassItem; import cz.neumimto.rpg.api.localization.LocalizationKeys; import cz.neumimto.rpg.api.localization.LocalizationService; import cz.neumimto.rpg.spigot.gui.elements.GuiCommand; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.inventory.ItemStack; import javax.inject.Inject; import javax.inject.Singleton; import java.util.*; import java.util.stream.Collectors; -import static cz.neumimto.rpg.spigot.gui.inventoryviews.WeaponGuiView.toItemStack; - @Singleton @AutoService(ConfigurableInventoryGui.class) public class ClassDepedenciesGuiView extends ConfigurableInventoryGui { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassTypesGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassTypesGuiView.java index 53c4cb965..e65537661 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassTypesGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassTypesGuiView.java @@ -8,10 +8,12 @@ import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; import javax.inject.Singleton; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @Singleton @AutoService(ConfigurableInventoryGui.class) @@ -44,7 +46,7 @@ public Map> getPaneData(CommandSender commandSender) { for (Map.Entry e : cTypes.entrySet()) { String primaryColor = e.getValue().getPrimaryColor(); ChatColor c = ChatColor.valueOf(primaryColor.toUpperCase()); - guiCommands.add(new GuiCommand(i(Material.CRAFTING_TABLE, e.getValue().getModelId(),c,e.getKey()), "ninfo classes " + e.getKey())); + guiCommands.add(new GuiCommand(i(Material.CRAFTING_TABLE, e.getValue().getModelId(), c, e.getKey()), "ninfo classes " + e.getKey())); } map.put("ClassType", guiCommands); @@ -52,7 +54,7 @@ public Map> getPaneData(CommandSender commandSender) { } public static ChestGui get() { - return cachedGui; + return cachedGui; } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassesByTypeGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassesByTypeGuiView.java index 42a87250a..776771290 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassesByTypeGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ClassesByTypeGuiView.java @@ -10,7 +10,10 @@ import javax.inject.Inject; import javax.inject.Singleton; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @Singleton @AutoService(ConfigurableInventoryGui.class) @@ -56,8 +59,8 @@ public Map> getPaneData(CommandSender commandSender, St Map> map = new HashMap<>(); List list = new ArrayList<>(); classService.getClassDefinitions().stream() - .filter(a->a.getClassType().equalsIgnoreCase(type)) - .forEach(a->{ + .filter(a -> a.getClassType().equalsIgnoreCase(type)) + .forEach(a -> { ItemStack is = CharacterGuiView.classDefinitionToItemStack(a); list.add(new GuiCommand(is, "ninfo class " + a.getName())); }); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ConfigurableInventoryGui.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ConfigurableInventoryGui.java index 00d3935fc..4c414f247 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ConfigurableInventoryGui.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/ConfigurableInventoryGui.java @@ -82,7 +82,6 @@ protected ChestGui createPane(GuiConfig guiConfig, CommandSender commandSender, ChestGui chestGui = new ChestGui(6, title); - char[] alphabet = "abcdefghijklmnopqrstuvwxyz".toCharArray(); int alphabetidx = 0; List actualContent = new ArrayList<>(); @@ -94,7 +93,8 @@ protected ChestGui createPane(GuiConfig guiConfig, CommandSender commandSender, StringBuilder stringBuilder = new StringBuilder(); for (char slot : row.toCharArray()) { - a: for (Map.Entry> content : dataIt.entrySet()) { + a: + for (Map.Entry> content : dataIt.entrySet()) { String replaceKey = content.getKey(); //classType Iterator value = content.getValue(); for (GuiConfig.MaskConfig maskConfig : guiConfig.mask) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/GuiHelper.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/GuiHelper.java index 70ae14f0d..c9b6db1e3 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/GuiHelper.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/GuiHelper.java @@ -53,7 +53,7 @@ static ItemStack i(Material material, Integer model) { } static ItemStack i(String material, String model) { - return i(Material.matchMaterial(material), model == null ? null : Integer.parseInt(model)); + return i(Material.matchMaterial(material), model == null ? null : Integer.parseInt(model)); } static ItemStack i(Material material, int model, ChatColor nameColor, String itemName) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/WeaponGuiView.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/WeaponGuiView.java index eee465e7f..d433f6f65 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/WeaponGuiView.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/gui/inventoryviews/WeaponGuiView.java @@ -3,7 +3,6 @@ import com.github.stefvanschie.inventoryframework.gui.type.ChestGui; import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.Rpg; -import cz.neumimto.rpg.api.entity.players.CharacterService; import cz.neumimto.rpg.api.items.RpgItemType; import cz.neumimto.rpg.api.localization.LocalizationKeys; import cz.neumimto.rpg.api.localization.LocalizationService; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotInventoryService.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotInventoryService.java index c45992b1b..aa3a8f266 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotInventoryService.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotInventoryService.java @@ -1,7 +1,6 @@ package cz.neumimto.rpg.spigot.inventory; import com.google.inject.Injector; -import cz.neumimto.rpg.api.entity.players.IActiveCharacter; import cz.neumimto.rpg.api.inventory.ManagedSlot; import cz.neumimto.rpg.api.inventory.RpgInventory; import cz.neumimto.rpg.api.items.RpgItemStack; @@ -10,7 +9,6 @@ import cz.neumimto.rpg.common.inventory.AbstractInventoryService; import cz.neumimto.rpg.common.inventory.InventoryHandler; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; -import cz.neumimto.rpg.spigot.gui.SpigotGuiHelper; import cz.neumimto.rpg.spigot.gui.inventoryviews.ConfigurableInventoryGui; import cz.neumimto.rpg.spigot.persistance.SpigotEquipedSlot; import de.tr7zw.nbtapi.NBTItem; @@ -139,7 +137,7 @@ public void rotatePlayerSpellbook(Player player, ISpigotCharacter character) { page = 0; } ItemStack[] itemStacks = character.getSpellbook()[page]; - for (int i = 0; i < itemStacks.length -1; i++) { + for (int i = 0; i < itemStacks.length - 1; i++) { ItemStack item = player.getInventory().getItem(i); if (item == null || item.getType() == Material.AIR) { player.getInventory().setItem(i, itemStacks[i]); @@ -159,6 +157,9 @@ public void invalidateGUICaches(ISpigotCharacter cc) { UUID uniqueId = cc.getEntity().getUniqueId(); ServiceLoader.load(ConfigurableInventoryGui.class, getClass().getClassLoader()).stream() - .map(ServiceLoader.Provider::get).forEach(a->{injector.injectMembers(a);a.clearCache(uniqueId);}); + .map(ServiceLoader.Provider::get).forEach(a -> { + injector.injectMembers(a); + a.clearCache(uniqueId); + }); } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotItemService.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotItemService.java index 0e535f85f..43cd5b1c8 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotItemService.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/inventory/SpigotItemService.java @@ -87,7 +87,7 @@ protected Optional createRpgItemType(ItemString parsed, ItemClass w @Override public Set getAllItemIds() { return Stream.of(Material.values()) - .filter(a->!a.isLegacy()) + .filter(a -> !a.isLegacy()) .map(Material::getKey) .map(NamespacedKey::toString) .collect(Collectors.toSet()); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SkillListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SkillListener.java index 5192f3284..8f8253f98 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SkillListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SkillListener.java @@ -5,7 +5,6 @@ import cz.neumimto.rpg.api.effects.EffectType; import cz.neumimto.rpg.api.entity.IReservable; import cz.neumimto.rpg.api.events.damage.DamageIEntityEarlyEvent; -import cz.neumimto.rpg.api.events.damage.IEntityWeaponDamageEarlyEvent; import cz.neumimto.rpg.spigot.effects.SpigotEffectService; import cz.neumimto.rpg.spigot.effects.common.ManaShieldEffect; import cz.neumimto.rpg.spigot.effects.common.Rage; @@ -14,12 +13,9 @@ import cz.neumimto.rpg.spigot.events.damage.SpigotEntityProjectileDamageEarlyEvent; import cz.neumimto.rpg.spigot.events.damage.SpigotEntitySkillDamageEarlyEvent; import cz.neumimto.rpg.spigot.events.damage.SpigotEntityWeaponDamageEarlyEvent; -import cz.neumimto.rpg.spigot.events.damage.SpigotEntityWeaponDamageLateEvent; import cz.neumimto.rpg.spigot.services.IRpgListener; -import cz.neumimto.rpg.spigot.skills.ManaShield; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotComboListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotComboListener.java index 6273721e7..33e9664aa 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotComboListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotComboListener.java @@ -10,7 +10,6 @@ import cz.neumimto.rpg.spigot.services.IRpgListener; import org.bukkit.GameMode; import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.player.PlayerDropItemEvent; import org.bukkit.event.player.PlayerInteractEntityEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotDamageListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotDamageListener.java index ae8632586..4e4de6bdb 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotDamageListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotDamageListener.java @@ -28,7 +28,6 @@ import org.bukkit.block.Block; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.ProjectileHitEvent; @@ -116,6 +115,9 @@ public void onEntityDamageEarly(EntityDamageByEntityEvent event) { processProjectileDamageEarly(event, attacker, target, projectile); } } else { + if (!(attackerEntity instanceof LivingEntity)) { + return; + } attacker = entityService.get((LivingEntity) attackerEntity); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotEntityLifecycleListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotEntityLifecycleListener.java index f28b89563..d70275a4b 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotEntityLifecycleListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotEntityLifecycleListener.java @@ -18,7 +18,6 @@ import org.bukkit.World; import org.bukkit.entity.*; import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotInventoryListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotInventoryListener.java index c118e67d0..244476d2d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotInventoryListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/SpigotInventoryListener.java @@ -36,7 +36,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; -import org.bukkit.event.Listener; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/skillbinds/OnKeyPress.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/skillbinds/OnKeyPress.java index 05ef95b50..27b37e6b2 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/skillbinds/OnKeyPress.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/listeners/skillbinds/OnKeyPress.java @@ -1,8 +1,5 @@ package cz.neumimto.rpg.spigot.listeners.skillbinds; -import cz.neumimto.rpg.api.Rpg; -import cz.neumimto.rpg.api.gui.Gui; -import cz.neumimto.rpg.api.localization.LocalizationKeys; import cz.neumimto.rpg.api.localization.LocalizationService; import cz.neumimto.rpg.api.skills.SkillService; import cz.neumimto.rpg.common.commands.SkillsCommandFacade; @@ -10,7 +7,6 @@ import cz.neumimto.rpg.spigot.entities.players.SpigotCharacterService; import cz.neumimto.rpg.spigot.inventory.SpigotInventoryService; import de.tr7zw.nbtapi.NBTItem; -import io.lumine.xikage.mythicmobs.skills.mechanics.SendToastMechanic; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/PacketHandler.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/PacketHandler.java index 64ef63071..e2df43edc 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/PacketHandler.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/PacketHandler.java @@ -1,6 +1,5 @@ package cz.neumimto.rpg.spigot.packetwrapper; -import com.comphenix.protocol.PacketType; import com.comphenix.protocol.wrappers.EnumWrappers; import com.comphenix.protocol.wrappers.Pair; import com.comphenix.protocol.wrappers.WrappedDataWatcher; @@ -12,7 +11,6 @@ import org.bukkit.Location; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitRunnable; @@ -55,7 +53,7 @@ public static AbstractPacket riptide(LivingEntity entity) { metadata.setEntityId(entity.getEntityId()); WrappedDataWatcher dataWatcher = new WrappedDataWatcher(metadata.getEntityMetadata()); - dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x04 )); + dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x04)); metadata.setEntityMetadata(dataWatcher.getWatchableObjects()); return metadata; @@ -66,7 +64,7 @@ public static AbstractPacket riptide(LivingEntity entity) { metadata.setEntityId(entity.getEntityId()); WrappedDataWatcher dataWatcher = new WrappedDataWatcher(metadata.getEntityMetadata()); - dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x01 )); + dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(7, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x01)); metadata.setEntityMetadata(dataWatcher.getWatchableObjects()); return metadata; @@ -86,7 +84,8 @@ private LinkedList _spawn(Location location, ItemStack itemStack WrapperPlayServerEntityMetadata metadata = new WrapperPlayServerEntityMetadata(); metadata.setEntityId(spawn.getEntityID()); - metadata.setEntityMetadata(fillMetadata(metadata));; + metadata.setEntityMetadata(fillMetadata(metadata)); + ; WrapperPlayServerEntityLook rotation = new WrapperPlayServerEntityLook(); rotation.setEntityID(spawn.getEntityID()); @@ -109,7 +108,7 @@ private LinkedList _spawn(Location location, ItemStack itemStack private List fillMetadata(WrapperPlayServerEntityMetadata metadata) { WrappedDataWatcher dataWatcher = new WrappedDataWatcher(metadata.getEntityMetadata()); - dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x20 )); //invis + dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x20)); //invis return dataWatcher.getWatchableObjects(); } @@ -152,9 +151,9 @@ public static void destroy(List entityIds, Collection public static int randomGroundIcicle(Location location, List packets) { WrapperPlayServerSpawnEntityLiving spawn = new WrapperPlayServerSpawnEntityLiving(); spawn.setEntityID(ThreadLocalRandom.current().nextInt(Integer.MAX_VALUE)); - spawn.setX(location.getX() + ThreadLocalRandom.current().nextInt(100)/100); + spawn.setX(location.getX() + ThreadLocalRandom.current().nextInt(100) / 100); spawn.setY(location.getY()); - spawn.setZ(location.getZ() + ThreadLocalRandom.current().nextInt(100)/100); + spawn.setZ(location.getZ() + ThreadLocalRandom.current().nextInt(100) / 100); spawn.getHandle().getIntegers().write(1, 1); packets.add(spawn); @@ -162,7 +161,7 @@ public static int randomGroundIcicle(Location location, List pac metadata.setEntityId(spawn.getEntityID()); WrappedDataWatcher dataWatcher = new WrappedDataWatcher(metadata.getEntityMetadata()); - dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x20 )); //invis + dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(0, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x20)); //invis dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(14, WrappedDataWatcher.Registry.get(Byte.class)), (byte) (0x01 | 0x08 | 0x10)); //isSmall, noBasePlate, set Marker metadata.setEntityMetadata(dataWatcher.getWatchableObjects()); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerAnimation.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerAnimation.java index 93fdf32d9..d1fde521b 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerAnimation.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerAnimation.java @@ -8,7 +8,6 @@ import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; import org.bukkit.World; import org.bukkit.entity.Entity; -import org.bukkit.entity.Player; public class WrapperPlayServerAnimation extends AbstractPacket { public static final PacketType TYPE = PacketType.Play.Server.ANIMATION; @@ -31,6 +30,7 @@ public static class Animations extends IntEnum { /** * Retrieve an instance of the Animation enum. + * * @return Animation enum. */ public static Animations getInstance() { @@ -45,6 +45,7 @@ public WrapperPlayServerAnimation() { /** * Retrieve the player ID. + * * @return The current EID */ public int getEntityID() { @@ -53,6 +54,7 @@ public int getEntityID() { /** * Set the player ID. + * * @param value - new value. */ public void setEntityID(int value) { @@ -61,6 +63,7 @@ public void setEntityID(int value) { /** * Retrieve the player's entity object. + * * @param world - the word the player has joined. * @return The player's entity. */ @@ -70,6 +73,7 @@ public Entity getEntity(World world) { /** * Retrieve the player's entity object. + * * @param event - the packet event. * @return The player's entity. */ @@ -79,8 +83,9 @@ public Entity getEntity(PacketEvent event) { /** * Retrieve animation ID. - * @see {@link WrapperPlayServerAnimation.Animations}. + * * @return The current Animation + * @see {@link WrapperPlayServerAnimation.Animations}. */ public int getAnimation() { return handle.getIntegers().read(1); @@ -88,8 +93,9 @@ public int getAnimation() { /** * Set animation ID. - * @see {@link WrapperPlayServerAnimation.Animations}. + * * @param value - new value. + * @see {@link WrapperPlayServerAnimation.Animations}. */ public void setAnimation(int value) { handle.getIntegers().write(1, value); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityDestroy.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityDestroy.java index ec2befc07..37d0d51a1 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityDestroy.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityDestroy.java @@ -17,13 +17,13 @@ * 02111-1307 USA */ -import java.util.List; - import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketContainer; import com.google.common.primitives.Ints; import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; +import java.util.List; + public class WrapperPlayServerEntityDestroy extends AbstractPacket { public static final PacketType TYPE = PacketType.Play.Server.ENTITY_DESTROY; @@ -38,6 +38,7 @@ public WrapperPlayServerEntityDestroy(PacketContainer packet) { /** * Retrieve the IDs of the entities that will be destroyed. + * * @return The current entities. */ public List getEntities() { @@ -46,6 +47,7 @@ public List getEntities() { /** * Set the entities that will be destroyed. + * * @param value - new value. */ public void setEntities(int[] entities) { @@ -54,6 +56,7 @@ public void setEntities(int[] entities) { /** * Set the entities that will be destroyed. + * * @param value - new value. */ public void setEntities(List entities) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityEquipment.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityEquipment.java index 139623381..3c848ea6a 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityEquipment.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityEquipment.java @@ -2,30 +2,29 @@ * PacketWrapper - ProtocolLib wrappers for Minecraft packets * Copyright (C) dmulloy2 * Copyright (C) Kristian S. Strangeland - * + *

* 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 cz.neumimto.rpg.spigot.packetwrapper; -import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; - import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.wrappers.EnumWrappers.ItemSlot; import com.comphenix.protocol.wrappers.Pair; +import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.inventory.ItemStack; @@ -115,9 +114,12 @@ public ItemSlot getSlot() { if (MINOR_VERSION >= 16) { final List> slots = handle.getSlotStackPairLists().read(0); switch (slots.size()) { - case 0: return null; - case 1: return slots.get(0).getFirst(); - default: throw new UnsupportedOperationException("This packet has multiple slots specified"); + case 0: + return null; + case 1: + return slots.get(0).getFirst(); + default: + throw new UnsupportedOperationException("This packet has multiple slots specified"); } } @@ -142,7 +144,8 @@ public void setSlot(ItemSlot value) { modifier.write(0, slots); return; } - default: throw new UnsupportedOperationException("This packet has multiple slots specified"); + default: + throw new UnsupportedOperationException("This packet has multiple slots specified"); } } @@ -168,7 +171,8 @@ else switch (value) { handle.getIntegers().write(1, 4); break; } - case OFFHAND: throw new IllegalArgumentException("Offhand is not available on 1.8 or less"); + case OFFHAND: + throw new IllegalArgumentException("Offhand is not available on 1.8 or less"); } } @@ -183,9 +187,12 @@ public ItemStack getItem() { if (MINOR_VERSION >= 16) { final List> slots = handle.getSlotStackPairLists().read(0); switch (slots.size()) { - case 0: return null; - case 1: return slots.get(0).getSecond(); - default: throw new UnsupportedOperationException("This packet has multiple slots specified"); + case 0: + return null; + case 1: + return slots.get(0).getSecond(); + default: + throw new UnsupportedOperationException("This packet has multiple slots specified"); } } @@ -212,7 +219,8 @@ public void setItem(ItemStack value) { modifier.write(0, slots); return; } - default: throw new UnsupportedOperationException("This packet has multiple slots specified"); + default: + throw new UnsupportedOperationException("This packet has multiple slots specified"); } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityLook.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityLook.java index bec7719ca..7a6829e36 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityLook.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityLook.java @@ -18,13 +18,12 @@ * 02111-1307 USA */ -import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; -import org.bukkit.World; -import org.bukkit.entity.Entity; - import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; +import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; +import org.bukkit.World; +import org.bukkit.entity.Entity; public class WrapperPlayServerEntityLook extends AbstractPacket { public static final PacketType TYPE = PacketType.Play.Server.ENTITY_LOOK; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityMetadata.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityMetadata.java index 10c90d836..632c629ae 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityMetadata.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/packetwrapper/WrapperPlayServerEntityMetadata.java @@ -1,17 +1,16 @@ package cz.neumimto.rpg.spigot.packetwrapper; -import java.util.List; - -import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; -import org.bukkit.World; -import org.bukkit.entity.Entity; - import com.comphenix.protocol.PacketType; import com.comphenix.protocol.events.PacketContainer; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.wrappers.WrappedDataWatcher; import com.comphenix.protocol.wrappers.WrappedWatchableObject; +import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; +import org.bukkit.World; +import org.bukkit.entity.Entity; + +import java.util.List; public class WrapperPlayServerEntityMetadata extends AbstractPacket { public static final PacketType TYPE = PacketType.Play.Server.ENTITY_METADATA; @@ -27,6 +26,7 @@ public WrapperPlayServerEntityMetadata(PacketContainer packet) { /** * Retrieve unique entity ID to update. + * * @return The current Entity ID */ public int getEntityId() { @@ -35,6 +35,7 @@ public int getEntityId() { /** * Set unique entity ID to update. + * * @param value - new value. */ public void setEntityId(int value) { @@ -43,6 +44,7 @@ public void setEntityId(int value) { /** * Retrieve the entity. + * * @param world - the current world of the entity. * @return The entity. */ @@ -52,6 +54,7 @@ public Entity getEntity(World world) { /** * Retrieve the entity. + * * @param event - the packet event. * @return The entity. */ @@ -63,6 +66,7 @@ public Entity getEntity(PacketEvent event) { * Retrieve a list of all the watchable objects. *

* This can be converted to a data watcher using {@link WrappedDataWatcher#WrappedDataWatcher(List) WrappedDataWatcher(List)} + * * @return The current metadata */ public List getEntityMetadata() { @@ -71,6 +75,7 @@ public List getEntityMetadata() { /** * Set the list of the watchable objects (meta data). + * * @param value - new value. */ public void setEntityMetadata(List value) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotGuiceModule.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotGuiceModule.java index c77d6c9af..617ae5008 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotGuiceModule.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotGuiceModule.java @@ -20,7 +20,6 @@ import cz.neumimto.rpg.api.permissions.PermissionService; import cz.neumimto.rpg.api.skills.SkillService; import cz.neumimto.rpg.common.AbstractRpgGuiceModule; -import cz.neumimto.rpg.common.ResourceManagerImpl; import cz.neumimto.rpg.common.assets.AssetService; import cz.neumimto.rpg.common.bytecode.ClassGenerator; import cz.neumimto.rpg.common.entity.configuration.MobSettingsDao; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotResourceManager.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotResourceManager.java index 1dfb34f38..0a41fcaed 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotResourceManager.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/resources/SpigotResourceManager.java @@ -2,7 +2,6 @@ import com.google.inject.Injector; import cz.neumimto.rpg.api.Rpg; -import cz.neumimto.rpg.api.services.IPropertyContainer; import cz.neumimto.rpg.common.ResourceManagerImpl; import cz.neumimto.rpg.spigot.services.IRpgListener; @@ -18,7 +17,7 @@ public class SpigotResourceManager extends ResourceManagerImpl { @Override public void loadServices() { super.loadServices(); - load(IRpgListener.class, getClass().getClassLoader()).forEach(a-> { + load(IRpgListener.class, getClass().getClassLoader()).forEach(a -> { injector.injectMembers(a); Rpg.get().registerListeners(a); }); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/SpigotCustomSkillGenerator.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/SpigotCustomSkillGenerator.java index bde5a95e4..4bad15871 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/SpigotCustomSkillGenerator.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/SpigotCustomSkillGenerator.java @@ -4,18 +4,10 @@ import cz.neumimto.rpg.spigot.effects.common.StunEffect; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import cz.neumimto.rpg.spigot.skills.TargetedEntitySkill; -import cz.neumimto.rpg.spigot.skills.utils.Decorator; -import org.bukkit.Location; -import org.bukkit.Particle; import org.bukkit.event.entity.EntityDamageEvent; import javax.inject.Singleton; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; import java.lang.reflect.Type; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; @Singleton public class SpigotCustomSkillGenerator extends CustomSkillGenerator { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/mechanics/ToastMechanic.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/mechanics/ToastMechanic.java index 8848a7c9c..7a21506b4 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/mechanics/ToastMechanic.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/scripting/mechanics/ToastMechanic.java @@ -2,7 +2,6 @@ import com.google.gson.Gson; import com.google.gson.JsonObject; -import cz.neumimto.rpg.api.RpgApi; import cz.neumimto.rpg.common.skills.scripting.Handler; import cz.neumimto.rpg.common.skills.scripting.Target; import cz.neumimto.rpg.spigot.SpigotRpg; @@ -78,7 +77,6 @@ private String createToastData(String message, String frame, String itemId, Stri JsonObject display = new JsonObject(); - display.addProperty("title", message); display.addProperty("frame", frame); if (background == null) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Bash.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Bash.java index 97fafbe89..6d22c36e2 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Bash.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Bash.java @@ -18,7 +18,6 @@ import org.bukkit.Particle; import org.bukkit.Sound; import org.bukkit.entity.LivingEntity; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.util.Vector; @@ -62,7 +61,7 @@ public SkillResult castOn(IEntity target, ISpigotCharacter source, PlayerSkillCo Location location = entity.getLocation(); location.getWorld().playSound(location, Sound.ENTITY_PLAYER_ATTACK_KNOCKBACK, 1, 1); - location.getWorld().spawnParticle(Particle.REDSTONE, location.add(0,1,0), 8); + location.getWorld().spawnParticle(Particle.REDSTONE, location.add(0, 1, 0), 8); double knockback = skillContext.getDoubleNodeValue("knockback"); if (knockback > 0) { @@ -90,13 +89,14 @@ public SkillResult castOn(IEntity target, ISpigotCharacter source, PlayerSkillCo private void makeTrajectory(LivingEntity entity) { new BukkitRunnable() { private int i = 0; + @Override public void run() { if (entity.isDead() || i == 10) { cancel(); } else { - entity.getWorld().spawnParticle(Particle.SPELL_MOB, entity.getLocation().add(0,.5,0), - 3,238, 63, 55); + entity.getWorld().spawnParticle(Particle.SPELL_MOB, entity.getLocation().add(0, .5, 0), + 3, 238, 63, 55); i++; } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBeam.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBeam.java index efab7c55b..c65489b2d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBeam.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBeam.java @@ -81,7 +81,7 @@ public SkillResult cast(ISpigotCharacter character, PlayerSkillContext info) { ThreadLocalRandom.current().nextDouble(-0.5, 0.5) )); - player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, SoundCategory.PLAYERS, 1,1 ); + player.getLocation().getWorld().playSound(player.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, SoundCategory.PLAYERS, 1, 1); SpigotRpgPlugin.getEffectManager().start(lineEffect); return SkillResult.OK; } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBlast.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBlast.java index 95562116a..866125c5a 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBlast.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireBlast.java @@ -69,7 +69,7 @@ protected SkillResult castOn(Block block, ISpigotCharacter character, PlayerSkil Player player = character.getPlayer(); World world = block.getWorld(); - Location loc = block.getLocation().add(0,1,0); + Location loc = block.getLocation().add(0, 1, 0); world.playSound(loc, Sound.ENTITY_GENERIC_EXPLODE, 0.5f, 0.5f); Collection nearbyEntities = world.getNearbyEntities(loc, blastradius, blastradius, blastradius, @@ -96,10 +96,10 @@ public void push(Location loc, Entity entity) { entity.setVelocity(vector); } - private void spawnFireworks(Location location){ + private void spawnFireworks(Location location) { FireworkHandler.spawn(location, FireworkEffect.builder() - .withColor(Color.fromRGB( 229, 55, 28 )) - .withFade(Color.fromRGB( 229, 125, 28 )) + .withColor(Color.fromRGB(229, 55, 28)) + .withFade(Color.fromRGB(229, 125, 28)) .with(FireworkEffect.Type.BALL) .build(), 40); } @@ -108,6 +108,7 @@ private class Particles extends BukkitRunnable { private Location location; private int c = 200; + public Particles(Location location) { this.location = location; } @@ -115,7 +116,7 @@ public Particles(Location location) { @Override public void run() { c--; - location.getWorld().spawnParticle(Particle.FLAME, location, 2,0,0.1,0); + location.getWorld().spawnParticle(Particle.FLAME, location, 2, 0, 0.1, 0); if (c == 0) { cancel(); } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireRemnant.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireRemnant.java index 74daef9bd..d61c5ffcf 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireRemnant.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FireRemnant.java @@ -77,7 +77,7 @@ public SkillResult cast(ISpigotCharacter character, PlayerSkillContext ctx) { double damage = ctx.getDoubleNodeValue(SkillNodes.DAMAGE); long duration = ctx.getLongNodeValue(SkillNodes.DURATION); - effectService.addEffect(new FireRemnantEffect(character,armorStand,duration, damage)); + effectService.addEffect(new FireRemnantEffect(character, armorStand, duration, damage)); return SkillResult.OK_NO_COOLDOWN; } else { @@ -96,6 +96,7 @@ public static class FireRemnantEffect extends EffectBase { private double damage; private SphereEffect particles; + public FireRemnantEffect(IEffectConsumer consumer, ArmorStand remnant, long duration, double damage) { super(name, consumer); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FlameDash.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FlameDash.java index 8d7244f49..8e56ccbfb 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FlameDash.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/FlameDash.java @@ -4,18 +4,18 @@ import cz.neumimto.rpg.api.ResourceLoader; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.api.skills.PlayerSkillContext; -import cz.neumimto.rpg.api.skills.SkillNodes; import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.api.skills.tree.SkillType; import cz.neumimto.rpg.spigot.SpigotRpgPlugin; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; -import cz.neumimto.rpg.spigot.skills.particles.StaticCircularBeamEffect; import de.slikey.effectlib.EffectType; import de.slikey.effectlib.effect.LineEffect; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Particle; +import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.entity.Player; -import org.bukkit.event.entity.EntityDamageEvent; import javax.inject.Singleton; @@ -56,13 +56,13 @@ protected SkillResult castOn(Block block, ISpigotCharacter character, PlayerSkil */ Bukkit.getScheduler().scheduleSyncDelayedTask(SpigotRpgPlugin.getInstance(), () -> { - player.teleport(block.getLocation().add(0,1,0)); + player.teleport(block.getLocation().add(0, 1, 0)); player.getWorld().playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.75f, 0.75f); player.getWorld().spawnParticle(Particle.EXPLOSION_NORMAL, player.getLocation(), 2); player.getWorld().spawnParticle(Particle.EXPLOSION_HUGE, player.getLocation(), 1); - // staticCircularBeamEffect.cancel(); + // staticCircularBeamEffect.cancel(); LineEffect lineEffect = new LineEffect(SpigotRpgPlugin.getEffectManager()); lineEffect.particle = Particle.LAVA; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/GlacialCascade.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/GlacialCascade.java index b5571691b..cad7eaf06 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/GlacialCascade.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/GlacialCascade.java @@ -2,7 +2,6 @@ import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.ResourceLoader; -import cz.neumimto.rpg.api.Rpg; import cz.neumimto.rpg.api.effects.EffectBase; import cz.neumimto.rpg.api.effects.EffectService; import cz.neumimto.rpg.api.effects.IEffect; @@ -19,8 +18,6 @@ import cz.neumimto.rpg.spigot.packetwrapper.PacketHandler; import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; import org.bukkit.*; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; @@ -102,7 +99,7 @@ public void onTick(IEffect self) { setDuration(0); return; } - location.add(0,0.2,0); + location.add(0, 0.2, 0); spawnEntity(location); @@ -121,12 +118,12 @@ public void onTick(IEffect self) { } public Location getBlockBelowLoc(Location loc, int it) { - it -=1; + it -= 1; if (it == 0) { return null; } Location locBelow = loc.subtract(0, 1, 0); - if(locBelow.getBlock().isPassable()) { + if (locBelow.getBlock().isPassable()) { locBelow = getBlockBelowLoc(locBelow, it); } @@ -149,7 +146,7 @@ private void spawnEntity(Location location) { } } - location.getWorld().playSound(location, Sound.BLOCK_GLASS_BREAK, 0.75f,0.5f); + location.getWorld().playSound(location, Sound.BLOCK_GLASS_BREAK, 0.75f, 0.5f); location.getWorld().spawnParticle(Particle.BLOCK_CRACK, location, 10, 0.0, 0.1, 0.0, Material.ICE.createBlockData()); location.getWorld().spawnParticle(Particle.SNOWBALL, location, 8); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceAura.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceAura.java index e18e7a3cb..55034d2ed 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceAura.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceAura.java @@ -6,7 +6,6 @@ import cz.neumimto.rpg.api.skills.PlayerSkillContext; import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.api.skills.types.ActiveSkill; -import cz.neumimto.rpg.spigot.effects.common.IceAuraEffect; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import javax.inject.Singleton; @@ -18,7 +17,7 @@ public class IceAura extends ActiveSkill { @Override public SkillResult cast(ISpigotCharacter character, PlayerSkillContext info) { - // new IceAuraEffect(character,) + // new IceAuraEffect(character,) return null; } } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceWall.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceWall.java index a0fa28e54..7756fab6d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceWall.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/IceWall.java @@ -14,13 +14,11 @@ import org.bukkit.util.Vector; import javax.inject.Singleton; -import java.util.ArrayList; -import java.util.List; @Singleton @AutoService(ISkill.class) @ResourceLoader.Skill("ntrpg:icewall") -public class IceWall extends TargetedBlockSkill{ +public class IceWall extends TargetedBlockSkill { @Override public void init() { @@ -38,13 +36,13 @@ public void init() { protected SkillResult castOn(Block block, ISpigotCharacter character, PlayerSkillContext skillContext) { Player player = character.getPlayer(); Location eyeLocation = player.getEyeLocation(); - Location centerLocation = block.getLocation().clone().add(new Vector(0,1,0)); + Location centerLocation = block.getLocation().clone().add(new Vector(0, 1, 0)); Location rotated = eyeLocation.clone(); rotated.setPitch(0); rotated.setYaw(eyeLocation.getYaw() - 90); Vector rotation = rotated.getDirection(); - // Location blockLocation = center.clone().add(rotation).subtract(0, amount / 2, 0); + // Location blockLocation = center.clone().add(rotation).subtract(0, amount / 2, 0); return SkillResult.OK; } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Icicle.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Icicle.java index 7ceefdcec..d7542fd4b 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Icicle.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Icicle.java @@ -93,6 +93,7 @@ static class Trail extends BukkitRunnable { private Projectile projectile; private int max = 500; BlockData data = null; + public Trail(Projectile snowball) { this.projectile = snowball; data = Material.BLUE_ICE.createBlockData(); @@ -100,7 +101,7 @@ public Trail(Projectile snowball) { @Override public void run() { - max --; + max--; projectile.getWorld().spawnParticle(Particle.SNOWBALL, projectile.getLocation(), 2); projectile.getWorld().spawnParticle(Particle.BLOCK_CRACK, projectile.getLocation(), 4, 0.0, 0.1, 0.0, data); if (max == 0) { diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Jump.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Jump.java index 8102b7e67..7cfb407b6 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Jump.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Jump.java @@ -4,7 +4,6 @@ import cz.neumimto.rpg.api.ResourceLoader; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.api.skills.PlayerSkillContext; -import cz.neumimto.rpg.api.skills.SkillNodes; import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.api.skills.tree.SkillType; import cz.neumimto.rpg.api.skills.types.ActiveSkill; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Levitate.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Levitate.java index 18a6c8269..f806a1269 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Levitate.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Levitate.java @@ -5,9 +5,7 @@ import cz.neumimto.rpg.api.effects.IEffect; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.api.skills.PlayerSkillContext; -import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.api.skills.ToggleableSkill; -import cz.neumimto.rpg.api.skills.types.ActiveSkill; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import javax.inject.Singleton; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/LightningStrike.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/LightningStrike.java new file mode 100644 index 000000000..7cfd4e923 --- /dev/null +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/LightningStrike.java @@ -0,0 +1,60 @@ +package cz.neumimto.rpg.spigot.skills; + +import com.google.auto.service.AutoService; +import cz.neumimto.rpg.api.ResourceLoader; +import cz.neumimto.rpg.api.effects.EffectService; +import cz.neumimto.rpg.api.entity.IEntity; +import cz.neumimto.rpg.api.skills.ISkill; +import cz.neumimto.rpg.api.skills.PlayerSkillContext; +import cz.neumimto.rpg.api.skills.SkillNodes; +import cz.neumimto.rpg.api.skills.SkillResult; +import cz.neumimto.rpg.api.skills.tree.SkillType; +import cz.neumimto.rpg.spigot.SpigotRpgPlugin; +import cz.neumimto.rpg.spigot.damage.SpigotDamageService; +import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.entity.EntityDamageEvent; + +import javax.inject.Inject; +import javax.inject.Singleton; + +@Singleton +@AutoService(ISkill.class) +@ResourceLoader.Skill("ntrpg:lightningstrike") +public class LightningStrike extends TargetedEntitySkill { + + @Inject + private EffectService effectService; + + @Inject + private SpigotDamageService damageService; + + @Inject + private SpigotRpgPlugin plugin; + + @Override + public void init() { + super.init(); + setDamageType(EntityDamageEvent.DamageCause.CONTACT.name()); + addSkillType(SkillType.ELEMENTAL); + addSkillType(SkillType.LIGHTNING); + addSkillType(SkillType.DAMAGE_CHECK_TARGET); + settings.addExpression(SkillNodes.DAMAGE, "15 + level * 2"); + } + + @Override + public SkillResult castOn(IEntity target, ISpigotCharacter source, PlayerSkillContext skillContext) { + LivingEntity entity = (LivingEntity) target.getEntity(); + + double damage = skillContext.getDoubleNodeValue(SkillNodes.DAMAGE); + Location location = entity.getLocation(); + location.getWorld().strikeLightningEffect(location); + if (damage > 0) { + damageService.damage(entity, source.getEntity(), EntityDamageEvent.DamageCause.LIGHTNING, damage, false); + } + + return SkillResult.OK; + } + +} diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Megabolt.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Megabolt.java index 50a6d4802..6e3b0d8db 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Megabolt.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Megabolt.java @@ -2,7 +2,6 @@ import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.ResourceLoader; -import cz.neumimto.rpg.api.damage.DamageService; import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.api.skills.PlayerSkillContext; import cz.neumimto.rpg.api.skills.SkillNodes; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/MineralScan.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/MineralScan.java index db371a963..37bae170e 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/MineralScan.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/MineralScan.java @@ -5,7 +5,6 @@ import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; import com.comphenix.protocol.events.PacketContainer; -import com.comphenix.protocol.wrappers.WrappedWatchableObject; import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.ResourceLoader; import cz.neumimto.rpg.api.skills.ISkill; @@ -23,8 +22,6 @@ import org.bukkit.entity.Player; import javax.inject.Singleton; -import java.util.ArrayList; -import java.util.List; import java.util.UUID; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Multibolt.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Multibolt.java index 5ba2c98b8..df3513c4e 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Multibolt.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Multibolt.java @@ -78,7 +78,7 @@ public void run() { cancel(); return; } - remainingStrikes = remainingStrikes -1; + remainingStrikes = remainingStrikes - 1; if (spigotDamageService.damage(attacker, target, EntityDamageEvent.DamageCause.LIGHTNING, damage, false)) { target.getLocation().getWorld().strikeLightningEffect(target.getLocation()); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Piggify.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Piggify.java index 8a9f941db..830a7b8e3 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Piggify.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Piggify.java @@ -10,10 +10,6 @@ import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.spigot.effects.common.PiggifyEffect; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; -import org.bukkit.Location; -import org.bukkit.entity.Entity; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.LivingEntity; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Slash.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Slash.java index c60dcb570..558e7f627 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Slash.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Slash.java @@ -18,7 +18,6 @@ import cz.neumimto.rpg.spigot.skills.utils.AbstractPacket; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.inventory.EquipmentSlot; import javax.inject.Inject; import javax.inject.Singleton; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Soar.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Soar.java index 44f554a63..dfd68e0d8 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Soar.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Soar.java @@ -15,8 +15,8 @@ import cz.neumimto.rpg.api.skills.types.ActiveSkill; import cz.neumimto.rpg.spigot.SpigotRpgPlugin; import cz.neumimto.rpg.spigot.damage.SpigotDamageService; -import cz.neumimto.rpg.spigot.effects.common.StunEffect; import cz.neumimto.rpg.spigot.effects.common.FeatherFall; +import cz.neumimto.rpg.spigot.effects.common.StunEffect; import cz.neumimto.rpg.spigot.entities.ISpigotEntity; import cz.neumimto.rpg.spigot.entities.SpigotEntityService; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotActiveSkill.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotActiveSkill.java index 076cd7155..bc264678d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotActiveSkill.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotActiveSkill.java @@ -2,5 +2,7 @@ import cz.neumimto.rpg.api.skills.types.ActiveSkill; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; + //due to janino compiler -public abstract class SpigotActiveSkill extends ActiveSkill {} +public abstract class SpigotActiveSkill extends ActiveSkill { +} diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotSkillTreeInterfaceModel.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotSkillTreeInterfaceModel.java index 0431b5e90..94a608c02 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotSkillTreeInterfaceModel.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SpigotSkillTreeInterfaceModel.java @@ -1,8 +1,6 @@ package cz.neumimto.rpg.spigot.skills; -import com.google.auto.service.AutoService; import cz.neumimto.rpg.api.gui.ISkillTreeInterfaceModel; -import cz.neumimto.rpg.api.skills.ISkill; import cz.neumimto.rpg.spigot.gui.SpigotGuiHelper; import org.bukkit.Material; import org.bukkit.inventory.ItemStack; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SwapPosition.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SwapPosition.java index a8bb8cbd1..f519deab1 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SwapPosition.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/SwapPosition.java @@ -50,7 +50,6 @@ public SkillResult castOn(IEntity target, ISpigotCharacter source, PlayerSkillCo lT.teleport(casterLoc); - return SkillResult.OK; } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/TargetedEntitySkill.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/TargetedEntitySkill.java index 1afc77556..b9bf1787d 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/TargetedEntitySkill.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/TargetedEntitySkill.java @@ -40,7 +40,7 @@ public SkillResult cast(ISpigotCharacter caster, PlayerSkillContext skillContext return SkillResult.NO_TARGET; } } - if ((getDamageType() != null || getSkillTypes().contains(SkillType.DAMAGE_CHECK_TARGET) ) && !damageService.canDamage(caster, l)) { + if ((getDamageType() != null || getSkillTypes().contains(SkillType.DAMAGE_CHECK_TARGET)) && !damageService.canDamage(caster, l)) { return SkillResult.CANCELLED; } IEntity target = Rpg.get().getEntityService().get(l); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Web.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Web.java index 4ecb1bcb7..5609dd2a3 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Web.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/Web.java @@ -9,7 +9,6 @@ import cz.neumimto.rpg.api.skills.SkillNodes; import cz.neumimto.rpg.api.skills.SkillResult; import cz.neumimto.rpg.api.skills.tree.SkillType; -import cz.neumimto.rpg.api.skills.types.ActiveSkill; import cz.neumimto.rpg.spigot.effects.common.WebEffect; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/listeners/SkillpackListener.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/listeners/SkillpackListener.java index f44da790f..b1f0fa976 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/listeners/SkillpackListener.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/listeners/SkillpackListener.java @@ -1,7 +1,6 @@ package cz.neumimto.rpg.spigot.skills.listeners; import com.google.auto.service.AutoService; -import cz.neumimto.rpg.api.ResourceLoader; import cz.neumimto.rpg.api.effects.IEffectContainer; import cz.neumimto.rpg.api.entity.IEntity; import cz.neumimto.rpg.spigot.damage.SpigotDamageService; @@ -13,14 +12,12 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.spigotmc.event.entity.EntityDismountEvent; import javax.inject.Inject; import javax.inject.Singleton; -import java.util.EventListener; @Singleton @AutoService(IRpgListener.class) diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/particles/StaticCircularBeamEffect.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/particles/StaticCircularBeamEffect.java index 51906272a..a516f5c23 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/particles/StaticCircularBeamEffect.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/particles/StaticCircularBeamEffect.java @@ -1,15 +1,10 @@ package cz.neumimto.rpg.spigot.skills.particles; -import de.slikey.effectlib.Effect; import de.slikey.effectlib.EffectManager; import de.slikey.effectlib.effect.CircleEffect; -import de.slikey.effectlib.util.VectorUtils; -import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Particle; -import org.bukkit.entity.Player; -import org.bukkit.util.Vector; import java.util.concurrent.ThreadLocalRandom; @@ -30,7 +25,7 @@ protected void display(Particle particle, Location location, Color color, float double d = ThreadLocalRandom.current().nextDouble(vertVecMin, vertVecMax); double y = location.getY(); - for (double i = 0; i < d; i=+vertStep) { + for (double i = 0; i < d; i = +vertStep) { location.add(0, i, 0); effectManager.display(particle, location, particleOffsetX, particleOffsetY, particleOffsetZ, speed, amount, particleSize, color, material, materialData, visibleRange, targetPlayers); diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/scripting/SpigotScriptFunctions.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/scripting/SpigotScriptFunctions.java index eaae8f1fd..f282c383f 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/scripting/SpigotScriptFunctions.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/scripting/SpigotScriptFunctions.java @@ -200,7 +200,7 @@ public class SpigotScriptFunctions { } ) public static F.QuadConsumer SET_VELOCITY = (entity, x, y, z) -> { - entity.setVelocity(new Vector(x,y,z)); + entity.setVelocity(new Vector(x, y, z)); }; } diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/AbstractBeam.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/AbstractBeam.java index 9f8ae50b6..a867e0dd9 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/AbstractBeam.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/AbstractBeam.java @@ -24,7 +24,7 @@ public abstract class AbstractBeam extends BukkitRunnable { private Vector vector; private Location initialLoc; private IEntity iEntity; -// private Async lance; + // private Async lance; private T data; private boolean stop; diff --git a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/Decorator.java b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/Decorator.java index 8989cdc2b..5f0224a7b 100644 --- a/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/Decorator.java +++ b/Implementations/Spigot/src/main/java/cz/neumimto/rpg/spigot/skills/utils/Decorator.java @@ -1,26 +1,26 @@ package cz.neumimto.rpg.spigot.skills.utils; import de.slikey.effectlib.util.VectorUtils; -import org.bukkit.*; -import org.bukkit.block.data.BlockData; -import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Particle; import org.bukkit.util.Vector; public class Decorator { public static void circle(Location center, - int radius, - int particleCount, - Particle effect, - int count, - double offsetx, - double offsety, - double offsetz, - int data - ) { + int radius, + int particleCount, + Particle effect, + int count, + double offsetx, + double offsety, + double offsetz, + int data + ) { center = center.clone(); - final double pitch = (center.getPitch() + 90.0F) * Math.PI/180; - final double yaw = -center.getYaw() * Math.PI/180; + final double pitch = (center.getPitch() + 90.0F) * Math.PI / 180; + final double yaw = -center.getYaw() * Math.PI / 180; double increment = (2 * Math.PI) / particleCount; for (int i = 0; i < particleCount; i++) { double angle = i * increment; @@ -36,6 +36,7 @@ public static void circle(Location center, center.subtract(vec); } } + /* JS cannot handler overloaded methods well, we would need to do "point["args array type"](actual call)", therefore the indexes, */ public static void point0(Location location, Particle effect, int count) { diff --git a/Implementations/Spigot/src/main/resources/assets/nt-rpg/gui/Character.conf b/Implementations/Spigot/src/main/resources/assets/nt-rpg/gui/Character.conf index 52f75b65b..73b2c8b25 100644 --- a/Implementations/Spigot/src/main/resources/assets/nt-rpg/gui/Character.conf +++ b/Implementations/Spigot/src/main/resources/assets/nt-rpg/gui/Character.conf @@ -38,7 +38,7 @@ Mask: [ } { C: T - TranslationKey: gui.label.label + TranslationKey: gui.attributes.label Id: "minecraft:book" Model: 12345 OnClick: { diff --git a/Implementations/Spigot/src/test/java/cz/neumimto/rpg/spigot/SpigotTests.java b/Implementations/Spigot/src/test/java/cz/neumimto/rpg/spigot/SpigotTests.java index 70caca6d8..7ba002b60 100644 --- a/Implementations/Spigot/src/test/java/cz/neumimto/rpg/spigot/SpigotTests.java +++ b/Implementations/Spigot/src/test/java/cz/neumimto/rpg/spigot/SpigotTests.java @@ -13,16 +13,18 @@ import cz.neumimto.rpg.api.persistance.model.CharacterClass; import cz.neumimto.rpg.api.skills.PlayerSkillContext; import cz.neumimto.rpg.api.skills.SkillData; -import cz.neumimto.rpg.api.skills.SkillSettings; import cz.neumimto.rpg.api.skills.tree.SkillTree; import cz.neumimto.rpg.common.entity.players.PreloadCharacter; import cz.neumimto.rpg.spigot.entities.players.ISpigotCharacter; import org.bukkit.Bukkit; -import org.bukkit.permissions.Permission; -import org.junit.jupiter.api.*; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; import java.util.Map; -import java.util.concurrent.*; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; public class SpigotTests { @@ -35,8 +37,7 @@ public class SpigotTests { static Executor executor; @BeforeAll - public static void setUp() - { + public static void setUp() { server = MockBukkit.mock(); plugin = (SpigotRpgPlugin) MockBukkit.load(SpigotRpgPlugin.class); classService = Rpg.get().getClassService(); @@ -107,7 +108,7 @@ public void player_test_common_stuff() { // check level changes CharacterClass characterClass = playerClass.getCharacterClass(); - Assertions.assertSame(characterClass.getSkillPoints(), warriorClass.getSkillpointsPerLevel() , "Player receive a skill-point"); + Assertions.assertSame(characterClass.getSkillPoints(), warriorClass.getSkillpointsPerLevel(), "Player receive a skill-point"); Assertions.assertSame(character.getAttributePoints(), warriorClass.getAttributepointsPerLevel() + pluginConfig.ATTRIBUTEPOINTS_ON_START, "Player receive an attribute-point"); @@ -149,8 +150,7 @@ public void player_test_common_stuff() { } @AfterAll - public static void tearDown() - { + public static void tearDown() { MockBukkit.unmock(); } } diff --git a/build.gradle b/build.gradle index e6bd6f8f2..7fd2629bd 100644 --- a/build.gradle +++ b/build.gradle @@ -48,7 +48,7 @@ subprojects { from { configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) } } - exclude("**/*.DSA", "**/*.SF", "**/*pom.xml", "**/*pom.properties",'**/module-info.class') + exclude("**/*.DSA", "**/*.SF", "**/*pom.xml", "**/*pom.properties",'**/module-info.class', "**/*.php",) } dependencies { diff --git a/gradle.properties b/gradle.properties index 51be4e9b2..f3649d8a3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ if=0.9.9 spigotapi=1.16.4-R0.1-SNAPSHOT protocollib=4.6.0-SNAPSHOT nbtapi=2.8.0 -effectlib=d77f639038 +effectlib=9.0 papi=2.10.9 hdisplays=2.4.0 mmoitems=6.5.5