-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.1.0 #163
base: master
Are you sure you want to change the base?
1.1.0 #163
Changes from all commits
6bb469e
a19b20d
df5b846
62cb28c
9159354
5cc178e
88d5bc7
ad8654d
028570b
f6694fc
e2be585
8f30d9f
bac278e
fecaf37
99dd8ce
ae1c778
0c45af6
fbd27f6
1902e5d
dad0698
925c905
d282cdb
7c3582d
5025fd5
86c52e8
b6aabd8
12babe2
e573c0b
b8a1218
358bdb5
fb29f3b
387283a
69ad488
03d2152
8e8b3dd
a814993
47eec7b
4a9abfb
ee290a2
9d287cc
b7038c5
94f151d
6a1540a
5f15611
d1cee72
a130c78
7ab5a8a
361bee4
197fee6
03929ef
730e2fc
f695012
cf3637f
90997ae
83a5efb
03d447e
c1fd7d4
42bd874
081f380
9a698f6
7417546
61a2752
70960f6
7821aa7
db49328
2c5c9b5
c058d0d
cf93eea
a2cadc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.able | ||
|
||
import de.astride.planetsystem.api.planet.LoadedPlanet | ||
|
||
/** | ||
* Created on 20.06.2019 20:58. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
interface LoadedPlanetable : Planetable { | ||
override val planet: LoadedPlanet | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.able | ||
|
||
import de.astride.planetsystem.api.database.OfflinePlanet | ||
|
||
/** | ||
* Created on 20.06.2019 20:58. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
interface Planetable { | ||
val planet: OfflinePlanet | ||
} |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.database | ||
|
||
import de.astride.planetsystem.api.atmosphere.Atmosphere | ||
import de.astride.planetsystem.api.location.PlanetLocation | ||
import de.astride.planetsystem.api.proxies.Owner | ||
import de.astride.planetsystem.api.proxies.UniqueID | ||
|
||
interface OfflinePlanet { | ||
|
||
val uniqueID: UniqueID | ||
val owner: Owner | ||
val name: String | ||
|
||
val members: MutableSet<Owner> | ||
val banned: MutableSet<Owner> | ||
|
||
var spawnLocation: PlanetLocation | ||
var atmosphere: Atmosphere | ||
|
||
val metaData: Map<String, Any> | ||
var locked: Boolean | ||
|
||
} | ||
|
||
val OfflinePlanet.allMembers get() = members + owner |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.database | ||
|
||
import de.astride.planetsystem.api.proxies.Owner | ||
import de.astride.planetsystem.api.proxies.UniqueID | ||
|
||
interface OfflinePlayer { | ||
|
||
val owner: Owner | ||
val planetUniqueId: UniqueID | ||
val history: Set<UniqueID> | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.events | ||
|
||
import org.bukkit.event.Cancellable | ||
|
||
/** | ||
* Created on 20.06.2019 21:02. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
interface KCancellable : Cancellable { | ||
|
||
var cancel: Boolean | ||
|
||
override fun isCancelled(): Boolean = cancel | ||
|
||
override fun setCancelled(value: Boolean) { | ||
cancel = value | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.events | ||
|
||
import de.astride.planetsystem.api.able.LoadedPlanetable | ||
import de.astride.planetsystem.api.planet.LoadedPlanet | ||
import org.bukkit.entity.Player | ||
import org.bukkit.event.HandlerList | ||
import org.bukkit.event.player.PlayerEvent | ||
|
||
/** | ||
* Created on 20.06.2019 20:57. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
class PlayerEnterPlanetEvent( | ||
who: Player, | ||
override val planet: LoadedPlanet | ||
) : PlayerEvent(who), LoadedPlanetable, KCancellable { | ||
|
||
/** | ||
* if is `true` tries to cancel the action | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
override var cancel: Boolean = false | ||
|
||
override fun getHandlers(): HandlerList = handlerList | ||
|
||
companion object { | ||
@JvmStatic //Important for Bukkit due to the Java ByteCode | ||
val handlerList: HandlerList = HandlerList() | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.events | ||
|
||
import de.astride.planetsystem.api.able.LoadedPlanetable | ||
import de.astride.planetsystem.api.planet.LoadedPlanet | ||
import org.bukkit.entity.Player | ||
import org.bukkit.event.HandlerList | ||
import org.bukkit.event.player.PlayerEvent | ||
|
||
/** | ||
* Created on 20.06.2019 20:57. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
class PlayerLeavePlanetEvent( | ||
who: Player, | ||
override val planet: LoadedPlanet | ||
) : PlayerEvent(who), LoadedPlanetable, KCancellable { | ||
|
||
/** | ||
* if is `true` tries to cancel the action | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
override var cancel: Boolean = false | ||
|
||
override fun getHandlers(): HandlerList = handlerList | ||
|
||
companion object { | ||
@JvmStatic //Important for Bukkit due to the Java ByteCode | ||
val handlerList: HandlerList = HandlerList() | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.functions | ||
|
||
/* | ||
* Created on 20.06.2019 01:01. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
|
||
typealias BukkitLocation = org.bukkit.Location | ||
typealias BukkitWorld = org.bukkit.World | ||
typealias BukkitVector = org.bukkit.util.Vector | ||
|
||
typealias WEWorld = com.sk89q.worldedit.world.World | ||
typealias WEVector = com.sk89q.worldedit.Vector |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.functions | ||
|
||
import de.astride.planetsystem.api.holder.loadedPlanets | ||
import de.astride.planetsystem.api.holder.players | ||
import de.astride.planetsystem.api.location.Region | ||
import de.astride.planetsystem.api.location.isInside | ||
import de.astride.planetsystem.api.location.relativeTo | ||
import de.astride.planetsystem.api.planet.LoadedPlanet | ||
import de.astride.planetsystem.api.proxies.gameWorld | ||
import org.bukkit.Location | ||
import org.bukkit.World | ||
import org.bukkit.entity.Entity | ||
|
||
/** | ||
* @author Lars Artmann | LartyHD | ||
* Created by Lars Artmann | LartyHD on 18.03.2019 02:30. | ||
* Current Version: 1.0 (18.03.2019 - 18.03.2019) | ||
*/ | ||
fun saveAll() { | ||
loadedPlanets.forEach { it.save() } | ||
players.forEach { it.save() } | ||
} | ||
|
||
fun Entity.isNotInGameWorld() = world.isNotGameWorld() | ||
fun World.isNotGameWorld() = this != gameWorld | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. #isGameWorld would be better, wouldn't it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need isGameWorld in the src anywhere |
||
|
||
val Location.innerPlanet get() = planet { it.inner } | ||
val Location.outerPlanet get() = planet { it.outer } | ||
|
||
private fun Location.planet(region: (LoadedPlanet) -> Region) = loadedPlanets.find { | ||
val middle = it.middle | ||
if (world == middle.world) region(it).isInside(relativeTo(middle).toVector()) else false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.functions | ||
|
||
import com.boydti.fawe.FaweAPI | ||
import com.sk89q.worldedit.Vector | ||
import de.astride.planetsystem.api.location.PlanetLocation | ||
import de.astride.planetsystem.api.location.toBukkitLocation | ||
import de.astride.planetsystem.api.planet.LoadedPlanet | ||
import org.bukkit.Location | ||
import org.bukkit.World | ||
import org.bukkit.util.Vector | ||
|
||
/* | ||
* Created on 15.02.2019 03:19. | ||
* @author Lars Artmann | LartyHD | ||
* Created by Lars Artmann | LartyHD on 15.02.2019 03:19. | ||
* Current Version: 1.0 (15.02.2019 - 15.02.2019) | ||
*/ | ||
|
||
fun Number.toBukkitVector(): BukkitVector = toDouble().run { BukkitVector(this, this, this) } | ||
fun BukkitVector.toWEVector(): WEVector = WEVector(x, y, z) | ||
|
||
fun BukkitLocation.toWEVector(): WEVector = WEVector(x, y, z) | ||
fun PlanetLocation.toWEVector(planet: LoadedPlanet): WEVector = toBukkitLocation(planet).toWEVector() | ||
|
||
fun org.bukkit.util.Vector.toWEVector(): Vector = Vector(x, y, z) | ||
fun Location.toWEVector(): Vector = Vector(x, y, z) | ||
fun PlanetLocation.toWEVector(): Vector? = toBukkitLocation()?.toWEVector() | ||
fun PlanetLocation.toWEVector(planet: LoadedPlanet): Vector = toBukkitLocation(planet).toWEVector() | ||
fun BukkitWorld.toWEWorld(): WEWorld = FaweAPI.getWorld(name) | ||
fun BukkitLocation.toWEWorld(): WEWorld = world.toWEWorld() | ||
|
||
fun World.toWEWorld() = FaweAPI.getWorld(name) | ||
fun Location.toWEWorld() = world.toWEWorld() | ||
fun BukkitVector.generateMinAndMax(): Pair<Vector, Vector> = clone().multiply(-1) to clone() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019. | ||
*/ | ||
|
||
package de.astride.planetsystem.api.functions.extensions | ||
|
||
import de.astride.planetsystem.api.proxies.Owner | ||
import org.bukkit.entity.Player | ||
|
||
/* | ||
* Created on 21.06.2019 15:43. | ||
* @author Lars Artmann | LartyHD | ||
*/ | ||
val Player.owner get() = Owner(uniqueId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#isInGameWorld would be better, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need isGameWorld in the src anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure but why using directly using a negative boolean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So i don't need to ride
!
for each function callThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Larger names for no reason.
It makes sense for having those positive because there is an operator check if negative "!" but no one if it's positive.
So the base value of a boolean returning method should be always of positive value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, i can add a unused positive function, should i?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah sure cause "empty" is a negativ statment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isEmpty also exits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should discuss about that 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Than call me :D