├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── checkstyle.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── java │ └── in │ │ └── twizmwaz │ │ └── cardinal │ │ ├── Cardinal.java │ │ ├── command │ │ ├── CommandCardinal.java │ │ ├── CommandCycle.java │ │ ├── CommandJoin.java │ │ ├── CommandNext.java │ │ ├── CommandStart.java │ │ └── provider │ │ │ ├── LoadedMapProvider.java │ │ │ └── TeamProvider.java │ │ ├── component │ │ ├── BaseComponentBuilder.java │ │ ├── BaseLanguageComponent.java │ │ ├── map │ │ │ ├── MapComponent.java │ │ │ └── MapComponentBuilder.java │ │ └── team │ │ │ ├── TeamComponent.java │ │ │ └── TeamComponentBuilder.java │ │ ├── event │ │ ├── MatchEvent.java │ │ ├── MatchThreadEvent.java │ │ ├── ObjectiveEvent.java │ │ ├── match │ │ │ ├── MatchChangeStateEvent.java │ │ │ ├── MatchLoadCompleteEvent.java │ │ │ └── MatchModuleLoadCompleteEvent.java │ │ ├── matchthread │ │ │ └── MatchThreadMakeEvent.java │ │ ├── objective │ │ │ ├── ObjectiveCompleteEvent.java │ │ │ └── ObjectiveTouchEvent.java │ │ └── player │ │ │ ├── CardinalRespawnEvent.java │ │ │ ├── PlayerContainerChangeStateEvent.java │ │ │ ├── PlayerJoinMatchThreadEvent.java │ │ │ └── PlayerQuitMatchThreadEvent.java │ │ ├── match │ │ ├── Match.java │ │ ├── MatchState.java │ │ └── MatchThread.java │ │ ├── module │ │ ├── AbstractListenerModule.java │ │ ├── AbstractModule.java │ │ ├── Module.java │ │ ├── ModuleEntry.java │ │ ├── ModuleError.java │ │ ├── ModuleHandler.java │ │ ├── ModuleLoader.java │ │ ├── ModuleRegistry.java │ │ ├── apply │ │ │ ├── AppliedModule.java │ │ │ ├── AppliedRegion.java │ │ │ ├── ApplyType.java │ │ │ └── regions │ │ │ │ └── WoolMonumentPlace.java │ │ ├── channel │ │ │ ├── AbstractChannel.java │ │ │ ├── Channel.java │ │ │ ├── ChannelModule.java │ │ │ └── channels │ │ │ │ ├── GlobalChannel.java │ │ │ │ ├── PlayerChannel.java │ │ │ │ └── TeamChannel.java │ │ ├── connection │ │ │ └── ConnectionModule.java │ │ ├── contributor │ │ │ ├── Contributor.java │ │ │ ├── ContributorModule.java │ │ │ ├── ContributorNamer.java │ │ │ ├── IdentifiedContributor.java │ │ │ └── NamedContributor.java │ │ ├── countdown │ │ │ ├── AbstractCountdown.java │ │ │ ├── CountdownModule.java │ │ │ ├── CycleCountdown.java │ │ │ └── StartCountdown.java │ │ ├── cycle │ │ │ ├── CycleModule.java │ │ │ ├── CycleRunnable.java │ │ │ └── NullChunkGenerator.java │ │ ├── dependency │ │ │ ├── DependencyGraph.java │ │ │ └── DependencyNode.java │ │ ├── event │ │ │ ├── ModuleEvent.java │ │ │ └── ModuleLoadCompleteEvent.java │ │ ├── filter │ │ │ ├── Filter.java │ │ │ ├── FilterException.java │ │ │ ├── FilterModule.java │ │ │ ├── FilterParser.java │ │ │ ├── FilterState.java │ │ │ ├── LoadLateFilter.java │ │ │ ├── exception │ │ │ │ ├── FilterPropertyException.java │ │ │ │ └── property │ │ │ │ │ ├── InvalidFilterPropertyException.java │ │ │ │ │ ├── MissingFilterChildException.java │ │ │ │ │ └── MissingFilterPropertyException.java │ │ │ ├── parser │ │ │ │ ├── CauseFilterParser.java │ │ │ │ ├── ChildFilterParser.java │ │ │ │ ├── ChildrenFilterParser.java │ │ │ │ ├── EntityFilterParser.java │ │ │ │ ├── ItemFilterParser.java │ │ │ │ ├── LayerFilterParser.java │ │ │ │ ├── MaterialFilterParser.java │ │ │ │ ├── ObjectiveFilterParser.java │ │ │ │ ├── RandomFilterParser.java │ │ │ │ ├── RangeFilterParser.java │ │ │ │ ├── SpawnFilterParser.java │ │ │ │ └── TeamFilterParser.java │ │ │ └── type │ │ │ │ ├── AgnosticFilter.java │ │ │ │ ├── CanFlyFilter.java │ │ │ │ ├── CarryingFilter.java │ │ │ │ ├── CauseFilter.java │ │ │ │ ├── CreatureFilter.java │ │ │ │ ├── CrouchingFilter.java │ │ │ │ ├── EntityFilter.java │ │ │ │ ├── FlyingFilter.java │ │ │ │ ├── HoldingFilter.java │ │ │ │ ├── LayerFilter.java │ │ │ │ ├── MaterialFilter.java │ │ │ │ ├── MonsterFilter.java │ │ │ │ ├── ObjectTypeFilter.java │ │ │ │ ├── ObjectiveFilter.java │ │ │ │ ├── RandomFilter.java │ │ │ │ ├── SameTeamFilter.java │ │ │ │ ├── SingleObjectFilter.java │ │ │ │ ├── SpawnFilter.java │ │ │ │ ├── SprintingFilter.java │ │ │ │ ├── StaticFilter.java │ │ │ │ ├── TeamFilter.java │ │ │ │ ├── VoidFilter.java │ │ │ │ ├── WalkingFilter.java │ │ │ │ ├── WearingFilter.java │ │ │ │ └── modifiers │ │ │ │ ├── AllFilter.java │ │ │ │ ├── AllowFilter.java │ │ │ │ ├── AnyFilter.java │ │ │ │ ├── DenyFilter.java │ │ │ │ ├── HasResultFilter.java │ │ │ │ ├── NotFilter.java │ │ │ │ ├── OneFilter.java │ │ │ │ ├── RangeFilter.java │ │ │ │ └── TransformFilter.java │ │ ├── id │ │ │ └── IdModule.java │ │ ├── interact │ │ │ └── InteractModule.java │ │ ├── itemremove │ │ │ └── ItemRemoveModule.java │ │ ├── kit │ │ │ ├── Kit.java │ │ │ ├── KitModule.java │ │ │ ├── KitRemovable.java │ │ │ ├── listener │ │ │ │ ├── DoubleJumpListener.java │ │ │ │ └── ShieldListener.java │ │ │ └── type │ │ │ │ ├── KitArmor.java │ │ │ │ ├── KitAttribute.java │ │ │ │ ├── KitClear.java │ │ │ │ ├── KitCluster.java │ │ │ │ ├── KitDoubleJump.java │ │ │ │ ├── KitFly.java │ │ │ │ ├── KitGameMode.java │ │ │ │ ├── KitHealth.java │ │ │ │ ├── KitItem.java │ │ │ │ ├── KitKnockback.java │ │ │ │ ├── KitPotion.java │ │ │ │ ├── KitShield.java │ │ │ │ └── KitWalkSpeed.java │ │ ├── objective │ │ │ ├── Objective.java │ │ │ ├── ObjectiveScoreboardHandler.java │ │ │ ├── OwnedObjective.java │ │ │ ├── ProximityMetric.java │ │ │ ├── ProximityRule.java │ │ │ ├── core │ │ │ │ ├── Core.java │ │ │ │ └── CoreModule.java │ │ │ ├── destroyable │ │ │ │ ├── Destroyable.java │ │ │ │ └── DestroyableModule.java │ │ │ └── wool │ │ │ │ ├── Wool.java │ │ │ │ └── WoolModule.java │ │ ├── region │ │ │ ├── AbstractRegion.java │ │ │ ├── Region.java │ │ │ ├── RegionBounds.java │ │ │ ├── RegionException.java │ │ │ ├── RegionModule.java │ │ │ ├── RegionParser.java │ │ │ ├── exception │ │ │ │ ├── RegionAttributeException.java │ │ │ │ ├── RegionPropertyException.java │ │ │ │ ├── attribute │ │ │ │ │ ├── InvalidRegionAttributeException.java │ │ │ │ │ └── MissingRegionAttributeException.java │ │ │ │ └── property │ │ │ │ │ ├── InvalidRegionPropertyException.java │ │ │ │ │ └── MissingRegionPropertyException.java │ │ │ ├── parser │ │ │ │ ├── AboveRegionParser.java │ │ │ │ ├── BelowRegionParser.java │ │ │ │ ├── BlockRegionParser.java │ │ │ │ ├── CircleRegionParser.java │ │ │ │ ├── CuboidRegionParser.java │ │ │ │ ├── CylinderRegionParser.java │ │ │ │ ├── HalfRegionParser.java │ │ │ │ ├── PointRegionParser.java │ │ │ │ ├── RectangleRegionParser.java │ │ │ │ ├── SphereRegionParser.java │ │ │ │ └── modifications │ │ │ │ │ ├── ComplementRegionParser.java │ │ │ │ │ ├── IntersectRegionParser.java │ │ │ │ │ ├── MirroredRegionParser.java │ │ │ │ │ ├── NegativeRegionParser.java │ │ │ │ │ ├── TranslatedRegionParser.java │ │ │ │ │ └── UnionRegionParser.java │ │ │ └── type │ │ │ │ ├── AboveRegion.java │ │ │ │ ├── BelowRegion.java │ │ │ │ ├── BlockRegion.java │ │ │ │ ├── CircleRegion.java │ │ │ │ ├── CuboidRegion.java │ │ │ │ ├── CylinderRegion.java │ │ │ │ ├── EmptyRegion.java │ │ │ │ ├── EverywhereRegion.java │ │ │ │ ├── FiniteBlockRegion.java │ │ │ │ ├── HalfRegion.java │ │ │ │ ├── NowhereRegion.java │ │ │ │ ├── PointRegion.java │ │ │ │ ├── RectangleRegion.java │ │ │ │ ├── SphereRegion.java │ │ │ │ └── modifications │ │ │ │ ├── ComplementRegion.java │ │ │ │ ├── IntersectRegion.java │ │ │ │ ├── MirroredRegion.java │ │ │ │ ├── NegativeRegion.java │ │ │ │ ├── PointProviderRegion.java │ │ │ │ ├── TranslatedRegion.java │ │ │ │ └── UnionRegion.java │ │ ├── repository │ │ │ ├── LoadedMap.java │ │ │ └── RepositoryModule.java │ │ ├── rotation │ │ │ ├── Rotation.java │ │ │ └── RotationModule.java │ │ ├── scoreboard │ │ │ ├── MatchScoreboardManager.java │ │ │ ├── ScoreboardDisplay.java │ │ │ ├── ScoreboardModule.java │ │ │ └── displayables │ │ │ │ ├── Displayable.java │ │ │ │ ├── EmptyScoreboardEntry.java │ │ │ │ ├── EntryHolder.java │ │ │ │ ├── EntryUpdater.java │ │ │ │ ├── OwnedObjectiveScoreboardEntry.java │ │ │ │ ├── ScoreScoreboardEntry.java │ │ │ │ ├── ScoreboardEntry.java │ │ │ │ ├── ScoreboardGroup.java │ │ │ │ ├── SortableEntry.java │ │ │ │ ├── SortableScoreboardEntry.java │ │ │ │ ├── SortedScoreboardGroup.java │ │ │ │ ├── TeamName.java │ │ │ │ └── WoolScoreboardEntry.java │ │ ├── scores │ │ │ ├── PlayerContainerScore.java │ │ │ ├── ScoreModule.java │ │ │ └── ScoreRule.java │ │ ├── spawn │ │ │ ├── Spawn.java │ │ │ └── SpawnModule.java │ │ └── team │ │ │ ├── NameTagVisibility.java │ │ │ ├── SinglePlayerContainer.java │ │ │ ├── Team.java │ │ │ └── TeamModule.java │ │ ├── playercontainer │ │ ├── CompetitorContainer.java │ │ ├── Containers.java │ │ ├── PlayerContainer.java │ │ └── PlayerContainerData.java │ │ └── util │ │ ├── ArmorType.java │ │ ├── Channels.java │ │ ├── Characters.java │ │ ├── ChatUtil.java │ │ ├── Colors.java │ │ ├── Components.java │ │ ├── Gamemode.java │ │ ├── Geometry.java │ │ ├── ItemStackBuilder.java │ │ ├── Items.java │ │ ├── ListUtil.java │ │ ├── MaterialPattern.java │ │ ├── MaterialType.java │ │ ├── Numbers.java │ │ ├── ParseUtil.java │ │ ├── Players.java │ │ ├── Proto.java │ │ ├── Strings.java │ │ ├── Taskable.java │ │ └── document │ │ └── DocumentItems.java └── resources │ ├── config.yml │ ├── lang │ └── cardinal │ │ └── en_US.properties │ └── plugin.yml └── test └── java └── in └── twizmwaz └── cardinal ├── module └── dependency │ └── DependencyGraphTest.java └── util ├── GamemodeTest.java └── ProtoTest.java /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016, Kevin Phoenix 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Cardinal [![Build Status](http://ci.twizmwaz.in/job/Cardinal2/badge/icon)](http://ci.twizmwaz.in/job/Cardinal2) 2 | --- 3 | 4 | Cardinal2 is currently in early development. If you are looking to run Cardinal 5 | on your server, please continue using Cardinal1. 6 | 7 | ### Compiling 8 | **Prerequisites:** Git, Java 8 (or later), Gradle (optional) 9 | We use Gradle for build management. To build on \*nix just run 10 | `./gradlew build` from the project's root directory. On windows, use 11 | `gradle.bat build`. The artifact will be found in `build/libs`, named 12 | `cardinal-X.X-SNAPSHOT-all.jar` 13 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CardinalDevelopment/Cardinal/6e8d7dcab851d9d40c78331e91c920cfe5a00c62/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Apr 26 23:37:45 EDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'cardinal' -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/command/CommandCardinal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.command; 27 | 28 | import ee.ellytr.command.Command; 29 | import ee.ellytr.command.CommandContext; 30 | import in.twizmwaz.cardinal.Cardinal; 31 | import net.md_5.bungee.api.ChatColor; 32 | 33 | public class CommandCardinal { 34 | 35 | @Command(aliases = "cardinal", description = "Displays information about Cardinal") 36 | public static void cardinal(CommandContext cmd) { 37 | cmd.getSender().sendMessage(ChatColor.GREEN + "This server is running Cardinal version " 38 | + Cardinal.getInstance().getDescription().getVersion()); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/MatchEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event; 27 | 28 | import in.twizmwaz.cardinal.match.Match; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import org.bukkit.event.Event; 32 | 33 | @Getter 34 | @AllArgsConstructor 35 | public abstract class MatchEvent extends Event { 36 | 37 | private final Match match; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/MatchThreadEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event; 27 | 28 | import in.twizmwaz.cardinal.match.MatchThread; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import org.bukkit.event.Event; 32 | 33 | @Getter 34 | @AllArgsConstructor 35 | public abstract class MatchThreadEvent extends Event { 36 | 37 | private final MatchThread matchThread; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/ObjectiveEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event; 27 | 28 | import in.twizmwaz.cardinal.module.objective.Objective; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import lombok.Setter; 32 | import org.bukkit.event.Event; 33 | import org.bukkit.event.HandlerList; 34 | 35 | @Getter 36 | @Setter 37 | @AllArgsConstructor 38 | public abstract class ObjectiveEvent extends Event { 39 | 40 | private static final HandlerList handlers = new HandlerList(); 41 | private Objective objective; 42 | 43 | @Override 44 | public HandlerList getHandlers() { 45 | return handlers; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/match/MatchChangeStateEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.match; 27 | 28 | import in.twizmwaz.cardinal.event.MatchEvent; 29 | import in.twizmwaz.cardinal.match.Match; 30 | import in.twizmwaz.cardinal.match.MatchState; 31 | import lombok.Getter; 32 | import lombok.Setter; 33 | import org.bukkit.event.Cancellable; 34 | import org.bukkit.event.HandlerList; 35 | 36 | @Getter 37 | @Setter 38 | public class MatchChangeStateEvent extends MatchEvent implements Cancellable { 39 | 40 | private final MatchState state; 41 | private boolean cancelled; 42 | 43 | @Getter 44 | private static final HandlerList handlerList = new HandlerList(); 45 | 46 | public MatchChangeStateEvent(Match match, MatchState state) { 47 | super(match); 48 | this.state = state; 49 | } 50 | 51 | @Override 52 | public HandlerList getHandlers() { 53 | return handlerList; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/match/MatchLoadCompleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.match; 27 | 28 | import in.twizmwaz.cardinal.event.MatchEvent; 29 | import in.twizmwaz.cardinal.match.Match; 30 | import lombok.Getter; 31 | import org.bukkit.event.HandlerList; 32 | 33 | public class MatchLoadCompleteEvent extends MatchEvent { 34 | 35 | @Getter 36 | private static final HandlerList handlerList = new HandlerList(); 37 | 38 | public MatchLoadCompleteEvent(Match match) { 39 | super(match); 40 | } 41 | 42 | @Override 43 | public HandlerList getHandlers() { 44 | return handlerList; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/match/MatchModuleLoadCompleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.match; 27 | 28 | import in.twizmwaz.cardinal.event.MatchEvent; 29 | import in.twizmwaz.cardinal.match.Match; 30 | import lombok.Getter; 31 | import org.bukkit.event.HandlerList; 32 | 33 | public class MatchModuleLoadCompleteEvent extends MatchEvent { 34 | 35 | @Getter 36 | private static final HandlerList handlerList = new HandlerList(); 37 | 38 | public MatchModuleLoadCompleteEvent(Match match) { 39 | super(match); 40 | } 41 | 42 | @Override 43 | public HandlerList getHandlers() { 44 | return handlerList; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/matchthread/MatchThreadMakeEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.matchthread; 27 | 28 | import in.twizmwaz.cardinal.event.MatchThreadEvent; 29 | import in.twizmwaz.cardinal.match.MatchThread; 30 | import lombok.Getter; 31 | import lombok.NonNull; 32 | import lombok.Setter; 33 | import org.bukkit.event.HandlerList; 34 | 35 | @Getter 36 | @Setter 37 | public class MatchThreadMakeEvent extends MatchThreadEvent { 38 | 39 | @Getter 40 | private static final HandlerList handlerList = new HandlerList(); 41 | 42 | public MatchThreadMakeEvent(@NonNull MatchThread matchThread) { 43 | super(matchThread); 44 | } 45 | 46 | @Override 47 | public HandlerList getHandlers() { 48 | return handlerList; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/objective/ObjectiveCompleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.objective; 27 | 28 | import in.twizmwaz.cardinal.event.ObjectiveEvent; 29 | import in.twizmwaz.cardinal.module.objective.Objective; 30 | import lombok.Getter; 31 | import lombok.Setter; 32 | import org.bukkit.entity.Player; 33 | 34 | @Getter 35 | @Setter 36 | public class ObjectiveCompleteEvent extends ObjectiveEvent { 37 | 38 | private Player player; 39 | 40 | public ObjectiveCompleteEvent(Objective objective, Player player) { 41 | super(objective); 42 | this.player = player; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/objective/ObjectiveTouchEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.objective; 27 | 28 | import in.twizmwaz.cardinal.event.ObjectiveEvent; 29 | import in.twizmwaz.cardinal.module.objective.Objective; 30 | import lombok.Getter; 31 | import lombok.Setter; 32 | import org.bukkit.entity.Player; 33 | 34 | @Getter 35 | @Setter 36 | public class ObjectiveTouchEvent extends ObjectiveEvent { 37 | 38 | private Player player; 39 | 40 | /** 41 | * An event that is called when any objective has been touched. 42 | * 43 | * @param objective The objective. 44 | * @param player The player that has touched the objective, if applicable. 45 | */ 46 | public ObjectiveTouchEvent(Objective objective, Player player) { 47 | super(objective); 48 | this.player = player; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/player/CardinalRespawnEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.player; 27 | 28 | import in.twizmwaz.cardinal.module.spawn.Spawn; 29 | import lombok.Getter; 30 | import lombok.Setter; 31 | import org.bukkit.entity.Player; 32 | import org.bukkit.event.HandlerList; 33 | import org.bukkit.event.player.PlayerEvent; 34 | 35 | @Getter 36 | @Setter 37 | public class CardinalRespawnEvent extends PlayerEvent { 38 | 39 | private Spawn spawn; 40 | 41 | @Getter 42 | private static final HandlerList handlerList = new HandlerList(); 43 | 44 | public CardinalRespawnEvent(Player who, Spawn where) { 45 | super(who); 46 | spawn = where; 47 | } 48 | 49 | @Override 50 | public HandlerList getHandlers() { 51 | return handlerList; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/player/PlayerJoinMatchThreadEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.player; 27 | 28 | import in.twizmwaz.cardinal.match.MatchThread; 29 | import lombok.Getter; 30 | import lombok.Setter; 31 | import org.bukkit.entity.Player; 32 | import org.bukkit.event.HandlerList; 33 | import org.bukkit.event.player.PlayerEvent; 34 | 35 | @Getter 36 | @Setter 37 | public class PlayerJoinMatchThreadEvent extends PlayerEvent { 38 | 39 | @Getter 40 | private static final HandlerList handlerList = new HandlerList(); 41 | 42 | private MatchThread matchThread; 43 | 44 | public PlayerJoinMatchThreadEvent(Player who, MatchThread matchThread) { 45 | super(who); 46 | this.matchThread = matchThread; 47 | } 48 | 49 | @Override 50 | public HandlerList getHandlers() { 51 | return handlerList; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/event/player/PlayerQuitMatchThreadEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.event.player; 27 | 28 | import in.twizmwaz.cardinal.match.MatchThread; 29 | import lombok.Getter; 30 | import lombok.Setter; 31 | import org.bukkit.entity.Player; 32 | import org.bukkit.event.HandlerList; 33 | import org.bukkit.event.player.PlayerEvent; 34 | 35 | @Getter 36 | @Setter 37 | public class PlayerQuitMatchThreadEvent extends PlayerEvent { 38 | 39 | @Getter 40 | private static final HandlerList handlerList = new HandlerList(); 41 | 42 | private MatchThread matchThread; 43 | 44 | public PlayerQuitMatchThreadEvent(Player who, MatchThread matchThread) { 45 | super(who); 46 | this.matchThread = matchThread; 47 | } 48 | 49 | @Override 50 | public HandlerList getHandlers() { 51 | return handlerList; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/match/MatchState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.match; 27 | 28 | public enum MatchState { 29 | 30 | WAITING, STARTING, PLAYING, ENDED, CYCLING 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/AbstractListenerModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module; 27 | 28 | import in.twizmwaz.cardinal.Cardinal; 29 | import org.bukkit.event.Listener; 30 | 31 | public class AbstractListenerModule extends AbstractModule implements Listener { 32 | 33 | public AbstractListenerModule() { 34 | Cardinal.registerEvents(this); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/AbstractModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module; 27 | 28 | import com.google.common.collect.Lists; 29 | import in.twizmwaz.cardinal.match.Match; 30 | import lombok.Getter; 31 | import lombok.NonNull; 32 | 33 | import java.util.List; 34 | 35 | @Getter 36 | public abstract class AbstractModule implements Module { 37 | 38 | @NonNull 39 | protected List errors = Lists.newArrayList(); 40 | 41 | @Override 42 | public void clearMatch(@NonNull Match match) { 43 | } 44 | 45 | @Override 46 | public boolean loadMatch(@NonNull Match match) { 47 | return true; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/ModuleEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module; 27 | 28 | import java.lang.annotation.ElementType; 29 | import java.lang.annotation.Retention; 30 | import java.lang.annotation.RetentionPolicy; 31 | import java.lang.annotation.Target; 32 | 33 | @Target(ElementType.TYPE) 34 | @Retention(RetentionPolicy.RUNTIME) 35 | public @interface ModuleEntry { 36 | /** 37 | * @return The classes of modules to load matches before this module. 38 | */ 39 | public Class[] depends() default {}; 40 | 41 | /** 42 | * @return The classes of modules to load matches after this module. 43 | */ 44 | public Class[] loadBefore() default {}; 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/ModuleError.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module; 27 | 28 | import in.twizmwaz.cardinal.module.repository.LoadedMap; 29 | import lombok.Data; 30 | 31 | @Data 32 | public final class ModuleError { 33 | 34 | private final Module module; 35 | private final LoadedMap map; 36 | private final String[] message; 37 | private final boolean critical; 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/apply/ApplyType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.apply; 27 | 28 | import lombok.AllArgsConstructor; 29 | 30 | @AllArgsConstructor 31 | public enum ApplyType { 32 | 33 | ENTER("enter"), 34 | LEAVE("leave"), 35 | BLOCK("block"), 36 | BLOCK_PLACE("block-place"), 37 | BLOCK_PLACE_AGAINST("block-place-against"), 38 | BLOCK_BREAK("block-break"), 39 | BLOCK_PHYSICS("block-physics"), 40 | USE("use"), 41 | MOBS("mobs"), 42 | KIT("filter", "kit"), 43 | KIT_LEND("filter", "lend-kit"), 44 | VELOCITY("filter", "velocity"); 45 | 46 | public final String filterAttr; 47 | public final String otherAttr; 48 | public final boolean filterOnly; 49 | 50 | private ApplyType(String filterAttr) { 51 | this(filterAttr, null, true); 52 | } 53 | 54 | private ApplyType(String filterAttr, String otherAttr) { 55 | this(filterAttr, otherAttr, false); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/channel/Channel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.channel; 27 | 28 | import net.md_5.bungee.api.chat.BaseComponent; 29 | import org.bukkit.entity.Player; 30 | 31 | public interface Channel { 32 | 33 | void sendMessage(BaseComponent... components); 34 | 35 | void sendMessage(String... message); 36 | 37 | /** 38 | * Adds a player to this channel. 39 | * 40 | * @param player The player to be added to this channel. 41 | */ 42 | void addPlayer(Player player); 43 | 44 | /** 45 | * Removes a player from this channel. 46 | * 47 | * @param player The player to be removed from this channel. 48 | */ 49 | void removePlayer(Player player); 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/channel/channels/GlobalChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.channel.channels; 27 | 28 | import in.twizmwaz.cardinal.module.channel.AbstractChannel; 29 | import org.bukkit.event.EventHandler; 30 | import org.bukkit.event.Listener; 31 | import org.bukkit.event.player.PlayerJoinEvent; 32 | import org.bukkit.event.player.PlayerQuitEvent; 33 | 34 | public class GlobalChannel extends AbstractChannel implements Listener { 35 | 36 | /** 37 | * Adds the player to this channel when they join. 38 | * 39 | * @param event The event. 40 | */ 41 | @EventHandler 42 | public void onPlayerJoin(PlayerJoinEvent event) { 43 | addPlayer(event.getPlayer()); 44 | } 45 | 46 | /** 47 | * Removes the player from this channel when they quit. 48 | * 49 | * @param event The event. 50 | */ 51 | @EventHandler 52 | public void onPlayerQuit(PlayerQuitEvent event) { 53 | removePlayer(event.getPlayer()); 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/channel/channels/PlayerChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.channel.channels; 27 | 28 | import in.twizmwaz.cardinal.module.channel.AbstractChannel; 29 | import lombok.Getter; 30 | import org.bukkit.entity.Player; 31 | 32 | @Getter 33 | public class PlayerChannel extends AbstractChannel { 34 | 35 | public PlayerChannel(Player player) { 36 | addPlayer(player); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/contributor/Contributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.contributor; 27 | 28 | 29 | /** 30 | * Represents a map contributor. 31 | */ 32 | public interface Contributor { 33 | 34 | /** 35 | * @return The name of the contributor. 36 | */ 37 | String getName(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/contributor/ContributorNamer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.contributor; 27 | 28 | import lombok.Data; 29 | import org.bukkit.Bukkit; 30 | 31 | @Data 32 | public final class ContributorNamer implements Runnable { 33 | 34 | private final IdentifiedContributor contributor; 35 | 36 | @Override 37 | public void run() { 38 | contributor.setName(Bukkit.getOfflinePlayer(contributor.getUuid()).getName()); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/contributor/IdentifiedContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.contributor; 27 | 28 | import lombok.Data; 29 | import lombok.NonNull; 30 | 31 | import java.util.UUID; 32 | 33 | @Data 34 | final class IdentifiedContributor implements Contributor { 35 | 36 | @NonNull 37 | private final UUID uuid; 38 | private String name; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/contributor/NamedContributor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.contributor; 27 | 28 | import lombok.Data; 29 | import lombok.NonNull; 30 | 31 | @Data 32 | final class NamedContributor implements Contributor { 33 | 34 | @NonNull 35 | private final String name; 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/cycle/NullChunkGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.cycle; 27 | 28 | import org.bukkit.World; 29 | import org.bukkit.generator.ChunkGenerator; 30 | 31 | import java.util.Random; 32 | 33 | public class NullChunkGenerator extends ChunkGenerator { 34 | 35 | @Override 36 | public byte[] generate(World world, Random random, int xchord, int zchord) { 37 | return new byte[65536]; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/dependency/DependencyNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.dependency; 27 | 28 | import com.google.common.collect.Lists; 29 | import lombok.Getter; 30 | import lombok.NonNull; 31 | import lombok.RequiredArgsConstructor; 32 | 33 | import java.util.List; 34 | 35 | @RequiredArgsConstructor 36 | @Getter 37 | final class DependencyNode { 38 | 39 | @NonNull 40 | private final T value; 41 | @NonNull 42 | private final List> dependencies = Lists.newArrayList(); 43 | 44 | void addDependency(DependencyNode node) { 45 | dependencies.add(node); 46 | } 47 | 48 | void addDependencies(DependencyNode[] nodes) { 49 | for (DependencyNode node : nodes) { 50 | addDependency(node); 51 | } 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | return "DependencyNode{value=" + value + "}"; 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/event/ModuleEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.event; 27 | 28 | import in.twizmwaz.cardinal.module.ModuleHandler; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import lombok.NonNull; 32 | import org.bukkit.event.Event; 33 | 34 | @AllArgsConstructor 35 | @Getter 36 | public abstract class ModuleEvent extends Event { 37 | 38 | @NonNull 39 | private final ModuleHandler moduleHandler; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/event/ModuleLoadCompleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.event; 27 | 28 | import in.twizmwaz.cardinal.module.ModuleHandler; 29 | import lombok.Getter; 30 | import lombok.NonNull; 31 | import org.bukkit.event.HandlerList; 32 | 33 | @Getter 34 | public class ModuleLoadCompleteEvent extends ModuleEvent { 35 | 36 | @Getter 37 | private static final HandlerList handlerList = new HandlerList(); 38 | 39 | public ModuleLoadCompleteEvent(@NonNull ModuleHandler moduleHandler) { 40 | super(moduleHandler); 41 | } 42 | 43 | @Override 44 | public HandlerList getHandlers() { 45 | return handlerList; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/Filter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter; 27 | 28 | public interface Filter { 29 | 30 | FilterState evaluate(Object... evaluating); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/FilterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter; 27 | 28 | public class FilterException extends Exception { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/FilterParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter; 27 | 28 | public interface FilterParser { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/FilterState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter; 27 | 28 | public enum FilterState { 29 | 30 | ALLOW, 31 | DENY, 32 | ABSTAIN; 33 | 34 | public static FilterState fromBoolean(Boolean state) { 35 | return state == null ? ABSTAIN : state ? ALLOW : DENY; 36 | } 37 | 38 | public boolean toBoolean() { 39 | return !this.equals(DENY); 40 | } 41 | 42 | public boolean hasResult() { 43 | return !this.equals(ABSTAIN); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/LoadLateFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter; 27 | 28 | import in.twizmwaz.cardinal.match.Match; 29 | 30 | // Fixme: lacks a better name 31 | public interface LoadLateFilter { 32 | 33 | void load(Match match) throws FilterException; 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/exception/FilterPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.exception; 27 | 28 | import in.twizmwaz.cardinal.module.filter.FilterException; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import org.jdom2.Element; 32 | 33 | @Getter 34 | @AllArgsConstructor 35 | public class FilterPropertyException extends FilterException { 36 | 37 | private final String property; 38 | private final Element element; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/exception/property/InvalidFilterPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.exception.property; 27 | 28 | import in.twizmwaz.cardinal.module.filter.exception.FilterPropertyException; 29 | import org.jdom2.Element; 30 | 31 | public class InvalidFilterPropertyException extends FilterPropertyException { 32 | 33 | public InvalidFilterPropertyException(String property, Element element) { 34 | super(property, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/exception/property/MissingFilterChildException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.exception.property; 27 | 28 | import in.twizmwaz.cardinal.module.filter.exception.FilterPropertyException; 29 | import org.jdom2.Element; 30 | 31 | public class MissingFilterChildException extends FilterPropertyException { 32 | 33 | public MissingFilterChildException(String child, Element element) { 34 | super(child, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/exception/property/MissingFilterPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.exception.property; 27 | 28 | import in.twizmwaz.cardinal.module.filter.exception.FilterPropertyException; 29 | import org.jdom2.Element; 30 | 31 | public class MissingFilterPropertyException extends FilterPropertyException { 32 | 33 | public MissingFilterPropertyException(String property, Element element) { 34 | super(property, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/AgnosticFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public abstract class AgnosticFilter implements Filter { 32 | 33 | public abstract FilterState evaluate(); 34 | 35 | @Override 36 | public FilterState evaluate(Object... objects) { 37 | return evaluate(); 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/CanFlyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public class CanFlyFilter extends ObjectTypeFilter { 31 | 32 | @Override 33 | public Class getType() { 34 | return Player.class; 35 | } 36 | 37 | @Override 38 | public Boolean evaluate(Player evaluating) { 39 | return evaluating.getAllowFlight(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/CarryingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import lombok.AllArgsConstructor; 29 | import org.bukkit.entity.Player; 30 | import org.bukkit.inventory.ItemStack; 31 | 32 | @AllArgsConstructor 33 | public class CarryingFilter extends ObjectTypeFilter { 34 | 35 | private final ItemStack item; 36 | 37 | @Override 38 | public Class getType() { 39 | return Player.class; 40 | } 41 | 42 | @Override 43 | public Boolean evaluate(Player evaluating) { 44 | return evaluating.getInventory().contains(item); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/CreatureFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Creature; 29 | import org.bukkit.entity.Entity; 30 | import org.bukkit.entity.EntityType; 31 | 32 | public class CreatureFilter extends ObjectTypeFilter { 33 | 34 | @Override 35 | public Class getType() { 36 | return Entity.class; 37 | } 38 | 39 | @Override 40 | public Boolean evaluate(Entity entity) { 41 | return entity instanceof Creature || entity.getType().equals(EntityType.SLIME); // Slimes extend Living entity 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/CrouchingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public class CrouchingFilter extends ObjectTypeFilter { 31 | 32 | @Override 33 | public Class getType() { 34 | return Player.class; 35 | } 36 | 37 | @Override 38 | public Boolean evaluate(Player evaluating) { 39 | return evaluating.isSneaking(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/FlyingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public class FlyingFilter extends ObjectTypeFilter { 31 | 32 | @Override 33 | public Class getType() { 34 | return Player.class; 35 | } 36 | 37 | @Override 38 | public Boolean evaluate(Player evaluating) { 39 | return evaluating.isFlying(); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/HoldingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import lombok.AllArgsConstructor; 29 | import org.bukkit.entity.Player; 30 | import org.bukkit.inventory.ItemStack; 31 | 32 | @AllArgsConstructor 33 | public class HoldingFilter extends ObjectTypeFilter { 34 | 35 | private final ItemStack item; 36 | 37 | @Override 38 | public Class getType() { 39 | return Player.class; 40 | } 41 | 42 | @Override 43 | public Boolean evaluate(Player evaluating) { 44 | return evaluating.getInventory().getItemInMainHand().isSimilar(item); 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/MonsterFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Entity; 29 | import org.bukkit.entity.EntityType; 30 | import org.bukkit.entity.Monster; 31 | 32 | public class MonsterFilter extends ObjectTypeFilter { 33 | 34 | @Override 35 | public Class getType() { 36 | return Entity.class; 37 | } 38 | 39 | @Override 40 | public Boolean evaluate(Entity entity) { 41 | return entity instanceof Monster || entity.getType().equals(EntityType.SLIME); // Slimes extend Living entity 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/ObjectTypeFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | 29 | import in.twizmwaz.cardinal.module.filter.Filter; 30 | import in.twizmwaz.cardinal.module.filter.FilterState; 31 | 32 | public abstract class ObjectTypeFilter implements Filter { 33 | 34 | public abstract Class getType(); 35 | 36 | public abstract Boolean evaluate(T evaluating); 37 | 38 | @Override 39 | @SuppressWarnings("unchecked") 40 | public FilterState evaluate(Object... objects) { 41 | for (Object obj : objects) { 42 | if (getType().isAssignableFrom(obj.getClass())) { 43 | return FilterState.fromBoolean(evaluate((T) obj)); 44 | } 45 | } 46 | return FilterState.ABSTAIN; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/RandomFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import in.twizmwaz.cardinal.module.filter.FilterState; 29 | import in.twizmwaz.cardinal.module.filter.parser.RandomFilterParser; 30 | import lombok.AllArgsConstructor; 31 | 32 | import java.util.Random; 33 | 34 | @AllArgsConstructor 35 | public class RandomFilter extends AgnosticFilter { 36 | 37 | private final double chance; 38 | 39 | public RandomFilter(RandomFilterParser parser) { 40 | this(parser.getChance()); 41 | } 42 | 43 | @Override 44 | public FilterState evaluate() { 45 | return FilterState.fromBoolean(new Random().nextDouble() <= chance); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/SingleObjectFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public abstract class SingleObjectFilter implements Filter { 32 | 33 | public abstract FilterState evaluate(Object evaluating); 34 | 35 | @Override 36 | public FilterState evaluate(Object... objects) { 37 | for (Object obj : objects) { 38 | FilterState response = this.evaluate(obj); 39 | if (!response.equals(FilterState.ABSTAIN)) { 40 | return response; 41 | } 42 | } 43 | return FilterState.ABSTAIN; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/SpawnFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import in.twizmwaz.cardinal.module.filter.FilterState; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.event.entity.CreatureSpawnEvent; 31 | 32 | @AllArgsConstructor 33 | public class SpawnFilter extends SingleObjectFilter { 34 | 35 | private final CreatureSpawnEvent.SpawnReason spawnReason; 36 | 37 | @Override 38 | public FilterState evaluate(Object evaluating) { 39 | if (evaluating instanceof CreatureSpawnEvent) { 40 | return FilterState.fromBoolean(((CreatureSpawnEvent) evaluating).getSpawnReason().equals(spawnReason)); 41 | } else if (evaluating instanceof CreatureSpawnEvent.SpawnReason) { 42 | return FilterState.fromBoolean(spawnReason.equals(evaluating)); 43 | } 44 | return FilterState.ABSTAIN; 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/SprintingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public class SprintingFilter extends ObjectTypeFilter { 31 | 32 | @Override 33 | public Class getType() { 34 | return Player.class; 35 | } 36 | 37 | @Override 38 | public Boolean evaluate(Player evaluating) { 39 | return evaluating.isSprinting(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/StaticFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import in.twizmwaz.cardinal.module.filter.FilterState; 29 | import lombok.AllArgsConstructor; 30 | 31 | @AllArgsConstructor 32 | public class StaticFilter extends AgnosticFilter { 33 | 34 | private final FilterState state; 35 | 36 | @Override 37 | public FilterState evaluate() { 38 | return state; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/VoidFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | public class VoidFilter extends LayerFilter { 29 | 30 | public VoidFilter() { 31 | super(0, Coordinate.Y); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/WalkingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import org.bukkit.entity.Player; 29 | import org.bukkit.util.Vector; 30 | 31 | public class WalkingFilter extends ObjectTypeFilter { 32 | 33 | @Override 34 | public Class getType() { 35 | return Player.class; 36 | } 37 | 38 | @Override 39 | public Boolean evaluate(Player evaluating) { 40 | Vector velocity = evaluating.getVelocity(); 41 | return velocity.length() != 0 && velocity.getY() == 0 && !evaluating.isSprinting(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/WearingFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type; 27 | 28 | import lombok.AllArgsConstructor; 29 | import org.bukkit.entity.Player; 30 | import org.bukkit.inventory.ItemStack; 31 | 32 | @AllArgsConstructor 33 | public class WearingFilter extends ObjectTypeFilter { 34 | 35 | private final ItemStack item; 36 | 37 | @Override 38 | public Class getType() { 39 | return Player.class; 40 | } 41 | 42 | @Override 43 | public Boolean evaluate(Player evaluating) { 44 | for (ItemStack wearing : evaluating.getInventory().getArmorContents()) { 45 | if (item.isSimilar(wearing)) { 46 | return true; 47 | } 48 | } 49 | return false; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/AllFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import com.google.common.collect.Lists; 29 | import in.twizmwaz.cardinal.module.filter.Filter; 30 | 31 | import java.util.List; 32 | 33 | public class AllFilter extends RangeFilter { 34 | 35 | public AllFilter(Filter... children) { 36 | this(Lists.newArrayList(children)); 37 | } 38 | 39 | public AllFilter(List children) { 40 | super(children, children.size(), children.size()); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/AllowFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public class AllowFilter extends TransformFilter { 32 | 33 | public AllowFilter(Filter child) { 34 | super(child, FilterState.ALLOW, FilterState.ABSTAIN, FilterState.ABSTAIN); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/AnyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import com.google.common.collect.Lists; 29 | import in.twizmwaz.cardinal.module.filter.Filter; 30 | 31 | import java.util.List; 32 | 33 | public class AnyFilter extends RangeFilter { 34 | 35 | 36 | public AnyFilter(Filter... children) { 37 | this(Lists.newArrayList(children)); 38 | } 39 | 40 | public AnyFilter(List children) { 41 | super(children, 1, children.size()); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/DenyFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public class DenyFilter extends TransformFilter { 32 | 33 | public DenyFilter(Filter child) { 34 | super(child, FilterState.DENY, FilterState.ABSTAIN, FilterState.ABSTAIN); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/HasResultFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public class HasResultFilter extends TransformFilter { 32 | 33 | public HasResultFilter(Filter child) { 34 | super(child, FilterState.ALLOW, FilterState.DENY, FilterState.ALLOW); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/NotFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import in.twizmwaz.cardinal.module.filter.FilterState; 30 | 31 | public class NotFilter extends TransformFilter { 32 | 33 | public NotFilter(Filter child) { 34 | super(child, FilterState.DENY, FilterState.ABSTAIN, FilterState.ALLOW); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/filter/type/modifiers/OneFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.filter.type.modifiers; 27 | 28 | import com.google.common.collect.Lists; 29 | import in.twizmwaz.cardinal.module.filter.Filter; 30 | 31 | import java.util.List; 32 | 33 | public class OneFilter extends RangeFilter { 34 | 35 | public OneFilter(Filter... children) { 36 | this(Lists.newArrayList(children)); 37 | } 38 | 39 | public OneFilter(List children) { 40 | super(children, 1, 1); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/Kit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public interface Kit { 31 | 32 | void apply(Player player, boolean force); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/KitRemovable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit; 27 | 28 | import org.bukkit.entity.Player; 29 | 30 | public interface KitRemovable extends Kit { 31 | 32 | void remove(Player player); 33 | 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/listener/ShieldListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.listener; 27 | 28 | import com.google.common.collect.Maps; 29 | import in.twizmwaz.cardinal.module.kit.type.KitShield; 30 | import lombok.Getter; 31 | import org.bukkit.event.Listener; 32 | 33 | import java.util.Map; 34 | import java.util.UUID; 35 | 36 | //TODO: finish this 37 | public class ShieldListener implements Listener { 38 | 39 | @Getter 40 | private static final Map players = Maps.newHashMap(); 41 | @Getter 42 | private static final Map times = Maps.newHashMap(); 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitAttribute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.attribute.Attribute; 31 | import org.bukkit.attribute.AttributeModifier; 32 | import org.bukkit.entity.Player; 33 | 34 | import java.util.Set; 35 | 36 | @AllArgsConstructor 37 | public class KitAttribute implements KitRemovable { 38 | 39 | private final Set attributes; 40 | 41 | @Override 42 | public void apply(Player player, boolean force) { 43 | for (AttributeModifier modifier : attributes) { 44 | player.getAttribute(Attribute.byName(modifier.getName())).addModifier(modifier); 45 | } 46 | } 47 | 48 | @Override 49 | public void remove(Player player) { 50 | for (AttributeModifier modifier : attributes) { 51 | player.getAttribute(Attribute.byName(modifier.getName())).removeModifier(modifier); 52 | } 53 | } 54 | 55 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitFly.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.entity.Player; 31 | 32 | @AllArgsConstructor 33 | public class KitFly implements KitRemovable { 34 | 35 | private final boolean canFly; 36 | private final boolean flying; 37 | private final float flySpeed; 38 | 39 | @Override 40 | public void apply(Player player, boolean force) { 41 | player.setAllowFlight(canFly); 42 | player.setFlying(flying); 43 | player.setFlySpeed(flySpeed); 44 | } 45 | 46 | @Override 47 | public void remove(Player player) { 48 | player.setAllowFlight(false); 49 | player.setFlying(false); 50 | player.setFlySpeed(0.1f); 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitGameMode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.Kit; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.GameMode; 31 | import org.bukkit.entity.Player; 32 | 33 | @AllArgsConstructor 34 | public class KitGameMode implements Kit { 35 | 36 | private final GameMode gameMode; 37 | 38 | @Override 39 | public void apply(Player player, boolean force) { 40 | player.setGameMode(gameMode); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitHealth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.Kit; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.entity.Player; 31 | 32 | @AllArgsConstructor 33 | public class KitHealth implements Kit { 34 | 35 | private final int health; 36 | private final int hunger; 37 | private final float saturation; 38 | 39 | @Override 40 | public void apply(Player player, boolean force) { 41 | if (health != -1 && (force || health > player.getHealth())) { 42 | player.setHealth(health); 43 | } 44 | if (hunger != -1 && (force || hunger > player.getFoodLevel())) { 45 | player.setFoodLevel(hunger); 46 | } 47 | if (saturation != 0 && (force || saturation > player.getSaturation())) { 48 | player.setSaturation(saturation); 49 | } 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitKnockback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.entity.Player; 31 | 32 | @AllArgsConstructor 33 | public class KitKnockback implements KitRemovable { 34 | 35 | private final float knockback; 36 | 37 | @Override 38 | public void apply(Player player, boolean force) { 39 | player.setKnockbackReduction(knockback); 40 | } 41 | 42 | @Override 43 | public void remove(Player player) { 44 | player.setKnockbackReduction(0); 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitPotion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 29 | import org.bukkit.entity.Player; 30 | import org.bukkit.potion.PotionEffect; 31 | 32 | import java.util.List; 33 | 34 | public class KitPotion implements KitRemovable { 35 | 36 | private List effects; 37 | 38 | public KitPotion(List effects) { 39 | this.effects = effects; 40 | } 41 | 42 | @Override 43 | public void apply(Player player, boolean force) { 44 | effects.forEach(effect -> player.addPotionEffect(effect, force)); 45 | } 46 | 47 | @Override 48 | public void remove(Player player) { 49 | effects.forEach(effect -> player.removePotionEffect(effect.getType())); 50 | } 51 | 52 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitShield.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import com.google.common.collect.Maps; 29 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 30 | import lombok.AllArgsConstructor; 31 | import lombok.Data; 32 | import lombok.Getter; 33 | import org.bukkit.entity.Player; 34 | 35 | import java.util.Map; 36 | 37 | @AllArgsConstructor 38 | public class KitShield implements KitRemovable { 39 | 40 | @Getter 41 | private static final Map players = Maps.newHashMap(); 42 | 43 | private final ShieldData data; 44 | 45 | @Override 46 | public void apply(Player player, boolean force) { 47 | players.put(player, data); 48 | } 49 | 50 | @Override 51 | public void remove(Player player) { 52 | players.remove(player); 53 | } 54 | 55 | @Data 56 | public static class ShieldData { 57 | private final double health; 58 | private final double delay; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/kit/type/KitWalkSpeed.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.kit.type; 27 | 28 | import in.twizmwaz.cardinal.module.kit.KitRemovable; 29 | import lombok.AllArgsConstructor; 30 | import org.bukkit.entity.Player; 31 | 32 | @AllArgsConstructor 33 | public class KitWalkSpeed implements KitRemovable { 34 | 35 | private final float walkSpeed; 36 | 37 | @Override 38 | public void apply(Player player, boolean force) { 39 | player.setWalkSpeed(walkSpeed); 40 | } 41 | 42 | @Override 43 | public void remove(Player player) { 44 | player.setWalkSpeed(0.2f); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/objective/ObjectiveScoreboardHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.objective; 27 | 28 | public class ObjectiveScoreboardHandler { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/objective/OwnedObjective.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.objective; 27 | 28 | import ee.ellytr.chat.component.formattable.UnlocalizedComponent; 29 | import in.twizmwaz.cardinal.module.team.Team; 30 | 31 | public interface OwnedObjective { 32 | 33 | Team getOwner(); 34 | 35 | String getPrefix(Team viewer, Team attacker); 36 | 37 | UnlocalizedComponent getComponent(); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/objective/ProximityMetric.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.objective; 27 | 28 | public enum ProximityMetric { 29 | CLOSEST_PLAYER, 30 | CLOSEST_BLOCK, 31 | CLOSEST_KILL 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/objective/ProximityRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.objective; 27 | 28 | import lombok.Data; 29 | 30 | @Data 31 | public class ProximityRule { 32 | 33 | private final ProximityMetric metric; 34 | private final boolean horizontal; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/Region.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region; 27 | 28 | import in.twizmwaz.cardinal.module.filter.Filter; 29 | import org.bukkit.block.Block; 30 | import org.bukkit.util.Vector; 31 | 32 | import java.util.Collection; 33 | 34 | public interface Region extends Filter { 35 | 36 | boolean contains(Vector vector); 37 | 38 | boolean isRandomizable(); 39 | 40 | boolean isBounded(); 41 | 42 | RegionBounds getBounds(); 43 | 44 | Collection getBlocks(); 45 | 46 | Vector getRandomPoint(); 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/RegionException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region; 27 | 28 | public class RegionException extends Exception { 29 | 30 | public RegionException() { 31 | } 32 | 33 | public RegionException(String message) { 34 | super(message); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/RegionParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region; 27 | 28 | public interface RegionParser { 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/RegionAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception; 27 | 28 | import in.twizmwaz.cardinal.module.region.RegionException; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import org.jdom2.Element; 32 | 33 | @Getter 34 | @AllArgsConstructor 35 | public class RegionAttributeException extends RegionException { 36 | 37 | private final String attribute; 38 | private final Element element; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/RegionPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception; 27 | 28 | import in.twizmwaz.cardinal.module.region.RegionException; 29 | import lombok.AllArgsConstructor; 30 | import lombok.Getter; 31 | import org.jdom2.Element; 32 | 33 | @Getter 34 | @AllArgsConstructor 35 | public class RegionPropertyException extends RegionException { 36 | 37 | private final String property; 38 | private final Element element; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/attribute/InvalidRegionAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception.attribute; 27 | 28 | import in.twizmwaz.cardinal.module.region.exception.RegionAttributeException; 29 | import org.jdom2.Element; 30 | 31 | public class InvalidRegionAttributeException extends RegionAttributeException { 32 | 33 | public InvalidRegionAttributeException(String attribute, Element element) { 34 | super(attribute, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/attribute/MissingRegionAttributeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception.attribute; 27 | 28 | import in.twizmwaz.cardinal.module.region.exception.RegionAttributeException; 29 | import org.jdom2.Element; 30 | 31 | public class MissingRegionAttributeException extends RegionAttributeException { 32 | 33 | public MissingRegionAttributeException(String attribute, Element element) { 34 | super(attribute, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/property/InvalidRegionPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception.property; 27 | 28 | import in.twizmwaz.cardinal.module.region.exception.RegionPropertyException; 29 | import org.jdom2.Element; 30 | 31 | public class InvalidRegionPropertyException extends RegionPropertyException { 32 | 33 | public InvalidRegionPropertyException(String property, Element element) { 34 | super(property, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/exception/property/MissingRegionPropertyException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.exception.property; 27 | 28 | import in.twizmwaz.cardinal.module.region.exception.RegionPropertyException; 29 | import org.jdom2.Element; 30 | 31 | public class MissingRegionPropertyException extends RegionPropertyException { 32 | 33 | public MissingRegionPropertyException(String property, Element element) { 34 | super(property, element); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/region/type/RectangleRegion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.region.type; 27 | 28 | import in.twizmwaz.cardinal.match.Match; 29 | import in.twizmwaz.cardinal.module.region.parser.RectangleRegionParser; 30 | import org.bukkit.util.Cuboid; 31 | import org.bukkit.util.Vector; 32 | 33 | public class RectangleRegion extends CuboidRegion { 34 | 35 | /** 36 | * @param min The rectangle's minimum bound. 37 | * @param max The rectangle's maximum bound. 38 | */ 39 | public RectangleRegion(Match match, Vector min, Vector max) { 40 | super(match, Cuboid.between(min, max)); 41 | } 42 | 43 | public RectangleRegion(Match match, Cuboid cuboid) { 44 | this(match, cuboid.minimum(), cuboid.maximum()); 45 | } 46 | 47 | public RectangleRegion(Match match, RectangleRegionParser parser) { 48 | this(match, parser.getCuboid().minimum(), parser.getCuboid().maximum()); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/rotation/Rotation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.rotation; 27 | 28 | import in.twizmwaz.cardinal.module.repository.LoadedMap; 29 | import lombok.Getter; 30 | 31 | import java.util.List; 32 | import java.util.ListIterator; 33 | 34 | public class Rotation { 35 | 36 | @Getter 37 | private final List maps; 38 | private ListIterator iterator; 39 | 40 | Rotation(List maps) { 41 | this.maps = maps; 42 | this.iterator = maps.listIterator(); 43 | } 44 | 45 | /** 46 | * @return The next map, and increments the iterator. 47 | */ 48 | public LoadedMap getNext() { 49 | if (iterator.hasNext()) { 50 | return iterator.next(); 51 | } else { 52 | iterator = maps.listIterator(); 53 | return iterator.next(); 54 | } 55 | } 56 | 57 | /** 58 | * @return The position of the next map. 59 | */ 60 | public int getNextIndex() { 61 | return iterator.nextIndex(); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/Displayable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | /** 29 | * Represents an object that can be displayed on a scoreboard sidebar. 30 | * Both entries (single lines) or groups (multiple lines). 31 | */ 32 | public interface Displayable { 33 | 34 | /** 35 | * Gets the start score. 36 | * @return the biggest value this Displayable uses. 37 | */ 38 | int getScore(); 39 | 40 | /** 41 | * Sets the top score for the displayable. 42 | * @param score The top score it will use. 43 | */ 44 | void setScore(int score); 45 | 46 | /** 47 | * Gets the size of the displayable, helpful for displayables that are bigger than 1 line. 48 | * @return the size of the displayable. 49 | */ 50 | int getSize(); 51 | 52 | /** 53 | * Updates the displayable, groups will reorder and set scores, Entries will update the text they display. 54 | */ 55 | void update(); 56 | 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/EmptyScoreboardEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | 29 | import in.twizmwaz.cardinal.module.scoreboard.ScoreboardDisplay; 30 | 31 | public class EmptyScoreboardEntry extends ScoreboardEntry implements SortableEntry { 32 | 33 | public EmptyScoreboardEntry(ScoreboardDisplay display) { 34 | super(display, "", display.getEntry(" ", null)); 35 | } 36 | 37 | @Override 38 | public void setScore(int score) { 39 | if (score == -1) { 40 | hide(); 41 | } else { 42 | if (!isShown()) { 43 | show(); 44 | } 45 | super.setScore(score); 46 | } 47 | } 48 | 49 | @Override 50 | public int getSort() { 51 | return -10000; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/EntryHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | import com.google.common.collect.Lists; 29 | 30 | import java.util.List; 31 | 32 | public class EntryHolder { 33 | 34 | private final List entries = Lists.newArrayList(); 35 | 36 | public void addEntry(ScoreboardEntry entry) { 37 | entries.add(entry); 38 | } 39 | 40 | public void removeEntry(ScoreboardEntry entry) { 41 | entries.remove(entry); 42 | } 43 | 44 | public void updateEntries() { 45 | entries.forEach(ScoreboardEntry::update); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/EntryUpdater.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | public interface EntryUpdater { 29 | 30 | EntryHolder getEntryHolder(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/SortableEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | public interface SortableEntry { 29 | 30 | int getSort(); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/SortableScoreboardEntry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | import in.twizmwaz.cardinal.module.scoreboard.ScoreboardDisplay; 29 | import lombok.Getter; 30 | import lombok.Setter; 31 | 32 | /** 33 | * Sortable scoreboard entry, used for Score and Blitz. 34 | */ 35 | public class SortableScoreboardEntry extends ScoreboardEntry implements SortableEntry { 36 | 37 | @Setter 38 | @Getter 39 | private int sort = 0; 40 | 41 | SortableScoreboardEntry(ScoreboardDisplay display, String displayName, String entry) { 42 | super(display, displayName, entry); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/SortedScoreboardGroup.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | import java.util.stream.Collectors; 29 | 30 | /** 31 | * Will sort the entries before updating, all the entries must implement SortableEntry, or will be removed. 32 | * 33 | *

Used for Score and Blitz. 34 | */ 35 | public class SortedScoreboardGroup extends ScoreboardGroup { 36 | 37 | @Override 38 | public void setScore(int index) { 39 | setEntries(getEntries().stream() 40 | .filter(entry -> entry instanceof SortableEntry) 41 | .sorted((Displayable d1, Displayable d2) -> ((SortableEntry) d2).getSort() - ((SortableEntry) d1).getSort()) 42 | .collect(Collectors.toList())); 43 | super.setScore(index); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scoreboard/displayables/TeamName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scoreboard.displayables; 27 | 28 | import in.twizmwaz.cardinal.module.scoreboard.ScoreboardDisplay; 29 | import in.twizmwaz.cardinal.module.team.Team; 30 | 31 | public class TeamName extends ScoreboardEntry { 32 | 33 | Team team; 34 | 35 | public TeamName(ScoreboardDisplay display, Team team) { 36 | super(display, team.getColor() + team.getName(), display.getEntry(team.getColor() + "", team.getColor() + "")); 37 | this.team = team; 38 | } 39 | 40 | //TODO: listen to team name changes 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/scores/ScoreRule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.scores; 27 | 28 | import lombok.AllArgsConstructor; 29 | import lombok.Data; 30 | 31 | @Data 32 | @AllArgsConstructor 33 | public class ScoreRule { 34 | 35 | private final boolean scoring; 36 | private final int limit; 37 | private final int kills; 38 | private final int deaths; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/module/team/NameTagVisibility.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.team; 27 | 28 | public enum NameTagVisibility { 29 | 30 | TRUE, 31 | FALSE, 32 | ALLIES, 33 | ENEMIES 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/playercontainer/CompetitorContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.playercontainer; 27 | 28 | import net.md_5.bungee.api.ChatColor; 29 | 30 | public interface CompetitorContainer extends PlayerContainer { 31 | 32 | String getName(); 33 | 34 | ChatColor getColor(); 35 | 36 | String getCompleteName(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/playercontainer/PlayerContainer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.playercontainer; 27 | 28 | import com.google.common.collect.ImmutableCollection; 29 | import org.bukkit.entity.Player; 30 | 31 | /** 32 | * Represents a class that stores a collection of players. 33 | */ 34 | public interface PlayerContainer extends Iterable { 35 | 36 | ImmutableCollection getPlayers(); 37 | 38 | boolean hasPlayer(Player player); 39 | 40 | void addPlayer(Player player); 41 | 42 | void removePlayer(Player player); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/util/ArmorType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | public enum ArmorType { 29 | 30 | HELMET(), 31 | CHESTPLATE(), 32 | LEGGINGS(), 33 | BOOTS(); 34 | 35 | } -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/util/Characters.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | public enum Characters { 29 | 30 | CORE_COMPLETED('\u2714'), 31 | CORE_INCOMPLETE('\u2715'), 32 | CORE_TOUCHED('\u2733'), 33 | 34 | WOOL_COMPLETED('\u2B1B'), 35 | WOOL_INCOMPLETE('\u2B1C'), 36 | WOOL_TOUCHED('\u2592'), 37 | 38 | WARNING('\u26A0'); 39 | 40 | private final char c; 41 | 42 | Characters(char c) { 43 | this.c = c; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return c + ""; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/util/ListUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | import lombok.NonNull; 29 | 30 | import java.util.List; 31 | import java.util.Random; 32 | 33 | //fixme: I don't like this name. Google took Lists already. 34 | public class ListUtil { 35 | 36 | /** 37 | * Returns a random object from a given list. An empty list will return null. 38 | * 39 | * @param list The lists to return a random object from. 40 | * @param The list type. 41 | * @return A random value from the list, if it exists. 42 | */ 43 | public static T getRandom(@NonNull Random random, @NonNull List list) { 44 | if (list.size() > 0) { 45 | return list.get(random.nextInt(list.size())); 46 | } else { 47 | throw new IllegalArgumentException("Cannot get random entry from an empty list."); 48 | } 49 | } 50 | 51 | public static T getRandom(@NonNull List list) { 52 | return getRandom(new Random(), list); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/in/twizmwaz/cardinal/util/Taskable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | import org.bukkit.event.Cancellable; 29 | 30 | public interface Taskable extends Cancellable, Runnable { 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | mapRepository: repo 2 | displayMapLoadErrors: false -------------------------------------------------------------------------------- /src/main/resources/lang/cardinal/en_US.properties: -------------------------------------------------------------------------------- 1 | cycle.countdown = Cycling to {0} in {1} 2 | cycle.cycled = Cycled to {0} 3 | cycle.set.map = Next map set to {0} 4 | 5 | command.error.match.map = No maps matched query. 6 | 7 | match.start.countdown = Match starting in {0} seconds 8 | match.start.started = The match has started! 9 | 10 | objective.core.completed = {0}'s {1} has leaked 11 | objective.core.touched = {0}'s {1} damaged by {2} 12 | objective.core.touched.self = You damaged {0}'s {1} 13 | objective.core.error.own = You may not damage your own core. 14 | 15 | objective.destroyable.completed = {0}'s {1} was destroyed by {2} 16 | objective.destroyable.touched = {0}'s {1} damaged by {2} 17 | objective.destroyable.touched.self = You damaged {0}'s {1} 18 | objective.destroyable.error.own = You may not damage your own monument. 19 | 20 | objective.wool.completed = {0} placed {1} for {2} 21 | objective.wool.touched = {0} picked up {1} for {2} 22 | objective.wool.touched.self = You picked up {0} for {1} 23 | 24 | objective.wool.error.team = Only a member of {0} may place {1} here! 25 | objective.wool.error.block = Only {0} may be placed here! 26 | objective.wool.error.break = You may not break {0}! 27 | 28 | objective.touched.credit = You will receive credit when this objective is completed. 29 | 30 | region.max.build = You have reached the maximum build height ({0} blocks) 31 | 32 | team.hover.join = Click to join {0} 33 | team.join = You joined {0} 34 | 35 | time.seconds = {0} seconds 36 | time.second = {0} second 37 | 38 | command.next.map = Next map: {0} 39 | -------------------------------------------------------------------------------- /src/main/resources/plugin.yml: -------------------------------------------------------------------------------- 1 | name: @name@ 2 | description: @description@ 3 | main: @mainClass@ 4 | version: @version@ 5 | authors: [twiz_mwazin] 6 | prefix: Cardinal -------------------------------------------------------------------------------- /src/test/java/in/twizmwaz/cardinal/module/dependency/DependencyGraphTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.module.dependency; 27 | 28 | import org.junit.Test; 29 | 30 | public class DependencyGraphTest { 31 | 32 | @Test 33 | public void testGraph() { 34 | DependencyGraph graph = new DependencyGraph<>(); 35 | graph.addDependency("b", "a"); 36 | graph.addDependency("c", "b"); 37 | //Assert.assertTrue(graph.evaluateDependencies().equals(Lists.newArrayList("a", "b", "c"))); 38 | } 39 | 40 | @Test(expected = IllegalStateException.class) 41 | public void testCircular() { 42 | DependencyGraph graph = new DependencyGraph<>(); 43 | graph.addDependency("b", "a"); 44 | graph.addDependency("c", "b"); 45 | graph.addDependency("a", "c"); 46 | } 47 | 48 | } -------------------------------------------------------------------------------- /src/test/java/in/twizmwaz/cardinal/util/GamemodeTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | import org.junit.Assert; 29 | import org.junit.Test; 30 | 31 | public class GamemodeTest { 32 | 33 | @Test 34 | public void testId() { 35 | Assert.assertEquals(Gamemode.byId(null), null); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /src/test/java/in/twizmwaz/cardinal/util/ProtoTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016, Kevin Phoenix 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions are met: 7 | * 8 | * 1. Redistributions of source code must retain the above copyright notice, this 9 | * list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright notice, 11 | * this list of conditions and the following disclaimer in the documentation 12 | * and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 18 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 20 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 | */ 25 | 26 | package in.twizmwaz.cardinal.util; 27 | 28 | import org.junit.Assert; 29 | import org.junit.Test; 30 | 31 | public class ProtoTest { 32 | 33 | @Test 34 | public void testCorrectParse() { 35 | Proto proto = Proto.parseProto("1.2.3"); 36 | Assert.assertEquals(proto, new Proto(1, 2, 3)); 37 | } 38 | 39 | @Test(expected = NumberFormatException.class) 40 | public void testIncorrectParse() { 41 | Proto.parseProto("1"); 42 | } 43 | 44 | } 45 | --------------------------------------------------------------------------------