Skip to content

Commit

Permalink
Merge pull request #258 from Shynixn/development
Browse files Browse the repository at this point in the history
Merge changes to master. --release
  • Loading branch information
Shynixn authored Jan 29, 2020
2 parents 3354579 + e22d6f1 commit 71d91c3
Show file tree
Hide file tree
Showing 38 changed files with 1,651 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ before_install:
- git config --global user.email "[email protected]" && git config --global user.name "Travis CI"
- if [[ $TRAVIS_COMMIT_MESSAGE == *"--snapshot"* || $TRAVIS_COMMIT_MESSAGE == *"--release"* ]]; then gpg2 --batch --cipher-algo AES256 --passphrase $SIGNING_KEYPASSWORD travis_secret_key.gpg; fi ;
install:
- ./gradlew assemble || ./gradlew downloadDependencies
- ./gradlew assemble || ./gradlew setupDecompWorkspace && ./gradlew assemble || ./gradlew downloadDependencies
script:
- ./gradlew clean build
- if [[ $TRAVIS_COMMIT_MESSAGE == *"--snapshot"* ]]; then ./gradlew publish > /dev/null; fi ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,23 @@ enum class Version(
VERSION_UNKNOWN("", "", 0.0),

/**
* Version 1.8.0-1.8.2.
* Version 1.8.0 - 1.8.2.
*/
VERSION_1_8_R1("v1_8_R1", "1.8.0", 1.081),
VERSION_1_8_R1("v1_8_R1", "1.8.2", 1.081),
/**
* Version 1.8.3-1.8.4.
* Version 1.8.3 - 1.8.4.
*/
VERSION_1_8_R2("v1_8_R2", "1.8.3", 1.082),
/**
* Version 1.8.5-1.8.9.
* Version 1.8.5 - 1.8.9.
*/
VERSION_1_8_R3("v1_8_R3", "1.8.8", 1.083),
VERSION_1_8_R3("v1_8_R3", "1.8.9", 1.083),
/**
* Version 1.9.0-1.9.1.
* Version 1.9.0 - 1.9.1.
*/
VERSION_1_9_R1("v1_9_R1", "1.9.0", 1.091),
VERSION_1_9_R1("v1_9_R1", "1.9.1", 1.091),
/**
* Version 1.9.2-1.9.4
* Version 1.9.2 - 1.9.4
*/
VERSION_1_9_R2("v1_9_R2", "1.9.4", 1.092),
/**
Expand All @@ -87,17 +87,17 @@ enum class Version(
/**
* Version 1.13.1 - 1.13.2.
*/
VERSION_1_13_R2("v1_13_R2", "1.13.1", 1.131),
VERSION_1_13_R2("v1_13_R2", "1.13.2", 1.131),

/**
* Version 1.14.0 - 1.14.4.
*/
VERSION_1_14_R1("v1_14_R1", "1.14.4", 1.144),

/**
* Version 1.15.0 - 1.15.0.
* Version 1.15.0 - 1.15.2.
*/
VERSION_1_15_R1("v1_15_R1", "1.15.0", 1.150);
VERSION_1_15_R1("v1_15_R1", "1.15.2", 1.150);

/**
* Gets if this version is same or greater than the given version by parameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import org.bukkit.configuration.MemorySection
import org.bukkit.plugin.java.JavaPlugin
import java.io.File
import java.io.FileOutputStream
import java.nio.file.Files
import java.nio.file.Paths
import java.util.logging.Level

/**
Expand Down Expand Up @@ -113,6 +115,19 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy {
return
}

if (isArmorStandTickingDisabled()) {
sendConsoleMessage(ChatColor.RED.toString() + "================================================")
sendConsoleMessage(ChatColor.RED.toString() + "BlockBall does only work with armor-stands-tick: true")
sendConsoleMessage(ChatColor.RED.toString() + "Please enable it in your paper.yml file!")
sendConsoleMessage(ChatColor.GRAY.toString() + "You can disable this security check on your own risk by")
sendConsoleMessage(ChatColor.GRAY.toString() + "setting ignore-ticking-settings: true in the config.yml of BlockBall.")
sendConsoleMessage(ChatColor.RED.toString() + "Plugin gets now disabled!")
sendConsoleMessage(ChatColor.RED.toString() + "================================================")

Bukkit.getPluginManager().disablePlugin(this)
return
}

this.injector = Guice.createInjector(BlockBallDependencyInjectionBinder(this))
this.reloadConfig()

Expand Down Expand Up @@ -147,7 +162,10 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy {
val commandService = resolve(CommandService::class.java)
commandService.registerCommandExecutor("blockballstop", resolve(StopCommandExecutor::class.java))
commandService.registerCommandExecutor("blockballreload", resolve(ReloadCommandExecutor::class.java))
commandService.registerCommandExecutor("blockballbungeecord", resolve(BungeeCordSignCommandExecutor::class.java))
commandService.registerCommandExecutor(
"blockballbungeecord",
resolve(BungeeCordSignCommandExecutor::class.java)
)
commandService.registerCommandExecutor("blockball", resolve(ArenaCommandExecutor::class.java))
commandService.registerCommandExecutor(
(config.get("global-spectate") as MemorySection).getValues(false) as Map<String, String>,
Expand All @@ -168,7 +186,8 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy {

if (enableBungeeCord) {
bungeeCordConnectionService.restartChannelListeners()
Bukkit.getServer().consoleSender.sendMessage(PREFIX_CONSOLE + ChatColor.DARK_GREEN + "Started server linking.")
Bukkit.getServer()
.consoleSender.sendMessage(PREFIX_CONSOLE + ChatColor.DARK_GREEN + "Started server linking.")
}

for (world in Bukkit.getWorlds()) {
Expand Down Expand Up @@ -338,4 +357,27 @@ class BlockBallPlugin : JavaPlugin(), PluginProxy {

return false
}

/**
* Checks if armorStand ticking is disabled when PaperSpigot is being used.
*/
private fun isArmorStandTickingDisabled(): Boolean {
if (config.getBoolean("game.ignore-ticking-settings")) {
return false
}

val path = Paths.get("paper.yml")

if (!Files.exists(path)) {
return false
}

for (line in Files.readAllLines(path)) {
if (line.contains("armor-stands-tick: false")) {
return true
}
}

return false
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class BallProxyImpl(
* Is the ball currently grabbed by some entity?
*/
override var isGrabbed: Boolean = false

/**
* Is the entity dead?
*/
Expand Down Expand Up @@ -388,7 +388,11 @@ class BallProxyImpl(
this.getCalculationEntity<Entity>().velocity = vector
val normalized = vector.clone().normalize()
this.originVector = vector.clone()
this.reduceVector = Vector(normalized.x / this.times, 0.0784 * meta.movementModifier.gravityModifier, normalized.z / this.times)
this.reduceVector = Vector(
normalized.x / this.times,
0.0784 * meta.movementModifier.gravityModifier,
normalized.z / this.times
)
} catch (ignored: IllegalArgumentException) {
// Ignore calculated velocity if it's out of range.
}
Expand Down Expand Up @@ -466,7 +470,14 @@ class BallProxyImpl(
* Calculates the knockback for the given [sourceVector] and [sourceBlock]. Uses the motion values to correctly adjust the
* wall.
*/
override fun <V, B> calculateKnockBack(sourceVector: V, sourceBlock: B, mot0: Double, mot2: Double, mot6: Double, mot8: Double): Boolean {
override fun <V, B> calculateKnockBack(
sourceVector: V,
sourceBlock: B,
mot0: Double,
mot2: Double,
mot6: Double,
mot8: Double
): Boolean {
if (sourceVector !is Vector) {
throw IllegalArgumentException("SourceVector has to be a BukkitVector!")
}
Expand Down Expand Up @@ -568,7 +579,7 @@ class BallProxyImpl(
* @return whether the knockback was applied
*/
private fun applyKnockBack(starter: Vector, n: Vector, block: Block, blockFace: BlockFace): Boolean {
if (block.type == org.bukkit.Material.AIR && this.knockBackBumper <= 0) {
if (this.knockBackBumper <= 0) {
val optBounce = getBounceConfigurationFromBlock(block)
if (optBounce.isPresent || meta.alwaysBounce) {
var r = starter.clone().subtract(n.multiply(2 * starter.dot(n))).multiply(0.75)
Expand Down
2 changes: 1 addition & 1 deletion blockball-bukkit-plugin/src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: BlockBall
version: 6.12.0
version: 6.13.0
author: Shynixn
website: https://www.spigotmc.org/members/shynixn.63455/
main: com.github.shynixn.blockball.bukkit.BlockBallPlugin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,19 @@ class TemplateSettingsPage : Page(TemplateSettingsPage.ID, OpenPage.ID) {
cache[0] = templateService.generateArena(targetTemplate)
cache[3] = targetTemplate
return MenuCommandResult.SUCCESS
} else if (command == MenuCommand.TEMPLATE_SELECT_CALLBACK && args.size >= 3) {
val templateID = args[2].toInt()
val templates = templateService.getAvailableTemplates()
} else if (command == MenuCommand.TEMPLATE_SELECT_CALLBACK) {
if(args.size >= 3){
val templateID = args[2].toInt()
val templates = templateService.getAvailableTemplates()

templateService.copyTemplateFilesFromResources()
cache[0] = templateService.generateArena(templates[templateID])
cache[3] = templates[templateID]
templateService.copyTemplateFilesFromResources()
cache[0] = templateService.generateArena(templates[templateID])
cache[3] = templates[templateID]

return MenuCommandResult.SUCCESS
return MenuCommandResult.SUCCESS
}

return MenuCommandResult.BACK;
}

return super.execute(player, command, cache, args)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ sql:
game:
always-use-blockballaxe: false
allow-server-linking: false
ignore-ticking-settings: false

############################

Expand Down
5 changes: 5 additions & 0 deletions blockball-sponge-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dependencies {
implementation(project(":blockball-api"))

compileOnly("org.spongepowered:spongeapi:7.1.0")
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package com.github.shynixn.blockball.api.sponge.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.spongepowered.api.event.Cancellable

/**
* Created by Shynixn 2018.
* <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.
*/
open class BallCancelableEvent(ball: BallProxy) : BallEvent(ball), Cancellable {
private var cancelled = false

/**
* Sets cancelled.
*/
override fun setCancelled(cancel: Boolean) {
this.cancelled = cancel
}

/**
* Is cancelled.
*/
override fun isCancelled(): Boolean {
return cancelled
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.github.shynixn.blockball.api.sponge.event

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

/**
* Created by Shynixn 2018.
* <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.
*/
class BallDeathEvent(ball: BallProxy) : BallEvent(ball)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.github.shynixn.blockball.api.sponge.event

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

/**
* Created by Shynixn 2018.
* <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.
*/
open class BallEvent(
/**
* Ball.
*/
val ball: BallProxy) : BlockBallEvent()
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.github.shynixn.blockball.api.sponge.event

import com.github.shynixn.blockball.api.business.proxy.BallProxy
import org.spongepowered.api.entity.Entity

/**
* Created by Shynixn 2018.
* <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.
*/
class BallGrabEvent(entity: Entity, ball: BallProxy) : BallInteractEvent(entity, ball)
Loading

0 comments on commit 71d91c3

Please sign in to comment.