Skip to content

Commit

Permalink
#486 Moved events to simplified structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shynixn committed Jan 25, 2024
1 parent 0766557 commit 4dd9351
Show file tree
Hide file tree
Showing 42 changed files with 95 additions and 388 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,5 @@
package com.github.shynixn.blockball.api.business.enumeration

/**
* Placeholder being used in BlockBall.
* <p>
* Version 1.2
* <p>
* MIT License
* <p>
* Copyright (c) 2018 by Shynixn
* <p>
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* <p>
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* <p>
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
enum class PlaceHolder(
/**
* Placeholder value.
Expand Down

This file was deleted.

5 changes: 0 additions & 5 deletions blockball-bukkit-api/build.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class BlockBallDependencyInjectionBinder(
// Services
bind(PacketService::class.java).toInstance(packetService)
bind(EntityService::class.java).toInstance(EntityServiceImpl())
bind(EventService::class.java).to(EventServiceImpl::class.java).`in`(Scopes.SINGLETON)
bind(TemplateService::class.java).to(TemplateServiceImpl::class.java).`in`(Scopes.SINGLETON)
bind(VirtualArenaService::class.java).to(VirtualArenaServiceImpl::class.java).`in`(Scopes.SINGLETON)
bind(ScoreboardService::class.java).to(ScoreboardServiceImpl::class.java).`in`(Scopes.SINGLETON)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.bukkit.entity.Player
Expand All @@ -7,8 +7,8 @@ import org.bukkit.util.Vector
/**
* Event which gets called when the ball is kicked.
*/
class BallKickEvent(
class BallLeftClickEvent(
ball: BallProxy,
player: Player,
velocity: Vector
) : BallTouchEvent(ball, player, velocity)
) : BallTouchPlayerEvent(ball, player, velocity)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.enumeration.BlockDirection
import com.github.shynixn.blockball.api.business.proxy.BallProxy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy

/**
* Event which gets sent when the ball is requested to get removed.
*/
class BallDeathEvent(ball: BallProxy) : BallEvent(ball)
class BallRemoveEvent(ball: BallProxy) : BallEvent(ball)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.bukkit.entity.Player
Expand All @@ -7,8 +7,8 @@ import org.bukkit.util.Vector
/**
* Event which gets called when the ball is passed.
*/
class BallPassEvent(
class BallRightClickEvent(
ball: BallProxy,
player: Player,
velocity: Vector
) : BallTouchEvent(ball, player, velocity)
) : BallTouchPlayerEvent(ball, player, velocity)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.bukkit.Location
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.bukkit.entity.Player
Expand All @@ -8,7 +8,7 @@ import org.bukkit.util.Vector
/**
* Event which gets called when the ball is touched.
*/
open class BallTouchEvent(
open class BallTouchPlayerEvent(
ball: BallProxy,
/**
* Interacting player.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import org.bukkit.event.Cancellable
import org.bukkit.event.Event
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.enumeration.Team
import com.github.shynixn.blockball.api.persistence.entity.Game
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.persistence.entity.Game

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.business.enumeration.Team
import com.github.shynixn.blockball.api.persistence.entity.Game
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.persistence.entity.Game
import org.bukkit.entity.Player
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.shynixn.blockball.api.bukkit.event
package com.github.shynixn.blockball.event

import com.github.shynixn.blockball.api.persistence.entity.Game
import org.bukkit.entity.Player
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ package com.github.shynixn.blockball.impl

import com.github.shynixn.blockball.api.business.service.ProxyService
import com.github.shynixn.blockball.api.persistence.entity.Position
import org.bukkit.entity.Player

class AllPlayerTracker(
private val locationFunction: () -> Position,
private val newPlayerFunction: (Any) -> Unit,
private val oldPlayerFunction: (Any) -> Unit,
private val filterPlayerFunction: (Any) -> Boolean = { true }
private val newPlayerFunction: (Player) -> Unit,
private val oldPlayerFunction: (Player) -> Unit,
private val filterPlayerFunction: (Player) -> Boolean = { true }
) {
private val cache = HashSet<Any>()
private val cache = HashSet<Player>()
lateinit var proxyService: ProxyService

/**
* Checks the players inthe world and returns the interesing ones.
* Checks the players in the world and returns the interesting ones.
*/
fun checkAndGet(): List<Any> {
val players = proxyService.getPlayersInWorld<Any, Any>(locationFunction.invoke()).toMutableList()
fun checkAndGet(): List<Player> {
val players = proxyService.getPlayersInWorld<Player, Any>(locationFunction.invoke()).toMutableList()

for (player in players.toTypedArray()) {
if (!filterPlayerFunction.invoke(player)) {
Expand Down
Loading

0 comments on commit 4dd9351

Please sign in to comment.