Skip to content
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

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open

1.1.0 #163

Show file tree
Hide file tree
Changes from 64 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
6bb469e
Fixed gradle and some imports
Jun 10, 2019
a19b20d
Fixed lombok & a NullPointerException
Jun 10, 2019
df5b846
Fix a bug in the command style
Jun 10, 2019
62cb28c
Fixed planet home rounding
Jun 10, 2019
9159354
Start size of TopCommand by 1
Jun 10, 2019
5cc178e
Fixed a restart command message
Jun 10, 2019
88d5bc7
Added inventory clearing on restart command
Jun 18, 2019
ad8654d
Fixed maxSize bug
Jun 18, 2019
028570b
Added [only-players] to list command
Jun 18, 2019
f6694fc
Added data methods to BaseRegion
Jun 18, 2019
e2be585
Fixed outer region cleaning
Jun 18, 2019
8f30d9f
Removed lombok
Jun 19, 2019
bac278e
Added lombok for Java classes
Jun 19, 2019
fecaf37
Improved code and Planet Visit #11
Jun 19, 2019
99dd8ce
Changed default atmosphere type to Cuboid
Jun 19, 2019
ae1c778
Added event canceling to RestartCommandListener
Jun 19, 2019
0c45af6
Fixed canBuild &
Jun 19, 2019
fbd27f6
Deleted debug messages in canBuild
Jun 19, 2019
1902e5d
Deleted debug messages in setCuboid
Jun 19, 2019
dad0698
Deleted debug messages in BaseLoadedPlanet.<init>
Jun 19, 2019
925c905
Fixed planet visit command #11
Jun 19, 2019
d282cdb
Fixed a KDoc in Atmosphere
Jun 19, 2019
7c3582d
Changed name of PlanetCommandListener to PlanetExpandCommandListener
Jun 19, 2019
5025fd5
Changed name of RestartCommand to DeleteCommand and added [<Player>]
Jun 19, 2019
86c52e8
Change all to proxy implementation
Jun 19, 2019
b6aabd8
Updated to Kotlin 1.3.40
Jun 19, 2019
12babe2
Fixed planet delete command
Jun 19, 2019
e573c0b
Reverse visit functions order
Jun 19, 2019
b8a1218
Change /planet expand ... to /planet atmosphere ... #139
Jun 19, 2019
358bdb5
Improved code style
Jun 20, 2019
fb29f3b
Fixed a StackOverflowException in VisitCommand teleport(LoadedPlanet)
Jun 20, 2019
387283a
Changed isInside request to outer region
Jun 20, 2019
69ad488
Added /Planet kick <Player> #143
Jun 20, 2019
03d2152
Added Planet Lock command #50
Jun 20, 2019
8e8b3dd
Spited Location.planet to Location.innerPlanet and Location.outerPlanet
Jun 20, 2019
a814993
Place Atmosphere after saving
Jun 20, 2019
47eec7b
Rename canBuild to canEdit
Jun 20, 2019
4a9abfb
Block ArmorStand manipulation #20
Jun 20, 2019
ee290a2
Added water and lava flow out of the inner region block #97
Jun 20, 2019
9d287cc
Fixed a morphia bug in BasicDatabasePlayer
Jun 20, 2019
b7038c5
Switched implication form planed owner base to player entry based
Jun 20, 2019
94f151d
Added lava and water flows from outer region block
Jun 20, 2019
6a1540a
Fixed PlayerBucketEmptyEvent & PlayerBucketFillEvent block
Jun 20, 2019
5f15611
Added Blocks piston extension in outer region #123
Jun 20, 2019
d1cee72
Added "is planet already loaded" check on planet.load() #190
Jun 20, 2019
a130c78
Fix lava and water flowing inside inner region #191
Jun 20, 2019
7ab5a8a
Added GOLD_PLATE, IRON_PLATE, REDSTONE_COMPARATOR_OFF, REDSTONE_COMPA…
Jun 20, 2019
361bee4
Added DAYLIGHT_DETECTOR and DAYLIGHT_DETECTOR_INVERTED to protected b…
Jun 20, 2019
197fee6
Added MONSTER_EGG, ITEM_FRAME, ARMOR_STAND and PAINTING to blocked in…
Jun 20, 2019
03929ef
Improved code style in blocked interaction types
Jun 20, 2019
730e2fc
Fixed a bug with blocked interaction items and blocks #184
Jun 20, 2019
f695012
Changed the EventPriority of PlayerBucketFillEvent back to NORMAL
Jun 20, 2019
cf3637f
Added DatabasePlanet.allMembers
Jun 20, 2019
90997ae
Added ItemFrames and Painting destroy block for not member and
Jun 20, 2019
83a5efb
Block launch Projectile by not member #185
Jun 20, 2019
03d447e
Add planet enter and leave event #76
Jun 20, 2019
c1fd7d4
Moved PlanetAtmosphereCommandListener and PlanetDeleteCommandListener…
Jun 20, 2019
42bd874
Unload visited planet after leaving #180
Jun 20, 2019
081f380
Fixed a StackOverFlowException in PlayerLeavePlanetEventImplementatio…
Jun 20, 2019
9a698f6
Changed Restart config to lazy implementation
Jun 20, 2019
7417546
Fixed PlayerEnterPlanetEventImplementationListener on(PlayerTeleportE…
Jun 20, 2019
61a2752
Disable PlanetDeleteCommandListener (owning to a ClassNotFoundException)
Jun 21, 2019
70960f6
Added Planet Ban and UnBan #142
Jun 21, 2019
7821aa7
Added player planet history #174
Jun 21, 2019
db49328
Immigrate from DMN to Google Cloud Storage
Aug 28, 2019
2c5c9b5
Added return after COMMANDS_VISIT_NOT_EXISTS message (fixed sending o…
Aug 28, 2019
c058d0d
Fixed planet unloading recursive bug and 0 bytes schematic saving
Aug 28, 2019
cf93eea
Deleted DataPlanet because it is not used
Aug 30, 2019
a2cadc7
Added exception handling for planet loading
Aug 30, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
15 changes: 15 additions & 0 deletions api/src/main/kotlin/de/astride/planetsystem/api/able/Planetable.kt
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
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Atmosphere {
/**
* [size] is the radius
* Change size
* and if loaded inner region and [atmosphere]
* and if loaded inner region and [Atmosphere]
*/
val size: Byte
/**
Expand Down

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()
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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?

Copy link
Member Author

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 call

Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isEmpty also exits

Copy link
Member

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 😂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Than call me :D

fun World.isNotGameWorld() = this != gameWorld
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#isGameWorld would be better, wouldn't it?

Copy link
Member Author

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


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)
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
/*
* © Copyright - Astride UG (haftungsbeschränkt) 2018 - 2019.
*/

package de.astride.planetsystem.api.handler

import de.astride.planetsystem.api.database.DatabasePlanet
import de.astride.planetsystem.api.database.DatabasePlayer
import de.astride.planetsystem.api.inline.Owner
import de.astride.planetsystem.api.inline.UniqueID
import de.astride.planetsystem.api.database.OfflinePlanet
import de.astride.planetsystem.api.database.OfflinePlayer
import de.astride.planetsystem.api.proxies.Owner
import de.astride.planetsystem.api.proxies.UniqueID

interface DatabaseHandler {

val allPlanets: Set<DatabasePlanet>
val allPlayers: Set<OfflinePlayer>
val allPlanets: Set<OfflinePlanet>

fun findPlayer(owner: Owner): OfflinePlayer?
fun findPlanet(planet: UniqueID): OfflinePlanet?

fun findPlayerOrCreate(owner: Owner, planet: UniqueID): OfflinePlayer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#findOrCreatePlayer() would be correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das habe ich aufgrund von "findPlayer" gemacht (wegen den Vorschlägen)

fun findPlanetOrCreate(planet: UniqueID, owner: Owner): OfflinePlanet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#findOrCreatePlanet() would be correct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das habe ich aufgrund von "findPlanet" gemacht (wegen den Vorschlägen)


fun savePlayer(databasePlayer: OfflinePlayer)
fun savePlanet(databasePlanet: OfflinePlanet)

fun getDatabasePlayer(planet: UniqueID, owner: Owner): DatabasePlayer
fun getDatabasePlanet(planet: UniqueID, owner: Owner): DatabasePlanet
// fun deletePlayer(databasePlayer: OfflinePlayer)
// fun deletePlanet(loadedPlanet: OfflinePlanet)

fun savePlayer(databasePlayer: DatabasePlayer)
fun savePlanet(databasePlanet: DatabasePlanet)
fun deletePlanet(databasePlayer: OfflinePlayer)

fun deletePlanet(databasePlanet: DatabasePlanet)
}
Loading