├── .gitattributes ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── README.md ├── editor ├── builderStyle.css ├── img │ ├── delete.png │ ├── duplicate.png │ ├── eye.png │ └── eyeShaded.png ├── js │ ├── class.js │ ├── component.js │ ├── data │ │ ├── 1.10.js │ │ ├── 1.11.js │ │ ├── 1.12.js │ │ ├── 1.13.js │ │ ├── 1.14.js │ │ ├── 1.15.js │ │ ├── 1.16.js │ │ ├── 1.8.js │ │ ├── 1.9.js │ │ ├── data generator │ │ │ └── generator.py │ │ └── data.js │ ├── filter.js │ ├── input.js │ ├── loader.js │ ├── main.js │ ├── skill.js │ └── yaml.js ├── mojave-webfont.eot ├── mojave-webfont.ttf ├── sertig-webfont.eot ├── sertig-webfont.ttf ├── style.css └── tooltips.css ├── exp.html ├── index.html ├── lib ├── MCCore-1.67.jar ├── Parties-1.13.jar └── RPGInventory-1.0.6.jar ├── pom.xml └── src └── main ├── java └── com │ └── sucy │ └── skill │ ├── SkillAPI.java │ ├── api │ ├── CombatProtection.java │ ├── DefaultCombatProtection.java │ ├── ReadOnlySettings.java │ ├── Settings.java │ ├── SkillPlugin.java │ ├── armorstand │ │ ├── ArmorStandData.java │ │ ├── ArmorStandInstance.java │ │ └── ArmorStandManager.java │ ├── classes │ │ ├── ClassAttribute.java │ │ ├── DefaultTreeType.java │ │ ├── RPGClass.java │ │ └── TreeType.java │ ├── enums │ │ ├── Direction.java │ │ ├── ExpSource.java │ │ ├── ManaCost.java │ │ ├── ManaSource.java │ │ ├── PointSource.java │ │ ├── SkillStatus.java │ │ └── TreeType.java │ ├── event │ │ ├── FlagApplyEvent.java │ │ ├── FlagExpireEvent.java │ │ ├── ItemProjectileHitEvent.java │ │ ├── ItemProjectileLandEvent.java │ │ ├── ItemProjectileLaunchEvent.java │ │ ├── KeyPressEvent.java │ │ ├── ParticleProjectileExpireEvent.java │ │ ├── ParticleProjectileHitEvent.java │ │ ├── ParticleProjectileLandEvent.java │ │ ├── ParticleProjectileLaunchEvent.java │ │ ├── PhysicalDamageEvent.java │ │ ├── PlayerAccountChangeEvent.java │ │ ├── PlayerCastSkillEvent.java │ │ ├── PlayerClassChangeEvent.java │ │ ├── PlayerComboFinishEvent.java │ │ ├── PlayerExperienceGainEvent.java │ │ ├── PlayerExperienceLostEvent.java │ │ ├── PlayerGainSkillPointsEvent.java │ │ ├── PlayerLandEvent.java │ │ ├── PlayerLevelUpEvent.java │ │ ├── PlayerManaGainEvent.java │ │ ├── PlayerManaLossEvent.java │ │ ├── PlayerPreClassChangeEvent.java │ │ ├── PlayerRefundAttributeEvent.java │ │ ├── PlayerSkillCastFailedEvent.java │ │ ├── PlayerSkillDowngradeEvent.java │ │ ├── PlayerSkillUnlockEvent.java │ │ ├── PlayerSkillUpgradeEvent.java │ │ ├── PlayerUpAttributeEvent.java │ │ ├── SkillDamageEvent.java │ │ ├── SkillHealEvent.java │ │ └── TrueDamageEvent.java │ ├── exception │ │ └── SkillTreeException.java │ ├── particle │ │ ├── EffectData.java │ │ ├── EffectInstance.java │ │ ├── EffectManager.java │ │ ├── EffectPlayer.java │ │ ├── Particle.java │ │ ├── ParticleEffect.java │ │ ├── ParticleLookup.java │ │ ├── ParticleSettings.java │ │ ├── ParticleType.java │ │ ├── PolarSettings.java │ │ ├── SpigotParticles.java │ │ ├── direction │ │ │ ├── DirectionHandler.java │ │ │ ├── Directions.java │ │ │ ├── XYHandler.java │ │ │ ├── XZHandler.java │ │ │ └── YZHandler.java │ │ └── target │ │ │ ├── EffectTarget.java │ │ │ ├── EntityTarget.java │ │ │ ├── FixedTarget.java │ │ │ ├── FollowTarget.java │ │ │ └── Followable.java │ ├── player │ │ ├── PlayerAccounts.java │ │ ├── PlayerClass.java │ │ ├── PlayerCombos.java │ │ ├── PlayerData.java │ │ ├── PlayerSkill.java │ │ ├── PlayerSkillBar.java │ │ └── PlayerSkillSlot.java │ ├── projectile │ │ ├── CustomProjectile.java │ │ ├── HomingProjectile.java │ │ ├── ItemProjectile.java │ │ ├── ParticleProjectile.java │ │ └── ProjectileCallback.java │ ├── skills │ │ ├── PassiveSkill.java │ │ ├── Skill.java │ │ ├── SkillAttribute.java │ │ ├── SkillShot.java │ │ └── TargetSkill.java │ ├── target │ │ ├── AABB.java │ │ └── TargetHelper.java │ └── util │ │ ├── ActionBar.java │ │ ├── Buff.java │ │ ├── BuffData.java │ │ ├── BuffManager.java │ │ ├── BuffType.java │ │ ├── Combat.java │ │ ├── DamageLoreRemover.java │ │ ├── Data.java │ │ ├── FlagData.java │ │ ├── FlagManager.java │ │ ├── ItemSerializer.java │ │ ├── Nearby.java │ │ ├── ParticleHelper.java │ │ ├── StatusFlag.java │ │ └── Title.java │ ├── cast │ ├── CircleIndicator.java │ ├── ConeIndicator.java │ ├── CylinderIndicator.java │ ├── IIndicator.java │ ├── IndicatorSettings.java │ ├── IndicatorType.java │ ├── PlayerCastBars.java │ ├── PlayerView.java │ ├── ProjectileIndicator.java │ └── SphereIndicator.java │ ├── cmd │ ├── CmdAP.java │ ├── CmdAccount.java │ ├── CmdAttribute.java │ ├── CmdBackup.java │ ├── CmdBar.java │ ├── CmdBind.java │ ├── CmdCast.java │ ├── CmdChangeClass.java │ ├── CmdClearBinds.java │ ├── CmdCombo.java │ ├── CmdCustomize.java │ ├── CmdExp.java │ ├── CmdForceAccount.java │ ├── CmdForceAttr.java │ ├── CmdForceCast.java │ ├── CmdForceProfess.java │ ├── CmdForceReset.java │ ├── CmdForceSkill.java │ ├── CmdInfo.java │ ├── CmdLevel.java │ ├── CmdList.java │ ├── CmdLore.java │ ├── CmdMana.java │ ├── CmdOptions.java │ ├── CmdPoints.java │ ├── CmdProfess.java │ ├── CmdRefund.java │ ├── CmdReload.java │ ├── CmdReset.java │ ├── CmdSkill.java │ ├── CmdSkillMap.java │ ├── CmdSwitch.java │ ├── CmdUnbind.java │ └── CmdWorld.java │ ├── data │ ├── Click.java │ ├── ExpFormula.java │ ├── GroupSettings.java │ ├── Permissions.java │ ├── PlayerEquips.java │ ├── PlayerSettings.java │ ├── PlayerStats.java │ ├── Point2D.java │ ├── Point3D.java │ ├── Settings.java │ ├── TitleType.java │ ├── formula │ │ ├── Formula.java │ │ ├── IOperator.java │ │ ├── IValue.java │ │ ├── func │ │ │ ├── Abs.java │ │ │ ├── Ceil.java │ │ │ ├── Cos.java │ │ │ ├── Floor.java │ │ │ ├── Root.java │ │ │ ├── Sign.java │ │ │ ├── Sin.java │ │ │ ├── Square.java │ │ │ └── Tan.java │ │ ├── operator │ │ │ ├── Addition.java │ │ │ ├── Division.java │ │ │ ├── Exponent.java │ │ │ ├── Log.java │ │ │ ├── Modulo.java │ │ │ ├── Multiplication.java │ │ │ └── Subtraction.java │ │ └── value │ │ │ ├── CustomValue.java │ │ │ └── ValueNum.java │ └── io │ │ ├── ConfigIO.java │ │ ├── IOManager.java │ │ └── SQLIO.java │ ├── dynamic │ ├── ComponentRegistry.java │ ├── ComponentType.java │ ├── DynamicClass.java │ ├── DynamicSkill.java │ ├── EffectComponent.java │ ├── ItemChecker.java │ ├── TempEntity.java │ ├── TriggerHandler.java │ ├── condition │ │ ├── ArmorCondition.java │ │ ├── AttributeCondition.java │ │ ├── BiomeCondition.java │ │ ├── BlockCondition.java │ │ ├── CastLevelCondition.java │ │ ├── CeilingCondition.java │ │ ├── ChanceCondition.java │ │ ├── ClassCondition.java │ │ ├── ClassLevelCondition.java │ │ ├── CombatCondition.java │ │ ├── ConditionComponent.java │ │ ├── CrouchCondition.java │ │ ├── DirectionCondition.java │ │ ├── ElevationCondition.java │ │ ├── ElseCondition.java │ │ ├── EntityTypeCondition.java │ │ ├── FireCondition.java │ │ ├── FlagCondition.java │ │ ├── GroundCondition.java │ │ ├── HealthCondition.java │ │ ├── InventoryCondition.java │ │ ├── ItemCondition.java │ │ ├── LightCondition.java │ │ ├── LoreCondition.java │ │ ├── ManaCondition.java │ │ ├── MountedCondition.java │ │ ├── MountingCondition.java │ │ ├── NameCondition.java │ │ ├── OffhandCondition.java │ │ ├── PermissionCondition.java │ │ ├── PotionCondition.java │ │ ├── SkillLevelCondition.java │ │ ├── SlotCondition.java │ │ ├── StatusCondition.java │ │ ├── TimeCondition.java │ │ ├── ToolCondition.java │ │ ├── ValueCondition.java │ │ ├── WaterCondition.java │ │ └── WeatherCondition.java │ ├── custom │ │ ├── CustomComponent.java │ │ ├── CustomEffectComponent.java │ │ ├── CustomTrigger.java │ │ └── EditorOption.java │ ├── mechanic │ │ ├── ArmorMechanic.java │ │ ├── ArmorStandMechanic.java │ │ ├── ArmorStandPoseMechanic.java │ │ ├── AttributeMechanic.java │ │ ├── BlockMechanic.java │ │ ├── BuffMechanic.java │ │ ├── CancelEffectMechanic.java │ │ ├── CancelMechanic.java │ │ ├── ChannelMechanic.java │ │ ├── CleanseMechanic.java │ │ ├── CommandMechanic.java │ │ ├── CooldownMechanic.java │ │ ├── DamageBuffMechanic.java │ │ ├── DamageLoreMechanic.java │ │ ├── DamageMechanic.java │ │ ├── DefenseBuffMechanic.java │ │ ├── DelayMechanic.java │ │ ├── DisguiseMechanic.java │ │ ├── DurabilityMechanic.java │ │ ├── ExplosionMechanic.java │ │ ├── FireMechanic.java │ │ ├── FlagClearMechanic.java │ │ ├── FlagMechanic.java │ │ ├── FlagToggleMechanic.java │ │ ├── FoodMechanic.java │ │ ├── ForgetTargetsMechanic.java │ │ ├── HealMechanic.java │ │ ├── HealthSetMechanic.java │ │ ├── HeldItemMechanic.java │ │ ├── ImmunityMechanic.java │ │ ├── InterruptMechanic.java │ │ ├── ItemMechanic.java │ │ ├── ItemProjectileMechanic.java │ │ ├── ItemRemoveMechanic.java │ │ ├── LaunchMechanic.java │ │ ├── LightningMechanic.java │ │ ├── ManaMechanic.java │ │ ├── MechanicComponent.java │ │ ├── MessageMechanic.java │ │ ├── ParticleAnimationMechanic.java │ │ ├── ParticleEffectMechanic.java │ │ ├── ParticleMechanic.java │ │ ├── ParticleProjectileMechanic.java │ │ ├── PassiveMechanic.java │ │ ├── PermissionMechanic.java │ │ ├── PotionMechanic.java │ │ ├── PotionProjectileMechanic.java │ │ ├── ProjectileMechanic.java │ │ ├── PurgeMechanic.java │ │ ├── PushMechanic.java │ │ ├── RememberTargetsMechanic.java │ │ ├── RepeatMechanic.java │ │ ├── SoundMechanic.java │ │ ├── SpeedMechanic.java │ │ ├── StatusMechanic.java │ │ ├── TauntMechanic.java │ │ ├── TriggerMechanic.java │ │ ├── ValueAddMechanic.java │ │ ├── ValueAttributeMechanic.java │ │ ├── ValueCopyMechanic.java │ │ ├── ValueDistanceMechanic.java │ │ ├── ValueHealthMechanic.java │ │ ├── ValueLocationMechanic.java │ │ ├── ValueLoreMechanic.java │ │ ├── ValueLoreSlotMechanic.java │ │ ├── ValueManaMechanic.java │ │ ├── ValueMultiplyMechanic.java │ │ ├── ValuePlaceholderMechanic.java │ │ ├── ValueRandomMechanic.java │ │ ├── ValueSetMechanic.java │ │ ├── WarpLocMechanic.java │ │ ├── WarpMechanic.java │ │ ├── WarpRandomMechanic.java │ │ ├── WarpSwapMechanic.java │ │ ├── WarpTargetMechanic.java │ │ ├── WarpValueMechanic.java │ │ └── WolfMechanic.java │ ├── target │ │ ├── AreaTarget.java │ │ ├── ConeTarget.java │ │ ├── LinearTarget.java │ │ ├── LocationTarget.java │ │ ├── NearestTarget.java │ │ ├── OffsetTarget.java │ │ ├── RememberTarget.java │ │ ├── SelfTarget.java │ │ ├── SingleTarget.java │ │ └── TargetComponent.java │ └── trigger │ │ ├── BlockBreakTrigger.java │ │ ├── BlockPlaceTrigger.java │ │ ├── CrouchTrigger.java │ │ ├── DeathTrigger.java │ │ ├── EnvironmentalTrigger.java │ │ ├── KillTrigger.java │ │ ├── LandTrigger.java │ │ ├── LaunchTrigger.java │ │ ├── MoveTrigger.java │ │ ├── PhysicalDealtTrigger.java │ │ ├── PhysicalTakenTrigger.java │ │ ├── PhysicalTrigger.java │ │ ├── SkillDealtTrigger.java │ │ ├── SkillTakenTrigger.java │ │ ├── SkillTrigger.java │ │ ├── Trigger.java │ │ └── TriggerComponent.java │ ├── gui │ ├── handlers │ │ ├── AttributeHandler.java │ │ ├── DetailsHandler.java │ │ ├── ProfessHandler.java │ │ └── SkillHandler.java │ ├── map │ │ ├── Menu.java │ │ ├── SkillDetailMenu.java │ │ └── SkillListMenu.java │ └── tool │ │ ├── GUIData.java │ │ ├── GUIHolder.java │ │ ├── GUIPage.java │ │ ├── GUITool.java │ │ ├── GUIType.java │ │ ├── IconHolder.java │ │ ├── InventoryData.java │ │ └── ToolMenu.java │ ├── hook │ ├── BungeeHook.java │ ├── CitizensHook.java │ ├── DisguiseHook.java │ ├── MythicMobsHook.java │ ├── NoCheatHook.java │ ├── PlaceholderAPIHook.java │ ├── PluginChecker.java │ ├── RPGInventoryHook.java │ ├── VaultHook.java │ └── WorldGuardHook.java │ ├── language │ ├── ErrorNodes.java │ ├── GUINodes.java │ ├── NotificationNodes.java │ ├── RPGFilter.java │ └── SkillNodes.java │ ├── listener │ ├── AddonListener.java │ ├── AttributeListener.java │ ├── BarListener.java │ ├── BindListener.java │ ├── BuffListener.java │ ├── CastCombatListener.java │ ├── CastItemListener.java │ ├── CastListener.java │ ├── CastOffhandListener.java │ ├── ClickListener.java │ ├── ComboListener.java │ ├── DeathListener.java │ ├── ExperienceListener.java │ ├── ItemListener.java │ ├── KillListener.java │ ├── LingeringPotionListener.java │ ├── ListenerUtil.java │ ├── MainListener.java │ ├── MechanicListener.java │ ├── PacketListener.java │ ├── SkillAPIListener.java │ ├── StatusListener.java │ └── ToolListener.java │ ├── log │ ├── LogType.java │ └── Logger.java │ ├── manager │ ├── AttributeManager.java │ ├── ClassBoardManager.java │ ├── CmdManager.java │ ├── ComboManager.java │ ├── RegistrationManager.java │ ├── ResourceManager.java │ └── TitleManager.java │ ├── packet │ ├── PacketHandler.java │ └── PacketInjector.java │ ├── task │ ├── ArmorStandTask.java │ ├── CooldownTask.java │ ├── EffectTask.java │ ├── GUITask.java │ ├── ManaTask.java │ ├── PreviewTask.java │ ├── RemoveTask.java │ ├── SaveTask.java │ └── ScoreboardTask.java │ ├── thread │ ├── IThreadTask.java │ ├── MainThread.java │ ├── RepeatThreadTask.java │ ├── TaskList.java │ └── ThreadTask.java │ ├── tree │ ├── SkillTree.java │ └── basic │ │ ├── BasicHorizontalTree.java │ │ ├── BasicVerticalTree.java │ │ ├── FloodTree.java │ │ ├── InventoryTree.java │ │ ├── LevelHorizontalTree.java │ │ ├── LevelTree.java │ │ ├── LevelVerticalTree.java │ │ └── RequirementTree.java │ └── util │ └── Lists.java └── resources ├── SkillAPIModule.jar ├── SkillAPIPlaceholders.jar ├── attributes.yml ├── config.yml ├── effects.yml ├── exp.yml ├── internal └── mobSizes.yml ├── language.yml ├── plugin.yml ├── tool.yml └── worldGuard.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Note: Aside from English, I also speak Spanish, and can understand Portuguese and French, so you can post the issue in the language you prefer among those. 11 | 12 | **Describe the bug** 13 | A clear and concise description of what the bug is. 14 | 15 | **To Reproduce** 16 | Steps to reproduce the behavior: 17 | 1. Go to '...' 18 | 2. Click on '....' 19 | 3. Scroll down to '....' 20 | 4. See error 21 | 22 | **Expected behavior** 23 | A clear and concise description of what you expected to happen. 24 | 25 | **Screenshots** 26 | If applicable, add screenshots to help explain your problem. 27 | 28 | **Desktop (please complete the following information):** 29 | - OS: [e.g. iOS] 30 | - Browser [e.g. chrome, safari] 31 | - Version [e.g. 22] 32 | 33 | **Smartphone (please complete the following information):** 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. iOS8.1] 36 | - Browser [e.g. stock browser, safari] 37 | - Version [e.g. 22] 38 | 39 | **Additional context** 40 | Add any other context about the problem here. 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Note: Aside from English, I also speak Spanish, and can understand Portuguese and French, so you can post the issue in the language you prefer among those. 11 | 12 | **Is your feature request related to a problem? Please describe.** 13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 14 | 15 | **Describe the solution you'd like** 16 | A clear and concise description of what you want to happen. 17 | 18 | **Describe alternatives you've considered** 19 | A clear and concise description of any alternative solutions or features you've considered. 20 | 21 | **Additional context** 22 | Add any other context or screenshots about the feature request here. 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.iml 3 | /*target 4 | editor/js/data/data generator/Biome.java 5 | editor/js/data/data generator/EntityDamageEvent.java 6 | editor/js/data/data generator/EntityType.java 7 | editor/js/data/data generator/Material.java 8 | editor/js/data/data generator/Particle.java 9 | editor/js/data/data generator/PotionEffectType.java 10 | editor/js/data/data generator/Sound.java 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SkillAPI-s 2 | 3 | # ATTENTION 4 | 5 | This fork is now unsupported, as the new fork PROSKILLAPI has taken over with a bigger and more time dedicated dev team. 6 | * Spigot: https://www.spigotmc.org/resources/skillapi-continued-custom-classes-skills-and-more-works-on-1-16-5-proskillapi.91913/ 7 | * GitHub: https://github.com/promcteam/proskillapi 8 | * Dynamic editor: https://promcteam.com/editor/ 9 | 10 | ## Useful links 11 | * Original SkillAPI Wiki | https://github.com/Eniripsa96/SkillAPI/wiki 12 | * Original Spigot Page | https://www.spigotmc.org/resources/skillapi.4824/ 13 | * Original Bukkit Page | http://dev.bukkit.org/bukkit-plugins/skillapi/ 14 | * Old Dynamic Editor | http://eniripsa96.github.io/SkillAPI/ 15 | * Examples Database | https://skillexamples.herokuapp.com/ 16 | * G.E.A.R.S. Discord server | https://discord.gg/KX2ygZJ 17 | -------------------------------------------------------------------------------- /editor/builderStyle.css: -------------------------------------------------------------------------------- 1 | /* Builder styling */ 2 | 3 | h3 { 4 | padding: 5px; 5 | border-radius: 5px; 6 | background-color: transparent; 7 | 8 | transition: background-color 600ms; 9 | } 10 | 11 | h3:hover { 12 | background-color: #666; 13 | cursor: pointer; 14 | } 15 | 16 | .triggerLabel:before { 17 | content: "Trigger: "; 18 | color: red; 19 | } 20 | 21 | .conditionLabel:before { 22 | content: "Condition: "; 23 | color: blue; 24 | } 25 | 26 | .targetLabel:before { 27 | content: "Target: "; 28 | color: #080; 29 | } 30 | 31 | .mechanicLabel:before { 32 | content: "Mechanic: "; 33 | color: #f0f; 34 | } 35 | 36 | .componentWrapper { 37 | float: left; 38 | max-width: calc(100% - 24px); 39 | } 40 | 41 | .component { 42 | padding: 5px; 43 | margin: 5px; 44 | border: 2px solid #333; 45 | border-radius: 10px; 46 | font: 18px Sertig-Web; 47 | background-color: #181818; 48 | width: 260px; 49 | height: 90px; 50 | } 51 | 52 | .componentChildren { 53 | margin-left: 20px; 54 | } 55 | 56 | .builderButton { 57 | float: left; 58 | background-color: #043; 59 | width: 90px; 60 | height: 32px; 61 | font: 16px Sertig-Web; 62 | border-radius: 5px; 63 | padding: 5px; 64 | padding-left: 10px; 65 | color: white; 66 | cursor: pointer; 67 | margin: 5px; 68 | 69 | transition: background-color 600ms; 70 | } 71 | 72 | .smallButton { 73 | width: 32px; 74 | } 75 | 76 | .builderButton:hover { 77 | background-color: #666; 78 | } 79 | 80 | /* Form styling */ 81 | -------------------------------------------------------------------------------- /editor/img/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/img/delete.png -------------------------------------------------------------------------------- /editor/img/duplicate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/img/duplicate.png -------------------------------------------------------------------------------- /editor/img/eye.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/img/eye.png -------------------------------------------------------------------------------- /editor/img/eyeShaded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/img/eyeShaded.png -------------------------------------------------------------------------------- /editor/mojave-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/mojave-webfont.eot -------------------------------------------------------------------------------- /editor/mojave-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/mojave-webfont.ttf -------------------------------------------------------------------------------- /editor/sertig-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/sertig-webfont.eot -------------------------------------------------------------------------------- /editor/sertig-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/editor/sertig-webfont.ttf -------------------------------------------------------------------------------- /lib/MCCore-1.67.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/lib/MCCore-1.67.jar -------------------------------------------------------------------------------- /lib/Parties-1.13.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/lib/Parties-1.13.jar -------------------------------------------------------------------------------- /lib/RPGInventory-1.0.6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/lib/RPGInventory-1.0.6.jar -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/CombatProtection.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api; 2 | 3 | import org.bukkit.Bukkit; 4 | import org.bukkit.OfflinePlayer; 5 | import org.bukkit.entity.*; 6 | import org.bukkit.event.entity.EntityDamageByEntityEvent; 7 | import org.bukkit.event.entity.EntityDamageEvent; 8 | import org.jetbrains.annotations.NotNull; 9 | 10 | /** 11 | * SkillAPI © 2018 12 | * com.sucy.skill.api.AllyChecker 13 | */ 14 | public interface CombatProtection { 15 | boolean canAttack(final Player attacker, final Player defender); 16 | boolean canAttack(final Player attacker, final LivingEntity defender); 17 | boolean canAttack(final LivingEntity attacker, final LivingEntity defender); 18 | 19 | static boolean canAttack(LivingEntity attacker, LivingEntity target, boolean passiveAlly) { 20 | if (attacker == target) { 21 | return false; 22 | } else { 23 | if (target instanceof Tameable) { 24 | Tameable entity = (Tameable)target; 25 | if (entity.isTamed() && entity.getOwner() instanceof OfflinePlayer) { 26 | OfflinePlayer owner = (OfflinePlayer)entity.getOwner(); 27 | if (owner.isOnline()) { 28 | return canAttack(attacker, owner.getPlayer(), false); 29 | } 30 | } 31 | } else if (passiveAlly && target instanceof Animals) { 32 | return false; 33 | } 34 | 35 | DefaultCombatProtection.FakeEntityDamageByEntityEvent event = new DefaultCombatProtection.FakeEntityDamageByEntityEvent(attacker, target, EntityDamageEvent.DamageCause.CUSTOM, 1.0D); 36 | Bukkit.getPluginManager().callEvent(event); 37 | return !event.isCancelled(); 38 | } 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/DefaultCombatProtection.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api; 2 | 3 | import com.rit.sucy.player.Protection; 4 | import com.sucy.skill.hook.NoCheatHook; 5 | import com.sucy.skill.hook.PluginChecker; 6 | import org.bukkit.entity.Entity; 7 | import org.bukkit.entity.LivingEntity; 8 | import org.bukkit.entity.Player; 9 | import org.bukkit.event.entity.EntityDamageByEntityEvent; 10 | import org.jetbrains.annotations.NotNull; 11 | 12 | /** 13 | * SkillAPI © 2018 14 | * com.sucy.skill.data.DefaultCombatProtection 15 | */ 16 | public class DefaultCombatProtection implements CombatProtection { 17 | @Override 18 | public boolean canAttack(final Player attacker, final Player defender) { 19 | return canAttack((LivingEntity) attacker, defender); 20 | } 21 | 22 | @Override 23 | public boolean canAttack(final Player attacker, final LivingEntity defender) { 24 | return canAttack((LivingEntity) attacker, defender); 25 | } 26 | 27 | @Override 28 | public boolean canAttack(final LivingEntity attacker, final LivingEntity defender) { 29 | boolean canAttack; 30 | if (PluginChecker.isNoCheatActive() && attacker instanceof Player) { 31 | Player player = (Player) attacker; 32 | NoCheatHook.exempt(player); 33 | canAttack = Protection.canAttack(attacker, defender); 34 | NoCheatHook.unexempt(player); 35 | } else { canAttack = CombatProtection.canAttack(attacker, defender, false); } 36 | 37 | return canAttack; 38 | } 39 | 40 | public static class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent { 41 | 42 | public FakeEntityDamageByEntityEvent(@NotNull Entity damager, @NotNull Entity damagee, @NotNull DamageCause cause, double damage) { 43 | super(damager, damagee, cause, damage); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/armorstand/ArmorStandData.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api.armorstand; 2 | 3 | import org.bukkit.entity.LivingEntity; 4 | 5 | import java.util.HashMap; 6 | import java.util.Iterator; 7 | 8 | public class ArmorStandData { 9 | private final HashMap armorStands = new HashMap<>(); 10 | private final LivingEntity target; 11 | 12 | /** 13 | * @param target target of the armor stands 14 | */ 15 | public ArmorStandData(LivingEntity target) 16 | { 17 | this.target = target; 18 | } 19 | 20 | /** 21 | * @return true if should keep the data, false otherwise 22 | */ 23 | public boolean isValid() { 24 | return armorStands.size() > 0 && target.isValid(); 25 | } 26 | 27 | /** 28 | * Fetches an active armor stand by key 29 | * 30 | * @param key armor stand key 31 | * 32 | * @return active armor stand or null if not found 33 | */ 34 | public ArmorStandInstance getArmorStands(String key) { return armorStands.get(key); } 35 | 36 | public void register(ArmorStandInstance armorStand, String key) { 37 | ArmorStandInstance oldArmorStand = armorStands.put(key, armorStand); 38 | if (oldArmorStand != null) oldArmorStand.remove(); 39 | } 40 | 41 | /** 42 | * Ticks each armor stand for the target 43 | */ 44 | public void tick() { 45 | Iterator iterator = armorStands.values().iterator(); 46 | while (iterator.hasNext()) 47 | { 48 | ArmorStandInstance armorStand = iterator.next(); 49 | if (armorStand.isValid()) { 50 | armorStand.tick(); 51 | } 52 | else { 53 | armorStand.remove(); 54 | iterator.remove(); 55 | } 56 | } 57 | } 58 | 59 | /** 60 | * Removes and unregisters all armor stands for this target 61 | */ 62 | public void remove() { 63 | armorStands.values().forEach(ArmorStandInstance::remove); 64 | armorStands.clear(); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/armorstand/ArmorStandInstance.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api.armorstand; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.entity.ArmorStand; 5 | import org.bukkit.entity.LivingEntity; 6 | import org.bukkit.util.Vector; 7 | 8 | public class ArmorStandInstance { 9 | private final ArmorStand armorStand; 10 | private final LivingEntity target; 11 | private final boolean follow; 12 | private double forward; 13 | private double upward; 14 | private double right; 15 | 16 | private static final Vector UP = new Vector(0, 1, 0); 17 | 18 | public ArmorStandInstance(ArmorStand armorStand, LivingEntity target) { 19 | this.armorStand = armorStand; 20 | this.target = target; 21 | this.follow = false; 22 | } 23 | public ArmorStandInstance(ArmorStand armorStand, LivingEntity target, double forward, double upward, double right) { 24 | this.armorStand = armorStand; 25 | this.target = target; 26 | this.forward = forward; 27 | this.upward = upward; 28 | this.right = right; 29 | this.follow = true; 30 | } 31 | 32 | /** 33 | * @return true if the instance is still valid 34 | */ 35 | public boolean isValid() { 36 | return target.isValid() && armorStand.isValid(); 37 | } 38 | 39 | /** 40 | * Removes the armor stand 41 | */ 42 | public void remove() { 43 | armorStand.remove(); 44 | } 45 | 46 | /** 47 | * Ticks the armor stand 48 | */ 49 | public void tick() { 50 | if (follow) { 51 | Location loc = target.getLocation().clone(); 52 | Vector dir = loc.getDirection().setY(0).normalize(); 53 | Vector side = dir.clone().crossProduct(UP); 54 | loc.add(dir.multiply(forward)).add(0, upward, 0).add(side.multiply(right)); 55 | armorStand.teleport(loc); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/classes/ClassAttribute.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.classes.ClassAttribute 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.classes; 28 | 29 | /** 30 | *

Attribute names for class attributes

31 | */ 32 | public final class ClassAttribute 33 | { 34 | /** 35 | * Maximum health for a class 36 | */ 37 | public static final String HEALTH = "health"; 38 | 39 | /** 40 | * Maximum mana for a class 41 | */ 42 | public static final String MANA = "mana"; 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/classes/TreeType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.classes.TreeType 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.classes; 28 | 29 | import com.sucy.skill.SkillAPI; 30 | import com.sucy.skill.tree.basic.InventoryTree; 31 | 32 | /** 33 | * Interface class for extensions of the available skill 34 | * trees. Simply implement this to provide the SkillTree 35 | * implementation and then set a class's tree type. 36 | */ 37 | public interface TreeType 38 | { 39 | /** 40 | * Retrieves a new instance of a skill tree using 41 | * the given type. 42 | * 43 | * @param api - SkillAPI reference 44 | * @param parent - Parent class to organize 45 | * 46 | * @return skill tree instance 47 | */ 48 | InventoryTree getTree(SkillAPI api, RPGClass parent); 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/enums/Direction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.enums.Direction 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.enums; 28 | 29 | /** 30 | * Direction used in the Particle class that are defined by what directions it uses for 2D shapes 31 | */ 32 | public enum Direction 33 | { 34 | 35 | /** 36 | * X-axis and Y-axis 37 | */ 38 | XY, 39 | 40 | /** 41 | * Y-axis and Z-axis 42 | */ 43 | YZ, 44 | 45 | /** 46 | * X-axis and Z-axis 47 | */ 48 | XZ 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/enums/ManaCost.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.enums.ManaCost 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.enums; 28 | 29 | /** 30 | *

A collection of possible reasons mana was deducted from a player.

31 | *

This is used when deducting mana from a player to allow effects 32 | * to react differently depending on why it is being deducted.

33 | */ 34 | public enum ManaCost 35 | { 36 | /** 37 | * The player cast a skill that used some mana 38 | */ 39 | SKILL_CAST, 40 | 41 | /** 42 | * The player was affected by a skill effect that reduced their mana 43 | */ 44 | SKILL_EFFECT, 45 | 46 | /** 47 | * The player lost mana for some unspecified reason 48 | */ 49 | SPECIAL, 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/enums/ManaSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.enums.ManaSource 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.enums; 28 | 29 | /** 30 | *

A collection of possible reasons mana was gained by a player.

31 | *

This is used when giving mana to a player to allow effects 32 | * to react differently depending on why it is being added.

33 | */ 34 | public enum ManaSource 35 | { 36 | /** 37 | * The player regenerated some mana back passively 38 | */ 39 | REGEN, 40 | 41 | /** 42 | * A skill effect replenished some of their mana 43 | */ 44 | SKILL, 45 | 46 | /** 47 | * A command restored some of their mana 48 | */ 49 | COMMAND, 50 | 51 | /** 52 | * The player gained mana for an unspecified reason 53 | */ 54 | SPECIAL, 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/enums/PointSource.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.enums.PointSource 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.enums; 28 | 29 | /** 30 | *

A collection of possible reasons skill points were gained by a player.

31 | *

This is used when giving skill points to a player to allow effects 32 | * to react differently depending on why it is being added.

33 | */ 34 | public enum PointSource 35 | { 36 | /** 37 | * The player leveled up to get more skill points 38 | */ 39 | LEVEL, 40 | 41 | /** 42 | * The player downgraded a skill and was refunded the skill points 43 | */ 44 | REFUND, 45 | 46 | /** 47 | * A command gave the player additional skill points 48 | */ 49 | COMMAND, 50 | 51 | /** 52 | * The player was given skill points for an unspecified reason 53 | */ 54 | SPECIAL, 55 | 56 | /** 57 | * The skill points are from the player's data being initialized on startup 58 | */ 59 | INITIALIZATION, 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/enums/SkillStatus.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.enums.SkillStatus 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.enums; 28 | 29 | /** 30 | * Statuses for a skill in relation to a player 31 | */ 32 | public enum SkillStatus 33 | { 34 | 35 | /** 36 | * The skill is currently on cooldown 37 | */ 38 | ON_COOLDOWN, 39 | 40 | /** 41 | * The player requires more mana before using the skill 42 | */ 43 | MISSING_MANA, 44 | 45 | /** 46 | * The skill is ready to be used 47 | */ 48 | READY 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/event/KeyPressEvent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api.event; 2 | 3 | import org.bukkit.entity.Player; 4 | import org.bukkit.event.Event; 5 | import org.bukkit.event.HandlerList; 6 | 7 | /** 8 | * SkillAPI © 2018 9 | * com.sucy.skill.api.event.KeyPressEvent 10 | */ 11 | public class KeyPressEvent extends Event { 12 | private static final HandlerList handlers = new HandlerList(); 13 | 14 | private final Player player; 15 | private final Key key; 16 | 17 | public KeyPressEvent(final Player player, final Key key) { 18 | this.player = player; 19 | this.key = key; 20 | } 21 | 22 | public Player getPlayer() { 23 | return player; 24 | } 25 | 26 | public Key getKey() { 27 | return key; 28 | } 29 | 30 | @Override 31 | public HandlerList getHandlers() { 32 | return handlers; 33 | } 34 | 35 | public static HandlerList getHandlerList() { 36 | return handlers; 37 | } 38 | 39 | public enum Key { 40 | LEFT, RIGHT, Q 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/event/PlayerSkillCastFailedEvent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.api.event; 2 | 3 | import com.sucy.skill.api.player.PlayerData; 4 | import com.sucy.skill.api.player.PlayerSkill; 5 | import org.bukkit.Bukkit; 6 | import org.bukkit.event.Event; 7 | import org.bukkit.event.HandlerList; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.api.event.PlayerSkillCastFailedEvent 12 | */ 13 | public class PlayerSkillCastFailedEvent extends Event { 14 | 15 | public enum Cause { 16 | CANCELED, 17 | CASTER_DEAD, 18 | EFFECT_FAILED, 19 | NO_MANA, 20 | NO_TARGET, 21 | NOT_UNLOCKED, 22 | ON_COOLDOWN, 23 | SPECTATOR 24 | } 25 | 26 | private static final HandlerList handlers = new HandlerList(); 27 | private PlayerSkill skill; 28 | private Cause cause; 29 | 30 | private PlayerSkillCastFailedEvent(final PlayerSkill skill, final Cause cause) { 31 | this.skill = skill; 32 | this.cause = cause; 33 | } 34 | 35 | public static boolean invoke(final PlayerSkill skill, final Cause cause) { 36 | Bukkit.getPluginManager().callEvent(new PlayerSkillCastFailedEvent(skill, cause)); 37 | return false; 38 | } 39 | 40 | /** 41 | * @return player trying to cast the skill 42 | */ 43 | public PlayerData getPlayerData() { 44 | return skill.getPlayerData(); 45 | } 46 | 47 | /** 48 | * @return skill that was attempted to be cast 49 | */ 50 | public PlayerSkill getSkill() { 51 | return skill; 52 | } 53 | 54 | /** 55 | * @return reason the skill cast failed 56 | */ 57 | public Cause getCause() { 58 | return cause; 59 | } 60 | 61 | /** 62 | * Retrieves the handlers for the event 63 | * 64 | * @return list of event handlers 65 | */ 66 | @Override 67 | public HandlerList getHandlers() { 68 | return handlers; 69 | } 70 | 71 | /** 72 | * Retrieves the handlers for the event 73 | * 74 | * @return list of event handlers 75 | */ 76 | public static HandlerList getHandlerList() { 77 | return handlers; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/exception/SkillTreeException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.exception.SkillTreeException 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.exception; 28 | 29 | /** 30 | * Exception for generating skill trees 31 | */ 32 | public class SkillTreeException extends Exception 33 | { 34 | /** 35 | * Constructor 36 | * 37 | * @param message exception message 38 | */ 39 | public SkillTreeException(String message) 40 | { 41 | super(message); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/particle/direction/Directions.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.particle.direction.Directions 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.particle.direction; 28 | 29 | /** 30 | * Handles getting a direction handler by name 31 | */ 32 | public class Directions 33 | { 34 | /** 35 | * Fetches the direction handler by name, defaulting 36 | * to XZ if invalid 37 | * 38 | * @param name XY, XZ, or YZ 39 | * 40 | * @return corresponding handler or XZ if invalid 41 | */ 42 | public static DirectionHandler byName(String name) 43 | { 44 | if (name.equalsIgnoreCase("XY")) 45 | return XYHandler.instance; 46 | else if (name.equals("YZ")) 47 | return YZHandler.instance; 48 | else 49 | return XZHandler.instance; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/particle/target/EffectTarget.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.particle.entity.EffectTarget 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.particle.target; 28 | 29 | import org.bukkit.Location; 30 | 31 | /** 32 | * Handles grabbing the location for a particle effect 33 | */ 34 | public interface EffectTarget 35 | { 36 | /** 37 | * Gets the location to center the effect around 38 | * 39 | * @return effect location 40 | */ 41 | public Location getLocation(); 42 | 43 | /** 44 | * @return tue if target is still valid, false otherwise 45 | */ 46 | public boolean isValid(); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/particle/target/Followable.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.particle.target.Followable 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.particle.target; 28 | 29 | import org.bukkit.Location; 30 | 31 | /** 32 | * Interface allowing something to be followed by particle effects 33 | */ 34 | public interface Followable 35 | { 36 | /** 37 | * @return retrieves the location of the object 38 | */ 39 | public Location getLocation(); 40 | 41 | /** 42 | * @return true if can be followed still 43 | */ 44 | public boolean isValid(); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/projectile/ProjectileCallback.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.projectile.ProjectileCallback 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.projectile; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | /** 32 | * Callback interface for receiving when/what a specific projectile hits 33 | */ 34 | public interface ProjectileCallback 35 | { 36 | /** 37 | * The callback method for when a projectile hits something or lands 38 | * on the ground. This is not called when the projectile expires. If 39 | * the projectile landed on the ground without hitting anything, the 40 | * "hit" living entity will be null. 41 | * 42 | * @param projectile projectile calling back for 43 | * @param hit the entity hit by the projectile, if any 44 | */ 45 | void callback(CustomProjectile projectile, LivingEntity hit); 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/skills/SkillShot.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.skills.SkillShot 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.skills; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | /** 32 | *

Interface for skills that can be cast without a direct target

33 | *

Common applications would include firing projectiles, self-targeting 34 | * skills, and AOE abilities around yourself or where you are looking

35 | */ 36 | public interface SkillShot 37 | { 38 | /** 39 | * Casts the skill 40 | * 41 | * @param user user of the skill 42 | * @param level skill level 43 | * 44 | * @return true if could cast, false otherwise 45 | */ 46 | boolean cast(LivingEntity user, int level); 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/skills/TargetSkill.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.skills.TargetSkill 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.skills; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | /** 32 | *

Interface for skills that require a specific target to cast

33 | */ 34 | public interface TargetSkill 35 | { 36 | 37 | /** 38 | * Casts the skill 39 | * 40 | * @param user user of the skill 41 | * @param target target of the skill 42 | * @param level skill level 43 | * @param ally whether or not the target is an ally 44 | * 45 | * @return true if could cast, false otherwise 46 | */ 47 | boolean cast(LivingEntity user, LivingEntity target, int level, boolean ally); 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/api/util/BuffType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.api.util.BuffType 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.api.util; 28 | 29 | public enum BuffType 30 | { 31 | DAMAGE, 32 | DEFENSE, 33 | SKILL_DAMAGE, 34 | SKILL_DEFENSE, 35 | HEALING 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/cast/IIndicator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.cast.IIndicator 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.cast; 28 | 29 | import com.sucy.skill.api.particle.ParticleSettings; 30 | import org.bukkit.Location; 31 | 32 | import java.util.List; 33 | 34 | public interface IIndicator 35 | { 36 | public void moveTo(Location loc); 37 | 38 | public void moveTo(double x, double y, double z); 39 | 40 | public void makePackets(List packets, ParticleSettings particle, int step) 41 | throws Exception; 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/cast/IndicatorSettings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.cast.IndicatorSettings 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.cast; 28 | 29 | import com.rit.sucy.config.parse.DataSection; 30 | import com.sucy.skill.api.particle.ParticleSettings; 31 | 32 | /** 33 | * An indicator for a player's skill 34 | */ 35 | public class IndicatorSettings 36 | { 37 | public static ParticleSettings particle; 38 | 39 | public static boolean enabled; 40 | public static double density; 41 | public static double animation; 42 | public static int interval; 43 | 44 | public static void load(DataSection data) 45 | { 46 | enabled = data.getBoolean("enabled"); 47 | density = data.getDouble("density"); 48 | animation = data.getDouble("animation"); 49 | interval = (int) Math.ceil(20 / data.getDouble("frequency")); 50 | particle = new ParticleSettings(data.getSection("particle")); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/cast/PlayerView.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.cast.PlayerView 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.cast; 28 | 29 | /** 30 | * Types of views the player can currently be in 31 | */ 32 | public enum PlayerView 33 | { 34 | // Default view, having the normal inventory items 35 | INVENTORY, 36 | 37 | // Skill bar for hovering over skills 38 | HOVER_BAR, 39 | 40 | // Skill bar for instant-casting skills 41 | INSTANT_BAR, 42 | 43 | // GUI for organizing skill bars 44 | ORGANIZER 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/cmd/CmdReload.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.cmd.CmdReload 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.cmd; 28 | 29 | import com.rit.sucy.commands.ConfigurableCommand; 30 | import com.rit.sucy.commands.IFunction; 31 | import com.sucy.skill.SkillAPI; 32 | import org.bukkit.command.CommandSender; 33 | import org.bukkit.plugin.Plugin; 34 | 35 | /** 36 | * A command that allows a player to profess through classes 37 | */ 38 | public class CmdReload implements IFunction 39 | { 40 | private static final String DONE = "done"; 41 | 42 | /** 43 | * Runs the command 44 | * 45 | * @param cmd command that was executed 46 | * @param plugin plugin reference 47 | * @param sender sender of the command 48 | * @param args argument list 49 | */ 50 | @Override 51 | public void execute(ConfigurableCommand cmd, Plugin plugin, CommandSender sender, String[] args) 52 | { 53 | SkillAPI.reload(); 54 | cmd.sendMessage(sender, DONE, "&2The plugin has been reloaded"); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/ExpFormula.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.ExpFormula 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data; 28 | 29 | /** 30 | * Represents an experience formula from the settings 31 | */ 32 | public class ExpFormula 33 | { 34 | private int x, y, z; 35 | 36 | /** 37 | * Creates a new formula 38 | * 39 | * @param x quadratic coefficient 40 | * @param y linear coefficient 41 | * @param z intercept 42 | */ 43 | public ExpFormula(int x, int y, int z) 44 | { 45 | this.x = x; 46 | this.y = y; 47 | this.z = z; 48 | } 49 | 50 | /** 51 | * Calculates the required experience at a given level 52 | * 53 | * @param level level to calculate for 54 | * 55 | * @return required experience at the level 56 | */ 57 | public int calculate(int level) 58 | { 59 | return x * level * level + y * level + z; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/PlayerSettings.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.PlayerSettings 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2017 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data; 28 | 29 | public class PlayerSettings { 30 | public boolean showCastMessages; 31 | public boolean showLevelUpMessage; 32 | public boolean showExpMessage; 33 | public boolean showParticles; 34 | public boolean oldHealthBar; 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/Point2D.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.Point2D 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data; 28 | 29 | public class Point2D 30 | { 31 | public double x; 32 | public double y; 33 | 34 | public Point2D() 35 | { 36 | this.x = this.y = 0; 37 | } 38 | 39 | public Point2D(double x, double y) 40 | { 41 | this.x = x; 42 | this.y = y; 43 | } 44 | 45 | public void rotate(double cos, double sin) 46 | { 47 | double temp = x * cos - y * sin; 48 | y = x * sin + y * cos; 49 | x = temp; 50 | } 51 | 52 | @Override 53 | public String toString() 54 | { 55 | return "(" + String.format("%.2f", x) + ", " + String.format("%.2f", y) + ")"; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/Point3D.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.Point 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data; 28 | 29 | public class Point3D 30 | { 31 | public double x; 32 | public double y; 33 | public double z; 34 | 35 | public Point3D() 36 | { 37 | this.x = this.y = this.z = 0; 38 | } 39 | 40 | public Point3D(double x, double y, double z) 41 | { 42 | this.x = x; 43 | this.y = y; 44 | this.z = z; 45 | } 46 | 47 | @Override 48 | public String toString() 49 | { 50 | return "(" + String.format("%.2f", x) + ", " + String.format("%.2f", y) + ", " + String.format("%.2f", z) + ")"; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/TitleType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.TitleMessageType 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data; 28 | 29 | /** 30 | * Supported message types for the Title display 31 | */ 32 | public enum TitleType 33 | { 34 | EXP_GAINED, 35 | EXP_LOST, 36 | LEVEL_UP, 37 | STATUS, 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/IOperator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.IOperator 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula; 28 | 29 | /** 30 | * A single operation used in formulas 31 | */ 32 | public interface IOperator 33 | { 34 | /** 35 | * Performs the operation between the two values 36 | * 37 | * @param a first value 38 | * @param b second value 39 | * 40 | * @return result 41 | */ 42 | public double compute(double a, double b); 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/IValue.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.IValue 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula; 28 | 29 | /** 30 | * Represents a value in a formula 31 | */ 32 | public interface IValue 33 | { 34 | /** 35 | * Gets the value using the two inputs 36 | * 37 | * @param input the input data 38 | * 39 | * @return result value 40 | */ 41 | public double compute(double... input); 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Abs.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Abs 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | public class Abs implements IValue 32 | { 33 | private IValue formula; 34 | 35 | /** 36 | * @param formula wrapped formula 37 | */ 38 | public Abs(IValue formula) 39 | { 40 | this.formula = formula; 41 | } 42 | 43 | /** 44 | * Gets the value using the inputs 45 | * 46 | * @param input the input data 47 | * 48 | * @return result value 49 | */ 50 | @Override 51 | public double compute(double... input) 52 | { 53 | return Math.abs(formula.compute(input)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Ceil.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Ceil 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | /** 32 | * Ceilings a number 33 | */ 34 | public class Ceil implements IValue 35 | { 36 | private IValue formula; 37 | 38 | /** 39 | * @param formula wrapped formula 40 | */ 41 | public Ceil(IValue formula) 42 | { 43 | this.formula = formula; 44 | } 45 | 46 | /** 47 | * Gets the value using the inputs 48 | * 49 | * @param input the input data 50 | * 51 | * @return result value 52 | */ 53 | @Override 54 | public double compute(double... input) 55 | { 56 | return Math.ceil(formula.compute(input)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Cos.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.value.func.Cos 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.Formula; 30 | import com.sucy.skill.data.formula.IValue; 31 | 32 | /** 33 | * Cosine function 34 | */ 35 | public class Cos implements IValue 36 | { 37 | private IValue value; 38 | 39 | /** 40 | * @param formula wrapped value 41 | */ 42 | public Cos(IValue formula) 43 | { 44 | this.value = formula; 45 | } 46 | 47 | /** 48 | * Gets the value using the inputs 49 | * 50 | * @param input the input data 51 | * 52 | * @return result value 53 | */ 54 | @Override 55 | public double compute(double... input) 56 | { 57 | return Math.cos(value.compute(input) * Formula.DEG_TO_RAD); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Floor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Floor 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | /** 32 | * Floors a number 33 | */ 34 | public class Floor implements IValue 35 | { 36 | private IValue formula; 37 | 38 | /** 39 | * @param formula wrapped formula 40 | */ 41 | public Floor(IValue formula) 42 | { 43 | this.formula = formula; 44 | } 45 | 46 | /** 47 | * Gets the value using the inputs 48 | * 49 | * @param input the input data 50 | * 51 | * @return result value 52 | */ 53 | @Override 54 | public double compute(double... input) 55 | { 56 | return Math.floor(formula.compute(input)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Root.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Root 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | /** 32 | * Square root of a number 33 | */ 34 | public class Root implements IValue 35 | { 36 | private IValue formula; 37 | 38 | /** 39 | * @param formula wrapped formula 40 | */ 41 | public Root(IValue formula) 42 | { 43 | this.formula = formula; 44 | } 45 | 46 | /** 47 | * Gets the value using the inputs 48 | * 49 | * @param input the input data 50 | * 51 | * @return result value 52 | */ 53 | @Override 54 | public double compute(double... input) 55 | { 56 | return Math.sqrt(formula.compute(input)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Sign.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Sign 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | /** 32 | * Sign function 33 | */ 34 | public class Sign implements IValue 35 | { 36 | private IValue formula; 37 | 38 | /** 39 | * @param formula wrapped formula 40 | */ 41 | public Sign(IValue formula) 42 | { 43 | this.formula = formula; 44 | } 45 | 46 | /** 47 | * Gets the value using the inputs 48 | * 49 | * @param input the input data 50 | * 51 | * @return result value 52 | */ 53 | @Override 54 | public double compute(double... input) 55 | { 56 | double val = formula.compute(input); 57 | if (val == 0) 58 | return 0.0; 59 | else if (val < 0) 60 | return -1.0; 61 | else 62 | return 1.0; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Sin.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Sin 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.Formula; 30 | import com.sucy.skill.data.formula.IValue; 31 | 32 | /** 33 | * Sine function 34 | */ 35 | public class Sin implements IValue 36 | { 37 | private IValue formula; 38 | 39 | /** 40 | * @param formula wrapped formula 41 | */ 42 | public Sin(IValue formula) 43 | { 44 | this.formula = formula; 45 | } 46 | 47 | /** 48 | * Gets the value using the inputs 49 | * 50 | * @param input the input data 51 | * 52 | * @return result value 53 | */ 54 | @Override 55 | public double compute(double... input) 56 | { 57 | return Math.sin(formula.compute(input) * Formula.DEG_TO_RAD); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Square.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Square 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.IValue; 30 | 31 | /** 32 | * Squares a number 33 | */ 34 | public class Square implements IValue 35 | { 36 | private IValue formula; 37 | 38 | /** 39 | * @param formula wrapped formula 40 | */ 41 | public Square(IValue formula) 42 | { 43 | this.formula = formula; 44 | } 45 | 46 | /** 47 | * Gets the value using the inputs 48 | * 49 | * @param input the input data 50 | * 51 | * @return result value 52 | */ 53 | @Override 54 | public double compute(double... input) 55 | { 56 | double val = formula.compute(input); 57 | return val * val; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/func/Tan.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.func.Tan 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.func; 28 | 29 | import com.sucy.skill.data.formula.Formula; 30 | import com.sucy.skill.data.formula.IValue; 31 | 32 | /** 33 | * Tangent function 34 | */ 35 | public class Tan implements IValue 36 | { 37 | private IValue formula; 38 | 39 | /** 40 | * @param formula wrapped formula 41 | */ 42 | public Tan(IValue formula) 43 | { 44 | this.formula = formula; 45 | } 46 | 47 | /** 48 | * Gets the value using the inputs 49 | * 50 | * @param input the input data 51 | * 52 | * @return result value 53 | */ 54 | @Override 55 | public double compute(double... input) 56 | { 57 | return Math.tan(formula.compute(input) * Formula.DEG_TO_RAD); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Addition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Addition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The addition operation used in formulas 33 | */ 34 | public class Addition implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return a + b; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Division.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Division 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The division operation used in formulas 33 | */ 34 | public class Division implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return b == 0 ? 0 : a / b; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Exponent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Exponent 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The exponent operation used in formulas 33 | */ 34 | public class Exponent implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return Math.pow(a, b); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Log.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Log 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The exponent operation used in formulas 33 | */ 34 | public class Log implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return a <= 0 || b <= 0 ? 0 : Math.log(a) / Math.log(b); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Modulo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Modulo 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * Modulo operator 33 | */ 34 | public class Modulo implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return a % b; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Multiplication.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Multiplication 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The multiplication operation used in formulas 33 | */ 34 | public class Multiplication implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return a * b; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/operator/Subtraction.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.operator.Subtraction 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.operator; 28 | 29 | import com.sucy.skill.data.formula.IOperator; 30 | 31 | /** 32 | * The subtraction operation used in formulas 33 | */ 34 | public class Subtraction implements IOperator 35 | { 36 | /** 37 | * Performs the operation between the two values 38 | * 39 | * @param a first value 40 | * @param b second value 41 | * 42 | * @return result 43 | */ 44 | public double compute(double a, double b) 45 | { 46 | return a - b; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/data/formula/value/ValueNum.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.data.formula.value.ValueNum 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.data.formula.value; 28 | 29 | import com.rit.sucy.config.parse.NumberParser; 30 | import com.sucy.skill.data.formula.IValue; 31 | 32 | /** 33 | * The attribute value 34 | */ 35 | public class ValueNum implements IValue 36 | { 37 | private double value; 38 | 39 | /** 40 | * @param value value to use 41 | */ 42 | public ValueNum(String value) 43 | { 44 | this.value = NumberParser.parseDouble(value); 45 | } 46 | 47 | /** 48 | * @param value value to use 49 | */ 50 | public ValueNum(double value) 51 | { 52 | this.value = value; 53 | } 54 | 55 | /** 56 | * Gets the value using the two inputs 57 | * 58 | * @param input the input data 59 | * 60 | * @return result value 61 | */ 62 | @Override 63 | public double compute(double... input) 64 | { 65 | return value; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/ComponentType.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic; 2 | 3 | /** 4 | * SkillAPI © 2018 5 | * com.sucy.skill.dynamic.ComponentType 6 | */ 7 | public enum ComponentType { 8 | CONDITION, 9 | MECHANIC, 10 | TARGET, 11 | TRIGGER 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/CeilingCondition.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import org.bukkit.block.Block; 4 | import org.bukkit.entity.LivingEntity; 5 | 6 | public class CeilingCondition extends ConditionComponent 7 | { 8 | private static final String DISTANCE = "distance"; 9 | private static final String AT_LEAST = "at-least"; 10 | 11 | @Override 12 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 13 | final boolean atLeast = settings.getBool(AT_LEAST, true); 14 | final int distance = (int) parseValues(caster, DISTANCE, level, 5); 15 | 16 | final Block block = target.getLocation().getBlock(); 17 | boolean ceiling = false; 18 | for (int i = 2; i < distance; i++) { 19 | if (block.getRelative(0, i, 0).getType().isSolid()) { 20 | ceiling = true; 21 | break; 22 | } 23 | } 24 | return ceiling != atLeast; 25 | } 26 | 27 | @Override 28 | public String getKey() { 29 | return "ceiling"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/ChanceCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.ChanceCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | import java.util.Random; 32 | 33 | public class ChanceCondition extends ConditionComponent 34 | { 35 | private static final String CHANCE = "chance"; 36 | private static final Random random = new Random(); 37 | 38 | @Override 39 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 40 | final double chance = parseValues(caster, CHANCE, level, 25) / 100.0; 41 | return random.nextDouble() < chance; 42 | } 43 | 44 | @Override 45 | public String getKey() { 46 | return "chance"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/ConditionComponent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import com.sucy.skill.dynamic.ComponentType; 4 | import com.sucy.skill.dynamic.EffectComponent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.List; 8 | import java.util.stream.Collectors; 9 | 10 | /** 11 | * SkillAPI © 2018 12 | * com.sucy.skill.dynamic.condition.ConditionComponent 13 | */ 14 | public abstract class ConditionComponent extends EffectComponent { 15 | 16 | /** {@inheritDoc} */ 17 | @Override 18 | public ComponentType getType() { 19 | return ComponentType.CONDITION; 20 | } 21 | 22 | /** {@inheritDoc} */ 23 | @Override 24 | public boolean execute( 25 | final LivingEntity caster, final int level, final List targets) { 26 | 27 | final List filtered = targets.stream() 28 | .filter(t -> test(caster, level, t)) 29 | .collect(Collectors.toList()); 30 | 31 | return filtered.size() > 0 && executeChildren(caster, level, filtered); 32 | } 33 | 34 | abstract boolean test(final LivingEntity caster, final int level, final LivingEntity target); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/ElseCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.ElseCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | import java.util.List; 32 | 33 | /** 34 | * A simple "else" condition, applying if the previous component failed 35 | */ 36 | public class ElseCondition extends ConditionComponent { 37 | 38 | @Override 39 | public String getKey() { 40 | return "else"; 41 | } 42 | 43 | @Override 44 | public boolean execute(LivingEntity caster, int level, List targets) { 45 | return test(caster, level, null) && executeChildren(caster, level, targets); 46 | } 47 | 48 | @Override 49 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 50 | return !lastPassed(); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/FireCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.FireCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | /** 32 | * A condition for dynamic skills that requires the target to be on fire 33 | */ 34 | public class FireCondition extends ConditionComponent { 35 | private static final String TYPE = "type"; 36 | 37 | @Override 38 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 39 | final boolean onFire = !settings.getString(TYPE, "on fire").toLowerCase().equals("not on fire"); 40 | return (target.getFireTicks() > 0) == onFire; 41 | } 42 | 43 | @Override 44 | public String getKey() { 45 | return "fire"; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/FlagCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.FlagCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import com.sucy.skill.api.util.FlagManager; 30 | import org.bukkit.entity.LivingEntity; 31 | 32 | /** 33 | * A condition for dynamic skills that requires the target to have a specified flag active 34 | */ 35 | public class FlagCondition extends ConditionComponent { 36 | private static final String TYPE = "type"; 37 | private static final String KEY = "key"; 38 | 39 | @Override 40 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 41 | final String flag = settings.getString(KEY); 42 | final boolean set = !settings.getString(TYPE, "set").toLowerCase().equals("not set"); 43 | return FlagManager.hasFlag(target, flag) == set; 44 | } 45 | 46 | @Override 47 | public String getKey() { 48 | return "flag"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/GroundCondition.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import org.bukkit.entity.LivingEntity; 4 | 5 | /** 6 | * SkillAPI © 2018 7 | * com.sucy.skill.dynamic.condition.Ground 8 | */ 9 | public class GroundCondition extends ConditionComponent { 10 | private static final String type = "type"; 11 | 12 | @Override 13 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 14 | final boolean onGround = target.isOnGround(); 15 | final boolean wantOnGround = settings.getString(type, "on ground").equalsIgnoreCase("on ground"); 16 | return onGround == wantOnGround; 17 | } 18 | 19 | @Override 20 | public String getKey() { 21 | return "ground"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/InventoryCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.InventoryCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import com.sucy.skill.dynamic.ItemChecker; 30 | import org.bukkit.entity.LivingEntity; 31 | import org.bukkit.entity.Player; 32 | 33 | /** 34 | * A condition for dynamic skills that requires the target to have a specified item 35 | */ 36 | public class InventoryCondition extends ConditionComponent { 37 | @Override 38 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 39 | return target instanceof Player && ItemChecker.check((Player) target, level, this, false); 40 | } 41 | 42 | @Override 43 | public String getKey() { 44 | return "inventory"; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/ItemCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.ItemCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import com.sucy.skill.dynamic.ItemChecker; 30 | import org.bukkit.entity.LivingEntity; 31 | 32 | /** 33 | * A condition for dynamic skills that requires the target to have a specified held item 34 | */ 35 | public class ItemCondition extends ConditionComponent { 36 | @Override 37 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 38 | return target.getEquipment() != null && ItemChecker.check( 39 | target.getEquipment().getItemInHand(), 40 | level, 41 | settings); 42 | } 43 | 44 | @Override 45 | public String getKey() { 46 | return "item"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/LightCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.LightCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | /** 32 | * A condition for dynamic skills that requires the lighting at the target's location to be within a range 33 | */ 34 | public class LightCondition extends ConditionComponent { 35 | private static final String MIN = "min-light"; 36 | private static final String MAX = "max-light"; 37 | 38 | @Override 39 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 40 | final double min = parseValues(caster, MIN, level, 0); 41 | final double max = parseValues(caster, MAX, level, 0); 42 | final double light = target.getLocation().getBlock().getLightLevel(); 43 | return light >= min && light <= max; 44 | } 45 | 46 | @Override 47 | public String getKey() { 48 | return "light"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/MountedCondition.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import com.rit.sucy.config.parse.DataSection; 4 | import com.sucy.skill.dynamic.DynamicSkill; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Collections; 8 | import java.util.Set; 9 | import java.util.stream.Collectors; 10 | 11 | public class MountedCondition extends ConditionComponent { 12 | 13 | private static final String TYPE = "types"; 14 | 15 | private Set types; 16 | 17 | @Override 18 | public String getKey() { 19 | return "mounted"; 20 | } 21 | 22 | @Override 23 | public void load(DynamicSkill skill, DataSection config) { 24 | super.load(skill, config); 25 | types = settings.getStringList(TYPE).stream() 26 | .map(s -> s.toUpperCase().replace(' ', '_')) 27 | .collect(Collectors.toSet()); 28 | } 29 | 30 | @Override 31 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 32 | Set passengers = target.getPassengers().stream() 33 | .map(e -> e.getType().name()) 34 | .collect(Collectors.toSet()); 35 | return !passengers.isEmpty() && (types.isEmpty() || types.contains("ANY") || !Collections.disjoint(passengers,types)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/MountingCondition.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import com.rit.sucy.config.parse.DataSection; 4 | import com.sucy.skill.dynamic.DynamicSkill; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Set; 8 | import java.util.stream.Collectors; 9 | 10 | public class MountingCondition extends ConditionComponent { 11 | 12 | private static final String TYPE = "types"; 13 | 14 | private Set types; 15 | 16 | @Override 17 | public String getKey() { 18 | return "mounting"; 19 | } 20 | 21 | @Override 22 | public void load(DynamicSkill skill, DataSection config) { 23 | super.load(skill, config); 24 | types = settings.getStringList(TYPE).stream() 25 | .map(s -> s.toUpperCase().replace(' ', '_')) 26 | .collect(Collectors.toSet()); 27 | } 28 | 29 | @Override 30 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 31 | return target.isInsideVehicle() && (types.isEmpty() || types.contains("ANY") || types.contains(target.getVehicle().getType().name())); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/OffhandCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.OffhandCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import com.sucy.skill.dynamic.ItemChecker; 30 | import org.bukkit.entity.LivingEntity; 31 | import org.bukkit.inventory.EntityEquipment; 32 | 33 | /** 34 | * Item condition for a player's off hand 35 | */ 36 | public class OffhandCondition extends ConditionComponent { 37 | @Override 38 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 39 | final EntityEquipment equipment = target.getEquipment(); 40 | return equipment != null && ItemChecker.check(target.getEquipment().getItemInOffHand(), level, settings); 41 | } 42 | 43 | @Override 44 | public String getKey() { 45 | return "offhand"; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/PermissionCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.PermissionCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | import java.util.List; 32 | 33 | public class PermissionCondition extends ConditionComponent { 34 | private static final String PERM = "perm"; 35 | 36 | @Override 37 | public String getKey() { 38 | return "permission"; 39 | } 40 | 41 | @Override 42 | public boolean execute(LivingEntity caster, int level, List targets) { 43 | return test(caster, level, null) && executeChildren(caster, level, targets); 44 | } 45 | 46 | @Override 47 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 48 | return caster.hasPermission(settings.getString(PERM)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/SlotCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.SlotCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import com.sucy.skill.dynamic.ItemChecker; 30 | import org.bukkit.entity.LivingEntity; 31 | import org.bukkit.entity.Player; 32 | import org.bukkit.inventory.PlayerInventory; 33 | 34 | public class SlotCondition extends ConditionComponent 35 | { 36 | private static final String SLOT = "slot"; 37 | 38 | @Override 39 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 40 | if (!(target instanceof Player)) return false; 41 | 42 | final PlayerInventory inventory = ((Player) target).getInventory(); 43 | return settings.getStringList(SLOT).stream().anyMatch( 44 | slot -> ItemChecker.check(inventory.getItem(Integer.parseInt(slot)), level, settings)); 45 | } 46 | 47 | @Override 48 | public String getKey() { 49 | return "slot"; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/WaterCondition.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.condition.WaterCondition 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.condition; 28 | 29 | import org.bukkit.Material; 30 | import org.bukkit.entity.LivingEntity; 31 | 32 | /** 33 | * A condition for dynamic skills that requires the target to have a specified potion effect 34 | */ 35 | public class WaterCondition extends ConditionComponent { 36 | private static final String STATE = "state"; 37 | 38 | @Override 39 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 40 | final boolean out = settings.getString(STATE).toLowerCase().equals("out of water"); 41 | final Material block = target.getLocation().getBlock().getType(); 42 | return out != (block.name().contains("WATER")); 43 | } 44 | 45 | @Override 46 | public String getKey() { 47 | return "water"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/condition/WeatherCondition.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.condition; 2 | 3 | import org.bukkit.Location; 4 | import org.bukkit.World; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | /** 8 | * SkillAPI © 2018 9 | * com.sucy.skill.dynamic.condition.Weather 10 | */ 11 | public class WeatherCondition extends ConditionComponent { 12 | private String TYPE = "type"; 13 | 14 | @Override 15 | boolean test(final LivingEntity caster, final int level, final LivingEntity target) { 16 | final String type = settings.getString(TYPE).toLowerCase(); 17 | final World world = target.getWorld(); 18 | final Location loc = target.getLocation(); 19 | final double temperature = loc.getBlock().getTemperature(); 20 | 21 | switch (type) { 22 | case "thunder": 23 | return world.isThundering() && temperature <= 1; 24 | case "rain": 25 | return world.hasStorm() && temperature > 0.15 && temperature <= 1; 26 | case "snow": 27 | return world.hasStorm() && temperature <= 0.15; 28 | default: 29 | return !world.hasStorm() || temperature > 1; 30 | } 31 | } 32 | 33 | @Override 34 | public String getKey() { 35 | return "weather"; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/custom/CustomComponent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.custom; 2 | 3 | import com.sucy.skill.dynamic.ComponentType; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * SkillAPI © 2018 9 | * com.sucy.skill.dynamic.custom.CustomComponent 10 | */ 11 | public interface CustomComponent { 12 | 13 | /** 14 | * @return unique key for your component (what is used in skill .yml files) 15 | */ 16 | String getKey(); 17 | 18 | /** 19 | * @return type of the component, describing it's general purpose 20 | * @see ComponentType 21 | */ 22 | ComponentType getType(); 23 | 24 | /** 25 | * @return A description for your trigger that's shown in the editor 26 | */ 27 | String getDescription(); 28 | 29 | /** 30 | * @return settings to show in the editor 31 | */ 32 | List getOptions(); 33 | 34 | default String getDisplayName() { 35 | return getKey(); 36 | } 37 | 38 | default boolean isContainer() { 39 | return getType() != ComponentType.MECHANIC; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/custom/CustomEffectComponent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.custom; 2 | 3 | import com.sucy.skill.dynamic.EffectComponent; 4 | 5 | /** 6 | * SkillAPI © 2018 7 | * com.sucy.skill.dynamic.custom.CustomEffect 8 | */ 9 | public abstract class CustomEffectComponent extends EffectComponent implements CustomComponent { } 10 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/custom/CustomTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.custom; 2 | 3 | import com.sucy.skill.dynamic.trigger.Trigger; 4 | import org.bukkit.event.Event; 5 | 6 | /** 7 | * SkillAPI © 2018 8 | * com.sucy.skill.dynamic.custom.CustomTrigger 9 | */ 10 | public interface CustomTrigger extends Trigger, CustomComponent { } 11 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/CancelMechanic.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.mechanic.PurgeMechanic 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.mechanic; 28 | 29 | import org.bukkit.entity.LivingEntity; 30 | 31 | import java.util.List; 32 | 33 | /** 34 | * Cancels the event that caused the trigger to go off 35 | */ 36 | public class CancelMechanic extends MechanicComponent { 37 | @Override 38 | public String getKey() { 39 | return "cancel"; 40 | } 41 | 42 | /** 43 | * Executes the component 44 | * 45 | * @param caster caster of the skill 46 | * @param level level of the skill 47 | * @param targets targets to apply to 48 | * 49 | * @return true if applied to something, false otherwise 50 | */ 51 | @Override 52 | public boolean execute(LivingEntity caster, int level, List targets) { 53 | skill.cancelTrigger(); 54 | return true; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/DurabilityMechanic.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import com.rit.sucy.version.VersionManager; 4 | import org.bukkit.Sound; 5 | import org.bukkit.entity.LivingEntity; 6 | import org.bukkit.entity.Player; 7 | import org.bukkit.inventory.ItemStack; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * SkillAPI © 2017 13 | * com.sucy.skill.dynamic.mechanic.DurabilityMechanic 14 | */ 15 | public class DurabilityMechanic extends MechanicComponent { 16 | 17 | private static final String AMOUNT = "amount"; 18 | private static final String OFFHAND = "offhand"; 19 | 20 | @Override 21 | public String getKey() { 22 | return "durability"; 23 | } 24 | 25 | @Override 26 | public boolean execute( 27 | final LivingEntity caster, final int level, final List targets) { 28 | 29 | if (!(caster instanceof Player)) { 30 | return false; 31 | } 32 | 33 | final Player player = (Player) caster; 34 | final boolean offhand = settings.getBool(OFFHAND, false); 35 | final short amount = (short) (parseValues(caster, AMOUNT, level, 1) * targets.size()); 36 | 37 | final ItemStack item; 38 | if (offhand && VersionManager.isVersionAtLeast(VersionManager.V1_9_0)) { 39 | item = player.getInventory().getItemInOffHand(); 40 | } else { item = player.getInventory().getItemInHand(); } 41 | 42 | if (item == null || item.getType().getMaxDurability() == 0) { 43 | return false; 44 | } 45 | 46 | int durability = item.getType().getMaxDurability() - item.getDurability(); 47 | if (durability <= -amount) { 48 | if (offhand && VersionManager.isVersionAtLeast(VersionManager.V1_9_0)) { 49 | player.getInventory().setItemInOffHand(null); 50 | } else { 51 | player.getInventory().setItemInMainHand(null); 52 | } 53 | player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1, 1); 54 | } 55 | item.setDurability((short) (item.getDurability() - amount)); 56 | return true; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/FoodMechanic.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import org.bukkit.entity.LivingEntity; 4 | import org.bukkit.entity.Player; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * SkillAPI © 2017 10 | * com.sucy.skill.dynamic.mechanic.FoodMechanic 11 | */ 12 | public class FoodMechanic extends MechanicComponent { 13 | private static final String FOOD = "food"; 14 | private static final String SATURATION = "saturation"; 15 | 16 | @Override 17 | public String getKey() { 18 | return "food"; 19 | } 20 | 21 | /** 22 | * Executes the component 23 | * 24 | * @param caster caster of the skill 25 | * @param level level of the skill 26 | * @param targets targets to apply to 27 | * 28 | * @return true if applied to something, false otherwise 29 | */ 30 | @Override 31 | public boolean execute(LivingEntity caster, int level, List targets) { 32 | double food = parseValues(caster, FOOD, level, 1.0); 33 | double saturation = parseValues(caster, SATURATION, level, 1.0); 34 | for (LivingEntity target : targets) { 35 | if (target instanceof Player) { 36 | Player player = (Player) target; 37 | player.setFoodLevel(Math.min(20, Math.max(0, (int) food + player.getFoodLevel()))); 38 | player.setSaturation(Math.min( 39 | player.getFoodLevel(), 40 | Math.max(0, player.getSaturation() + (float) saturation))); 41 | } 42 | } 43 | return targets.size() > 0; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/HealthSetMechanic.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import org.bukkit.entity.LivingEntity; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * SkillAPI © 2017 9 | * com.sucy.skill.dynamic.mechanic.HealthSetMechanic 10 | */ 11 | public class HealthSetMechanic extends MechanicComponent { 12 | 13 | private static final String HEALTH = "health"; 14 | 15 | @Override 16 | public String getKey() { 17 | return "health set"; 18 | } 19 | 20 | @Override 21 | public boolean execute(final LivingEntity caster, final int level, final List targets) { 22 | final double health = Math.max(1, parseValues(caster, HEALTH, level, 1)); 23 | 24 | for (final LivingEntity target : targets) { 25 | target.setHealth(Math.min(health, target.getMaxHealth())); 26 | } 27 | 28 | return true; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/MechanicComponent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import com.sucy.skill.dynamic.ComponentType; 4 | import com.sucy.skill.dynamic.EffectComponent; 5 | 6 | /** 7 | * SkillAPI © 2018 8 | * com.sucy.skill.dynamic.mechanic.MechanicComponent 9 | */ 10 | public abstract class MechanicComponent extends EffectComponent { 11 | @Override 12 | public ComponentType getType() { 13 | return ComponentType.MECHANIC; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/ValueCopyMechanic.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import com.sucy.skill.dynamic.DynamicSkill; 4 | import org.bukkit.entity.LivingEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * SkillAPI © 2018 10 | * com.sucy.skill.dynamic.mechanic.ValueCopyMechanic 11 | */ 12 | public class ValueCopyMechanic extends MechanicComponent { 13 | private static final String KEY = "key"; 14 | private static final String TARGET = "destination"; 15 | private static final String TO_TARGET = "to-target"; 16 | 17 | @Override 18 | public String getKey() { 19 | return "value copy"; 20 | } 21 | 22 | @Override 23 | public boolean execute( 24 | final LivingEntity caster, final int level, final List targets) { 25 | 26 | if (targets.size() == 0 || !settings.has(KEY)) { 27 | return false; 28 | } 29 | 30 | final String key = settings.getString(KEY); 31 | final String destination = settings.getString(TARGET, key); 32 | final boolean toTarget = settings.getString(TO_TARGET, "true").equalsIgnoreCase("true"); 33 | 34 | if (toTarget) { 35 | targets.forEach(target -> apply(caster, target, key, destination)); 36 | } else { 37 | apply(targets.get(0), caster, key, destination); 38 | } 39 | 40 | return true; 41 | } 42 | 43 | private boolean apply(final LivingEntity from, final LivingEntity to, final String key, final String destination) { 44 | final Object value = DynamicSkill.getCastData(from).get(key); 45 | if (value == null) return false; 46 | DynamicSkill.getCastData(to).put(destination, value); 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/mechanic/ValueDistanceMechanic.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.mechanic; 2 | 3 | import com.sucy.skill.dynamic.DynamicSkill; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.entity.Player; 6 | 7 | import java.util.HashMap; 8 | import java.util.List; 9 | 10 | /** 11 | * SkillAPI © 2017 12 | * com.sucy.skill.dynamic.mechanic.ValueDistanceMechanic 13 | */ 14 | public class ValueDistanceMechanic extends MechanicComponent 15 | { 16 | private static final String KEY = "key"; 17 | 18 | @Override 19 | public String getKey() { 20 | return "value distance"; 21 | } 22 | 23 | /** 24 | * Executes the component 25 | * 26 | * @param caster caster of the skill 27 | * @param level level of the skill 28 | * @param targets targets to apply to 29 | * 30 | * @return true if applied to something, false otherwise 31 | */ 32 | @Override 33 | public boolean execute(final LivingEntity caster, final int level, final List targets) 34 | { 35 | if (!settings.has(KEY) || !(caster instanceof Player)) 36 | { 37 | return false; 38 | } 39 | 40 | final String key = settings.getString(KEY); 41 | final HashMap data = DynamicSkill.getCastData(caster); 42 | data.put(key, targets.get(0).getLocation().distance(caster.getLocation())); 43 | return true; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/target/SelfTarget.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.dynamic.target.SelfTarget 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.dynamic.target; 28 | 29 | import com.google.common.collect.ImmutableList; 30 | import com.sucy.skill.cast.IIndicator; 31 | import org.bukkit.entity.LivingEntity; 32 | import org.bukkit.entity.Player; 33 | 34 | import java.util.List; 35 | 36 | /** 37 | * Applies child components to the caster 38 | */ 39 | public class SelfTarget extends TargetComponent { 40 | 41 | /** {@inheritDoc} */ 42 | @Override 43 | public void makeIndicators(List list, Player caster, LivingEntity target, int level) { 44 | makeCircleIndicator(list, caster, 0.5); 45 | } 46 | 47 | /** {@inheritDoc} */ 48 | @Override 49 | List getTargets( 50 | final LivingEntity caster, final int level, final List targets) { 51 | return ImmutableList.of(caster); 52 | } 53 | 54 | @Override 55 | public String getKey() { 56 | return "self"; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/BlockBreakTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.block.BlockBreakEvent; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * SkillAPI © 2018 12 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 13 | */ 14 | public class BlockBreakTrigger implements Trigger { 15 | 16 | /** {@inheritDoc} */ 17 | @Override 18 | public String getKey() { 19 | return "BLOCK_BREAK"; 20 | } 21 | 22 | /** {@inheritDoc} */ 23 | @Override 24 | public Class getEvent() { 25 | return BlockBreakEvent.class; 26 | } 27 | 28 | /** {@inheritDoc} */ 29 | @Override 30 | public boolean shouldTrigger(final BlockBreakEvent event, final int level, final Settings settings) { 31 | final List types = settings.getStringList("material"); 32 | return types.isEmpty() || types.contains("Any") 33 | || types.stream().anyMatch(mat -> event.getBlock().getType().name().equalsIgnoreCase(mat.replace(' ','_'))); 34 | } 35 | 36 | /** {@inheritDoc} */ 37 | @Override 38 | public void setValues(final BlockBreakEvent event, final Map data) { 39 | data.put("api-block-type", event.getBlock().getType().name()); 40 | data.put("api-block-loc", event.getBlock().getLocation()); 41 | } 42 | 43 | /** {@inheritDoc} */ 44 | @Override 45 | public LivingEntity getCaster(final BlockBreakEvent event) { 46 | return event.getPlayer(); 47 | } 48 | 49 | /** {@inheritDoc} */ 50 | @Override 51 | public LivingEntity getTarget(final BlockBreakEvent event, final Settings settings) { 52 | return event.getPlayer(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/BlockPlaceTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.block.BlockPlaceEvent; 6 | 7 | import java.util.List; 8 | import java.util.Map; 9 | 10 | /** 11 | * SkillAPI © 2018 12 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 13 | */ 14 | public class BlockPlaceTrigger implements Trigger { 15 | 16 | /** {@inheritDoc} */ 17 | @Override 18 | public String getKey() { 19 | return "BLOCK_PLACE"; 20 | } 21 | 22 | /** {@inheritDoc} */ 23 | @Override 24 | public Class getEvent() { 25 | return BlockPlaceEvent.class; 26 | } 27 | 28 | /** {@inheritDoc} */ 29 | @Override 30 | public boolean shouldTrigger(final BlockPlaceEvent event, final int level, final Settings settings) { 31 | final List types = settings.getStringList("material"); 32 | return types.isEmpty() || types.contains("Any") 33 | || types.stream().anyMatch(mat -> event.getBlock().getType().name().equalsIgnoreCase(mat.replace(' ','_'))); 34 | } 35 | 36 | /** {@inheritDoc} */ 37 | @Override 38 | public void setValues(final BlockPlaceEvent event, final Map data) { 39 | data.put("api-block-type", event.getBlock().getType().name()); 40 | data.put("api-block-loc", event.getBlock().getLocation()); 41 | } 42 | 43 | /** {@inheritDoc} */ 44 | @Override 45 | public LivingEntity getCaster(final BlockPlaceEvent event) { 46 | return event.getPlayer(); 47 | } 48 | 49 | /** {@inheritDoc} */ 50 | @Override 51 | public LivingEntity getTarget(final BlockPlaceEvent event, final Settings settings) { 52 | return event.getPlayer(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/CrouchTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.player.PlayerToggleSneakEvent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class CrouchTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "CROUCH"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return PlayerToggleSneakEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final PlayerToggleSneakEvent event, final int level, final Settings settings) { 30 | final String type = settings.getString("type", "start crouching"); 31 | return type.equalsIgnoreCase("both") || event.isSneaking() != type.equalsIgnoreCase("stop crouching"); 32 | } 33 | 34 | /** {@inheritDoc} */ 35 | @Override 36 | public void setValues(final PlayerToggleSneakEvent event, final Map data) { } 37 | 38 | /** {@inheritDoc} */ 39 | @Override 40 | public LivingEntity getCaster(final PlayerToggleSneakEvent event) { 41 | return event.getPlayer(); 42 | } 43 | 44 | /** {@inheritDoc} */ 45 | @Override 46 | public LivingEntity getTarget(final PlayerToggleSneakEvent event, final Settings settings) { 47 | return event.getPlayer(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/DeathTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.entity.EntityDeathEvent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class DeathTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "DEATH"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return EntityDeathEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final EntityDeathEvent event, final int level, final Settings settings) { 30 | return !isTargetingKiller(settings) || event.getEntity().getKiller() != null; 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final EntityDeathEvent event, final Map data) { } 36 | 37 | /** {@inheritDoc} */ 38 | @Override 39 | public LivingEntity getCaster(final EntityDeathEvent event) { 40 | return event.getEntity(); 41 | } 42 | 43 | /** {@inheritDoc} */ 44 | @Override 45 | public LivingEntity getTarget(final EntityDeathEvent event, final Settings settings) { 46 | return isTargetingKiller(settings) ? event.getEntity().getKiller() : event.getEntity(); 47 | } 48 | 49 | private boolean isTargetingKiller(final Settings settings) { 50 | return settings.getString("killer", "false").equalsIgnoreCase("true"); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/KillTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.entity.EntityDeathEvent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class KillTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "KILL"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return EntityDeathEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final EntityDeathEvent event, final int level, final Settings settings) { 30 | return true; 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final EntityDeathEvent event, final Map data) { } 36 | 37 | /** {@inheritDoc} */ 38 | @Override 39 | public LivingEntity getCaster(final EntityDeathEvent event) { 40 | return event.getEntity().getKiller(); 41 | } 42 | 43 | /** {@inheritDoc} */ 44 | @Override 45 | public LivingEntity getTarget(final EntityDeathEvent event, final Settings settings) { 46 | return event.getEntity().getKiller(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/LandTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.PlayerLandEvent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class LandTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "LAND"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return PlayerLandEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final PlayerLandEvent event, final int level, final Settings settings) { 30 | final double minDistance = settings.getDouble("min-distance", 0); 31 | return event.getDistance() >= minDistance; 32 | } 33 | 34 | /** {@inheritDoc} */ 35 | @Override 36 | public void setValues(final PlayerLandEvent event, final Map data) { 37 | data.put("api-distance", event.getDistance()); 38 | } 39 | 40 | /** {@inheritDoc} */ 41 | @Override 42 | public LivingEntity getCaster(final PlayerLandEvent event) { 43 | return event.getPlayer(); 44 | } 45 | 46 | /** {@inheritDoc} */ 47 | @Override 48 | public LivingEntity getTarget(final PlayerLandEvent event, final Settings settings) { 49 | return event.getPlayer(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/LaunchTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.entity.ProjectileLaunchEvent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class LaunchTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "LAUNCH"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return ProjectileLaunchEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final ProjectileLaunchEvent event, final int level, final Settings settings) { 30 | final String type = settings.getString("type", "any"); 31 | return type.equalsIgnoreCase("ANY") || type.equalsIgnoreCase(event.getEntity().getType().name()); 32 | } 33 | 34 | /** {@inheritDoc} */ 35 | @Override 36 | public void setValues(final ProjectileLaunchEvent event, final Map data) { 37 | data.put("api-velocity", event.getEntity().getVelocity().length()); 38 | } 39 | 40 | /** {@inheritDoc} */ 41 | @Override 42 | public LivingEntity getCaster(final ProjectileLaunchEvent event) { 43 | if (event.getEntity().getShooter() instanceof LivingEntity) { 44 | return (LivingEntity) event.getEntity().getShooter(); 45 | } else { 46 | return null; 47 | } 48 | } 49 | 50 | /** {@inheritDoc} */ 51 | @Override 52 | public LivingEntity getTarget(final ProjectileLaunchEvent event, final Settings settings) { 53 | return getCaster(event); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/MoveTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import org.bukkit.entity.LivingEntity; 5 | import org.bukkit.event.player.PlayerMoveEvent; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class MoveTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "MOVE"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public Class getEvent() { 24 | return PlayerMoveEvent.class; 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public boolean shouldTrigger(final PlayerMoveEvent event, final int level, final Settings settings) { 30 | return event.getFrom().getWorld() == event.getTo().getWorld(); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final PlayerMoveEvent event, final Map data) { 36 | final double distance = event.getTo().distance(event.getFrom()); 37 | data.put("api-distance", distance); 38 | } 39 | 40 | /** {@inheritDoc} */ 41 | @Override 42 | public LivingEntity getCaster(final PlayerMoveEvent event) { 43 | return event.getPlayer(); 44 | } 45 | 46 | /** {@inheritDoc} */ 47 | @Override 48 | public LivingEntity getTarget(final PlayerMoveEvent event, final Settings settings) { 49 | return event.getPlayer(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/PhysicalDealtTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.PhysicalDamageEvent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class PhysicalDealtTrigger extends PhysicalTrigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "PHYSICAL_DAMAGE"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public LivingEntity getCaster(final PhysicalDamageEvent event) { 24 | return event.getDamager(); 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public LivingEntity getTarget(final PhysicalDamageEvent event, final Settings settings) { 30 | return isUsingTarget(settings) ? event.getTarget() : event.getDamager(); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final PhysicalDamageEvent event, final Map data) { 36 | data.put("api-dealt", event.getDamage()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/PhysicalTakenTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.PhysicalDamageEvent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class PhysicalTakenTrigger extends PhysicalTrigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "TOOK_PHYSICAL_DAMAGE"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public LivingEntity getCaster(final PhysicalDamageEvent event) { 24 | return event.getTarget(); 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public LivingEntity getTarget(final PhysicalDamageEvent event, final Settings settings) { 30 | return isUsingTarget(settings) ? event.getDamager() : event.getTarget(); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final PhysicalDamageEvent event, final Map data) { 36 | data.put("api-taken", event.getDamage()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/PhysicalTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.PhysicalDamageEvent; 5 | import com.sucy.skill.dynamic.DynamicSkill; 6 | 7 | /** 8 | * SkillAPI © 2018 9 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 10 | */ 11 | public abstract class PhysicalTrigger implements Trigger { 12 | 13 | /** {@inheritDoc} */ 14 | @Override 15 | public Class getEvent() { 16 | return PhysicalDamageEvent.class; 17 | } 18 | 19 | /** {@inheritDoc} */ 20 | @Override 21 | public boolean shouldTrigger(final PhysicalDamageEvent event, final int level, final Settings settings) { 22 | final String type = settings.getString("type", "both"); 23 | final double min = settings.getDouble("dmg-min"); 24 | final double max = settings.getDouble("dmg-max"); 25 | final boolean projectile = event.isProjectile(); 26 | return event.getDamage() >= min && event.getDamage() <= max && 27 | (type.equalsIgnoreCase("both") || type.equalsIgnoreCase("projectile") == projectile); 28 | } 29 | 30 | /** 31 | * Handles applying other effects after the skill resolves 32 | * 33 | * @param event event details 34 | * @param skill skill to resolve 35 | */ 36 | @Override 37 | public void postProcess(final PhysicalDamageEvent event, final DynamicSkill skill) { 38 | final double damage = skill.applyImmediateBuff(event.getDamage()); 39 | event.setDamage(damage); 40 | } 41 | 42 | boolean isUsingTarget(final Settings settings) { 43 | return settings.getString("target", "true").equalsIgnoreCase("false"); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/SkillDealtTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.SkillDamageEvent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class SkillDealtTrigger extends SkillTrigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "SKILL_DAMAGE"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public LivingEntity getCaster(final SkillDamageEvent event) { 24 | return event.getDamager(); 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public LivingEntity getTarget(final SkillDamageEvent event, final Settings settings) { 30 | return isUsingTarget(settings) ? event.getTarget() : event.getDamager(); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final SkillDamageEvent event, final Map data) { 36 | data.put("api-dealt", event.getDamage()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/SkillTakenTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.SkillDamageEvent; 5 | import org.bukkit.entity.LivingEntity; 6 | 7 | import java.util.Map; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public class SkillTakenTrigger extends SkillTrigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public String getKey() { 18 | return "TOOK_SKILL_DAMAGE"; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public LivingEntity getCaster(final SkillDamageEvent event) { 24 | return event.getTarget(); 25 | } 26 | 27 | /** {@inheritDoc} */ 28 | @Override 29 | public LivingEntity getTarget(final SkillDamageEvent event, final Settings settings) { 30 | return isUsingTarget(settings) ? event.getDamager() : event.getTarget(); 31 | } 32 | 33 | /** {@inheritDoc} */ 34 | @Override 35 | public void setValues(final SkillDamageEvent event, final Map data) { 36 | data.put("api-taken", event.getDamage()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/SkillTrigger.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.api.Settings; 4 | import com.sucy.skill.api.event.SkillDamageEvent; 5 | import com.sucy.skill.dynamic.DynamicSkill; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.dynamic.trigger.BlockBreakTrigger 12 | */ 13 | public abstract class SkillTrigger implements Trigger { 14 | 15 | /** {@inheritDoc} */ 16 | @Override 17 | public Class getEvent() { 18 | return SkillDamageEvent.class; 19 | } 20 | 21 | /** {@inheritDoc} */ 22 | @Override 23 | public boolean shouldTrigger(final SkillDamageEvent event, final int level, final Settings settings) { 24 | final double min = settings.getDouble("dmg-min"); 25 | final double max = settings.getDouble("dmg-max"); 26 | final List types = settings.getStringList("category"); 27 | final boolean empty = types.isEmpty() || types.get(0).isEmpty(); 28 | return event.getDamage() >= min && event.getDamage() <= max && 29 | (empty || types.contains(event.getClassification())); 30 | } 31 | 32 | /** 33 | * Handles applying other effects after the skill resolves 34 | * 35 | * @param event event details 36 | * @param skill skill to resolve 37 | */ 38 | @Override 39 | public void postProcess(final SkillDamageEvent event, final DynamicSkill skill) { 40 | final double damage = skill.applyImmediateBuff(event.getDamage()); 41 | event.setDamage(damage); 42 | } 43 | 44 | boolean isUsingTarget(final Settings settings) { 45 | return settings.getString("target", "true").equalsIgnoreCase("false"); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/dynamic/trigger/TriggerComponent.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.dynamic.trigger; 2 | 3 | import com.sucy.skill.dynamic.ComponentType; 4 | import com.sucy.skill.dynamic.EffectComponent; 5 | import com.sucy.skill.util.Lists; 6 | import org.bukkit.entity.LivingEntity; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * SkillAPI © 2018 12 | * com.sucy.skill.dynamic.trigger.TriggerComponent 13 | */ 14 | public class TriggerComponent extends EffectComponent { 15 | 16 | private boolean running = false; 17 | 18 | public boolean isRunning() { 19 | return running; 20 | } 21 | 22 | public boolean trigger(final LivingEntity caster, final LivingEntity target, final int level) { 23 | return execute(caster, level, Lists.asList(target)); 24 | } 25 | 26 | @Override 27 | public String getKey() { 28 | return "trigger"; 29 | } 30 | 31 | @Override 32 | public ComponentType getType() { 33 | return ComponentType.TRIGGER; 34 | } 35 | 36 | @Override 37 | public boolean execute(final LivingEntity caster, final int level, final List targets) { 38 | try { 39 | running = true; 40 | return executeChildren(caster, level, targets); 41 | } finally { 42 | running = false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/gui/handlers/DetailsHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.gui.handlers.DetailsHandler 4 | *

5 | * The MIT License (MIT) 6 | *

7 | * Copyright (c) 2016 Steven Sucy 8 | *

9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | *

16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | *

19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.gui.handlers; 28 | 29 | import com.sucy.skill.api.classes.RPGClass; 30 | import com.sucy.skill.gui.tool.GUIHolder; 31 | 32 | /** 33 | * Handles interactions with the class details menu 34 | */ 35 | public class DetailsHandler extends GUIHolder 36 | { 37 | /** 38 | * Shows class details when clicked 39 | * 40 | * @param type player class clicked on 41 | * @param slot slot number 42 | */ 43 | @Override 44 | protected void onClick(RPGClass type, int slot, boolean left, boolean shift) 45 | { 46 | player.showSkills(player.getPlayer(), player.getClass(type.getGroup())); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/gui/handlers/ProfessHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.gui.handlers.ProfessHandler 4 | *

5 | * The MIT License (MIT) 6 | *

7 | * Copyright (c) 2016 Steven Sucy 8 | *

9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | *

16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | *

19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.gui.handlers; 28 | 29 | import com.sucy.skill.api.classes.RPGClass; 30 | import com.sucy.skill.manager.CmdManager; 31 | import com.sucy.skill.gui.tool.GUIHolder; 32 | 33 | public class ProfessHandler extends GUIHolder 34 | { 35 | /** 36 | * Professes as the clicked class 37 | * 38 | * @param type player class clicked on 39 | * @param slot slot number 40 | */ 41 | @Override 42 | protected void onClick(RPGClass type, int slot, boolean left, boolean shift) 43 | { 44 | player.getPlayer().closeInventory(); 45 | CmdManager.PROFESS_COMMAND.execute(player.getPlayer(), new String[] { type.getName() }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/gui/tool/IconHolder.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.gui.tool.IconHolder 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.gui.tool; 28 | 29 | import com.sucy.skill.api.player.PlayerData; 30 | import org.bukkit.entity.Player; 31 | import org.bukkit.inventory.ItemStack; 32 | 33 | public interface IconHolder 34 | { 35 | ItemStack getIcon(PlayerData player); 36 | 37 | boolean isAllowed(Player player); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/gui/tool/ToolMenu.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.gui.tool.ToolMenu 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.gui.tool; 28 | 29 | import org.bukkit.event.inventory.InventoryClickEvent; 30 | import org.bukkit.inventory.InventoryHolder; 31 | 32 | public interface ToolMenu extends InventoryHolder 33 | { 34 | void handleClick(InventoryClickEvent event); 35 | 36 | void restore(); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/hook/CitizensHook.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.hook; 2 | 3 | import org.bukkit.entity.Entity; 4 | 5 | /** 6 | * Handles checking whether or not an entity is an NPC 7 | */ 8 | public class CitizensHook { 9 | public static boolean isNPC(Entity entity) { 10 | return entity.getClass().getName().equals("PlayerNPC"); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/hook/MythicMobsHook.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.hook; 2 | 3 | import io.lumine.xikage.mythicmobs.MythicMobs; 4 | import org.bukkit.entity.LivingEntity; 5 | 6 | /** 7 | * SkillAPI © 2017 8 | * com.sucy.skill.hook.MythicMobsHook 9 | */ 10 | public class MythicMobsHook { 11 | 12 | public static void taunt(final LivingEntity target, final LivingEntity source, final double amount) { 13 | if (amount > 0) { 14 | MythicMobs.inst().getAPIHelper().addThreat(target, source, amount); 15 | } 16 | else if (amount < 0) { 17 | MythicMobs.inst().getAPIHelper().reduceThreat(target, source, -amount); 18 | } 19 | } 20 | 21 | public static boolean isMonster(final LivingEntity target) { 22 | return MythicMobs.inst().getAPIHelper().isMythicMob(target); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/hook/NoCheatHook.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.hook.NoCheatHook 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.hook; 28 | 29 | import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager; 30 | import org.bukkit.entity.Player; 31 | 32 | /** 33 | * Handles plugin calls to NoCheatPlus to get around it blocking skill effects 34 | */ 35 | public class NoCheatHook 36 | { 37 | /** 38 | * Exempts the player from NCP functionality 39 | * 40 | * @param player player to exempt 41 | */ 42 | public static void exempt(Player player) 43 | { 44 | NCPExemptionManager.exemptPermanently(player); 45 | } 46 | 47 | /** 48 | * Unexempts the player from NCP functionality 49 | * 50 | * @param player player to unexempt 51 | */ 52 | public static void unexempt(Player player) 53 | { 54 | NCPExemptionManager.unexempt(player); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/hook/PlaceholderAPIHook.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.hook; 2 | 3 | import me.clip.placeholderapi.PlaceholderAPI; 4 | import org.bukkit.entity.Player; 5 | 6 | /** 7 | * SkillAPI © 2018 8 | * com.sucy.skill.hook.PlaceholderAPIHook 9 | */ 10 | public class PlaceholderAPIHook { 11 | 12 | public static String format(final String message, final Player player) { 13 | return PlaceholderAPI.setPlaceholders(player, message); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/hook/RPGInventoryHook.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.hook.RPGInventoryHook 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.hook; 28 | 29 | import org.bukkit.entity.Player; 30 | import org.bukkit.inventory.Inventory; 31 | import org.bukkit.inventory.ItemStack; 32 | import ru.endlesscode.rpginventory.api.InventoryAPI; 33 | 34 | import java.util.List; 35 | 36 | public class RPGInventoryHook 37 | { 38 | public static boolean isRPGInventory(Inventory inv) 39 | { 40 | return InventoryAPI.isRPGInventory(inv); 41 | } 42 | 43 | public static List getCustomEquips(Player player) 44 | { 45 | List active = InventoryAPI.getActiveItems(player); 46 | active.addAll(InventoryAPI.getPassiveItems(player)); 47 | return active; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/language/ErrorNodes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.language.ErrorNodes 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.language; 28 | 29 | /** 30 | * Error message language nodes 31 | */ 32 | public class ErrorNodes 33 | { 34 | public static final String 35 | BASE = "Errors.", 36 | COOLDOWN = BASE + "on-cooldown", 37 | MANA = BASE + "no-mana", 38 | NO_SKILLS = BASE + "no-skills", 39 | CANNOT_USE = BASE + "cannot-use"; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/language/GUINodes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.language.GUINodes 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.language; 28 | 29 | public class GUINodes 30 | { 31 | public static final String 32 | BASE = "GUI.", 33 | ATTRIB_TITLE = BASE + "attribute-title", 34 | CLASS_LIST = BASE + "skill-class-list", 35 | SKILL_TREE = BASE + "skill-tree", 36 | PROFESS_TITLE = BASE + "profess-title"; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/language/NotificationNodes.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.language.NotificationNodes 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.language; 28 | 29 | /** 30 | * Default message language nodes 31 | */ 32 | public class NotificationNodes 33 | { 34 | public static final String 35 | BASE = "Notifications.", 36 | CAST = BASE + "cast", 37 | EXP = BASE + "gain-exp", 38 | LVL = BASE + "gain-lvl", 39 | LOSE = BASE + "lose-exp"; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/listener/CastOffhandListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.listener.CastOffhandListener 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2017 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.listener; 28 | 29 | import com.sucy.skill.SkillAPI; 30 | import org.bukkit.event.EventHandler; 31 | import org.bukkit.event.player.PlayerSwapHandItemsEvent; 32 | 33 | public class CastOffhandListener extends SkillAPIListener { 34 | private static int slot = SkillAPI.getSettings().getCastSlot(); 35 | 36 | @EventHandler 37 | public void handleOffhandDupe(PlayerSwapHandItemsEvent event) 38 | { 39 | if (event.getOffHandItem() != null && event.getPlayer().getInventory().getHeldItemSlot() == slot) 40 | event.setCancelled(true); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/listener/LingeringPotionListener.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.listener; 2 | 3 | import com.sucy.skill.SkillAPI; 4 | import com.sucy.skill.dynamic.mechanic.PotionProjectileMechanic; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.entity.AreaEffectCloudApplyEvent; 7 | import org.bukkit.event.entity.LingeringPotionSplashEvent; 8 | 9 | import static com.sucy.skill.listener.MechanicListener.POTION_PROJECTILE; 10 | import static com.sucy.skill.listener.MechanicListener.SKILL_CASTER; 11 | import static com.sucy.skill.listener.MechanicListener.SKILL_LEVEL; 12 | 13 | /** 14 | * SkillAPI © 2017 15 | * com.sucy.skill.listener.LingeringPotionListener 16 | */ 17 | public class LingeringPotionListener extends SkillAPIListener { 18 | 19 | @EventHandler 20 | public void onLingerSplash(LingeringPotionSplashEvent event) { 21 | PotionProjectileMechanic mechanic = (PotionProjectileMechanic) SkillAPI.getMeta(event.getEntity(), POTION_PROJECTILE); 22 | if (mechanic != null) { 23 | SkillAPI.setMeta(event.getAreaEffectCloud(), POTION_PROJECTILE, mechanic); 24 | event.getAreaEffectCloud().setMetadata(SKILL_LEVEL, event.getEntity().getMetadata(SKILL_LEVEL).get(0)); 25 | event.getAreaEffectCloud().setMetadata(SKILL_CASTER, event.getEntity().getMetadata(SKILL_CASTER).get(0)); 26 | } 27 | } 28 | 29 | @EventHandler 30 | public void onLinger(AreaEffectCloudApplyEvent event) { 31 | PotionProjectileMechanic mechanic = (PotionProjectileMechanic) SkillAPI.getMeta(event.getEntity(), POTION_PROJECTILE); 32 | if (mechanic != null) { 33 | mechanic.callback(event.getEntity(), event.getAffectedEntities()); 34 | event.getAffectedEntities().clear(); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/listener/PacketListener.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.listener; 2 | 3 | import com.sucy.skill.packet.PacketInjector; 4 | import org.bukkit.Bukkit; 5 | import org.bukkit.event.EventHandler; 6 | import org.bukkit.event.player.PlayerJoinEvent; 7 | import org.bukkit.event.player.PlayerQuitEvent; 8 | 9 | /** 10 | * SkillAPI © 2018 11 | * com.sucy.skill.listener.PacketListener 12 | */ 13 | public class PacketListener extends SkillAPIListener { 14 | private PacketInjector injector; 15 | 16 | public PacketListener(final PacketInjector injector) { 17 | this.injector = injector; 18 | } 19 | 20 | @Override 21 | public void init() { 22 | Bukkit.getServer().getOnlinePlayers().forEach(injector::addPlayer); 23 | } 24 | 25 | @EventHandler 26 | public void onJoin(PlayerJoinEvent event) { 27 | injector.addPlayer(event.getPlayer()); 28 | } 29 | 30 | @EventHandler 31 | public void onQuit(PlayerQuitEvent event) { 32 | injector.removePlayer(event.getPlayer()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/listener/SkillAPIListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.listener.SkillAPIListener 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.listener; 28 | 29 | import org.bukkit.event.Listener; 30 | 31 | /** 32 | * Interface for SkillAPI listeners that lets them be initialized 33 | */ 34 | public abstract class SkillAPIListener implements Listener 35 | { 36 | public void init() { } 37 | 38 | public void cleanup() { } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/log/LogType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.log.LogType 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.log; 28 | 29 | /** 30 | * Different categories of logging 31 | */ 32 | public enum LogType 33 | { 34 | ATTRIBUTE_LOAD, 35 | BUFF, 36 | GUI, 37 | MANA, 38 | REGISTRATION,; 39 | 40 | /** 41 | * The key for the logging type matching the config.yml vale 42 | * 43 | * @return key name 44 | */ 45 | public String key() 46 | { 47 | return name().toLowerCase().replace("_", "-"); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/packet/PacketHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Minenotch © 3 | * com.minenotch.nms.PacketHandler 4 | */ 5 | package com.sucy.skill.packet; 6 | 7 | import com.sucy.skill.SkillAPI; 8 | import com.sucy.skill.api.event.KeyPressEvent; 9 | import io.netty.channel.ChannelDuplexHandler; 10 | import io.netty.channel.ChannelHandlerContext; 11 | import io.netty.channel.ChannelPromise; 12 | import org.bukkit.Bukkit; 13 | import org.bukkit.entity.Player; 14 | 15 | import java.lang.reflect.Field; 16 | 17 | /** 18 | * Handles the interception of packets, applying effects where necessary 19 | */ 20 | class PacketHandler extends ChannelDuplexHandler { 21 | private Player player; 22 | private Field dropField; 23 | 24 | PacketHandler(final Player player, final Field dropField) { 25 | this.player = player; 26 | this.dropField = dropField; 27 | } 28 | 29 | @Override 30 | public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { 31 | super.write(ctx, msg, promise); 32 | } 33 | 34 | @Override 35 | public void channelRead(ChannelHandlerContext c, Object m) throws Exception { 36 | switch (m.getClass().getSimpleName()) { 37 | case "PacketPlayInBlockDig": 38 | if (dropField != null){ 39 | if (((Enum) dropField.get(m)).name().equals("DROP_ITEM")) { 40 | callEvent(KeyPressEvent.Key.Q); 41 | } 42 | } 43 | break; 44 | case "PacketPlayInArmAnimation": 45 | callEvent(KeyPressEvent.Key.LEFT); 46 | break; 47 | case "PacketPlayInUseItem": 48 | case "PacketPlayInBlockPlace": 49 | callEvent(KeyPressEvent.Key.RIGHT); 50 | } 51 | super.channelRead(c, m); 52 | } 53 | 54 | private void callEvent(final KeyPressEvent.Key key) { 55 | SkillAPI.schedule(() -> Bukkit.getPluginManager().callEvent(new KeyPressEvent(player, key)), 0); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/task/ArmorStandTask.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.task; 2 | 3 | import com.sucy.skill.api.armorstand.ArmorStandManager; 4 | import com.sucy.skill.thread.RepeatThreadTask; 5 | 6 | public class ArmorStandTask extends RepeatThreadTask { 7 | 8 | public ArmorStandTask() { super(1,1); } 9 | 10 | @Override 11 | public void run() { 12 | ArmorStandManager.tick(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/task/EffectTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.task.EffectTask 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.task; 28 | 29 | import com.sucy.skill.api.particle.EffectManager; 30 | import com.sucy.skill.thread.RepeatThreadTask; 31 | 32 | public class EffectTask extends RepeatThreadTask 33 | { 34 | public EffectTask() 35 | { 36 | super(1, 1); 37 | } 38 | 39 | @Override 40 | public void run() 41 | { 42 | EffectManager.tick(); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/task/SaveTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.task.SaveTask 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.task; 28 | 29 | import com.sucy.skill.SkillAPI; 30 | import com.sucy.skill.thread.RepeatThreadTask; 31 | 32 | /** 33 | * Handles auto saving periodically 34 | */ 35 | public class SaveTask extends RepeatThreadTask 36 | { 37 | /** 38 | * Sets up the save task. This shouldn't be used by other plugins 39 | * as it is set up by the API. 40 | * 41 | * @param api API reference 42 | */ 43 | public SaveTask(SkillAPI api) 44 | { 45 | super( 46 | SkillAPI.getSettings().getSaveFreq(), 47 | SkillAPI.getSettings().getSaveFreq() 48 | ); 49 | } 50 | 51 | /** 52 | * Saves all player data 53 | */ 54 | @Override 55 | public void run() 56 | { 57 | SkillAPI.saveData(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/thread/IThreadTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.thread.IThreadTask 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.thread; 28 | 29 | /** 30 | * Interface for tasks used by the main async task 31 | */ 32 | public interface IThreadTask extends Runnable 33 | { 34 | /** 35 | * Ticks the task, checking if it should run 36 | * 37 | * @return true if expired, false otherwise 38 | */ 39 | boolean tick(); 40 | 41 | /** 42 | * Runs the functions of the task 43 | */ 44 | void run(); 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/thread/ThreadTask.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.thread.ThreadTask 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2016 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.thread; 28 | 29 | /** 30 | * A task that runs ones and is finished 31 | */ 32 | public abstract class ThreadTask implements IThreadTask 33 | { 34 | private int time; 35 | 36 | /** 37 | * Sets up the task to run on the next thread iteration 38 | */ 39 | public ThreadTask() 40 | { 41 | this(0); 42 | } 43 | 44 | /** 45 | * Sets up the task to run after a delay 46 | * 47 | * @param delay delay in ticks 48 | */ 49 | public ThreadTask(int delay) 50 | { 51 | time = delay; 52 | } 53 | 54 | /** 55 | * Ticks the task, running it if applicable 56 | * 57 | * @return true after the task runs, false beforehand 58 | */ 59 | @Override 60 | public boolean tick() 61 | { 62 | if (--time <= 0) 63 | { 64 | run(); 65 | return true; 66 | } 67 | return false; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/tree/basic/LevelHorizontalTree.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.tree.basic.LevelHorizontalTree 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.tree.basic; 28 | 29 | import com.sucy.skill.SkillAPI; 30 | import com.sucy.skill.api.classes.RPGClass; 31 | 32 | /** 33 | * A horizontal level tree implementation 34 | */ 35 | public class LevelHorizontalTree extends LevelTree 36 | { 37 | 38 | /** 39 | * Constructor 40 | * 41 | * @param api api reference 42 | * @param tree tree reference 43 | */ 44 | public LevelHorizontalTree(SkillAPI api, RPGClass tree) 45 | { 46 | super(api, tree); 47 | } 48 | 49 | /** 50 | * @return skills allowed per row 51 | */ 52 | @Override 53 | protected int getPerTierLimit() 54 | { 55 | return 6; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/tree/basic/LevelVerticalTree.java: -------------------------------------------------------------------------------- 1 | /** 2 | * SkillAPI 3 | * com.sucy.skill.tree.basic.LevelVerticalTree 4 | * 5 | * The MIT License (MIT) 6 | * 7 | * Copyright (c) 2014 Steven Sucy 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software") to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in 17 | * all copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | * THE SOFTWARE. 26 | */ 27 | package com.sucy.skill.tree.basic; 28 | 29 | import com.sucy.skill.SkillAPI; 30 | import com.sucy.skill.api.classes.RPGClass; 31 | 32 | /** 33 | * A horizontal level tree implementation 34 | */ 35 | public class LevelVerticalTree extends LevelTree 36 | { 37 | /** 38 | * Constructor 39 | * 40 | * @param api api reference 41 | * @param tree tree reference 42 | */ 43 | public LevelVerticalTree(SkillAPI api, RPGClass tree) 44 | { 45 | super(api, tree); 46 | } 47 | 48 | /** 49 | * @return skills allowed per row 50 | */ 51 | @Override 52 | protected int getPerTierLimit() 53 | { 54 | return 9; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/sucy/skill/util/Lists.java: -------------------------------------------------------------------------------- 1 | package com.sucy.skill.util; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | /** 8 | * SkillAPI © 2018 9 | * com.sucy.skill.util.Lists 10 | */ 11 | public class Lists { 12 | public static List asList(final T... items) { 13 | return new ArrayList<>(Arrays.asList(items)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/SkillAPIModule.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/src/main/resources/SkillAPIModule.jar -------------------------------------------------------------------------------- /src/main/resources/SkillAPIPlaceholders.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sentropic/SkillAPI-s/6500d817c693be88193f88b7511ff1fdbf824228/src/main/resources/SkillAPIPlaceholders.jar -------------------------------------------------------------------------------- /src/main/resources/effects.yml: -------------------------------------------------------------------------------- 1 | single: 2 | formula: 0 3 | steps: 1 4 | copies: 1 5 | domain: 1 6 | x: 0 7 | y: 0 8 | z: 0 9 | linear: 10 | formula: 1 11 | steps: 20 12 | copies: 1 13 | domain: 0 14 | x: 0 15 | y: 0 16 | z: 0 17 | linear-quick: 18 | formula: 1 19 | steps: 10 20 | copies: 1 21 | domain: 0 22 | x: 0 23 | y: 0 24 | z: 0 25 | still: 26 | formula: 0 27 | steps: 20 28 | copies: 1 29 | domain: 0 30 | x: 0 31 | y: 0 32 | z: 0 33 | one-point: 34 | formula: 1 35 | steps: 1 36 | copies: 1 37 | domain: 1 38 | x: 0 39 | y: 0 40 | z: 0 41 | two-point: 42 | formula: 1 43 | steps: 2 44 | copies: 1 45 | domain: 1 46 | x: 0 47 | y: 0 48 | z: 0 49 | three-point: 50 | formula: 1 51 | steps: 3 52 | copies: 1 53 | domain: 1 54 | x: 0 55 | y: 0 56 | z: 0 57 | one-circle: 58 | formula: 1 59 | steps: 20 60 | copies: 1 61 | domain: 1 62 | x: 0 63 | y: 0 64 | z: 0 65 | two-circle: 66 | formula: 1 67 | steps: 20 68 | copies: 2 69 | domain: 1 70 | x: 0 71 | y: 0 72 | z: 0 73 | three-circle: 74 | formula: 1 75 | steps: 20 76 | copies: 3 77 | domain: 1 78 | x: 0 79 | y: 0 80 | z: 0 81 | one-spiral: 82 | formula: t 83 | steps: 20 84 | copies: 1 85 | domain: 1 86 | x: 0 87 | y: 0 88 | z: 0 89 | two-spiral: 90 | formula: t*0.5 91 | steps: 40 92 | copies: 1 93 | domain: 2 94 | x: 0 95 | y: 0 96 | z: 0 97 | three-spiral: 98 | formula: t*0.333 99 | steps: 60 100 | copies: 1 101 | domain: 3 102 | x: 0 103 | y: 0 104 | z: 0 105 | square: 106 | formula: 1/c 107 | steps: 5 108 | copies: 8 109 | domain: 0.125 110 | x: 0 111 | y: 0 112 | z: 0 113 | pentagon: 114 | formula: 1/c 115 | steps: 5 116 | copies: 10 117 | domain: 0.1 118 | x: 0 119 | y: 0 120 | z: 0 121 | hexagon: 122 | formula: 1/c 123 | steps: 4 124 | copies: 12 125 | domain: 0.08333 126 | x: 0 127 | y: 0 128 | z: 0 -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: SkillAPI 2 | main: com.sucy.skill.SkillAPI 3 | version: s1.98 4 | authors: [Eniripsa96, Sentropic] 5 | depend: [MCCore] 6 | softdepend: [Vault, ProtocolLib, Parties, RPGInventory, LibsDisguises, PlaceholderAPI, NoCheatPlus, MythicMobs, WorldGuard, WorldEdit] 7 | loadbefore: [Quests] 8 | api-version: 1.16 9 | 10 | permissions: 11 | skillapi.basic: 12 | description: access to skill trees and using skills 13 | default: true 14 | skillapi.reset: 15 | description: access to resetting your class 16 | default: true 17 | skillapi.exp: 18 | description: access to gaining exp 19 | default: true 20 | skillapi.level: 21 | description: access to using the level and exp commands 22 | default: op 23 | skillapi.mana: 24 | description: access to using the mana command 25 | default: op 26 | skillapi.points: 27 | description: access to using the points command 28 | default: op 29 | skillapi.reload: 30 | description: access to using the reload command 31 | default: op 32 | skillapi.class: 33 | description: access to all classes 34 | default: op 35 | skillapi.skill: 36 | description: access to all skills 37 | default: op 38 | skillapi.lore: 39 | description: access to all lore commands 40 | default: op 41 | skillapi.force: 42 | description: access to force commands 43 | default: false 44 | skillapi.attrib: 45 | description: access to giving attribute points 46 | default: op 47 | skillapi.gui: 48 | description: access to GUI editor menu 49 | default: op 50 | 51 | skillapi.*: 52 | description: access to all commands and features 53 | default: op 54 | children: 55 | skillapi.basic: true 56 | skillapi.reset: true 57 | skillapi.exp: true 58 | skillapi.level: true 59 | skillapi.mana: true 60 | skillapi.points: true 61 | skillapi.reload: true 62 | skillapi.class: true 63 | skillapi.skill: true 64 | skillapi.lore: true 65 | skillapi.gui: true 66 | -------------------------------------------------------------------------------- /src/main/resources/tool.yml: -------------------------------------------------------------------------------- 1 | # Define extra items usable in the GUI editor here. 2 | # NEXT_PAGE nad PREV_PAGE are provided as the items 3 | # used for pages. Do not remove them. 4 | NEXT_PAGE: 5 | type: 'Book' 6 | data: 0 7 | durability: 0 8 | name: '&6Next Page' 9 | lore: 10 | - '' 11 | PREV_PAGE: 12 | type: 'Book' 13 | data: 0 14 | durability: 0 15 | name: '&6Prev Page' 16 | lore: 17 | - '' -------------------------------------------------------------------------------- /src/main/resources/worldGuard.yml: -------------------------------------------------------------------------------- 1 | # 2 | # WorldGuard region IDs that players cannot cast skills in 3 | disable-skills: 4 | - fakeZoneId1 5 | - fakeZoneId2 6 | # 7 | # WorldGuard region IDs that players cannot earn experience in 8 | disable-exp: 9 | - fakeZoneId1 10 | - fakeZoneId2 --------------------------------------------------------------------------------