Skip to content

Commit

Permalink
Merge pull request #24 from mailboxkiller/master
Browse files Browse the repository at this point in the history
Update to 1.12.2 (API 7)
  • Loading branch information
randombyte-developer authored Dec 8, 2017
2 parents 1de6766 + 76cff5a commit 5b96fca
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 12 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
.gradle/
build/
.idea/
run/
run/
holograms\.iml
*.class
out/production/classes/META-INF/
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
}

plugins {
id "com.qixalite.spongestart" version "1.6.0"
id "com.qixalite.spongestart" version "1.6.2"
id "com.github.johnrengelman.shadow" version "1.2.4"
id "flavor.pie.promptsign" version "1.0.2"
}
Expand All @@ -33,10 +33,10 @@ allprojects {

spongestart {
eula true
spongeVanillaVersion "1.11.2-6.0.0-BETA-231"
spongeVanillaVersion "1.12.2-7.0.0-BETA-368"
}

ext.spongeApiVersion = "5.1.0"
ext.spongeApiVersion = "7.0.0-SNAPSHOT"

configurations {
compile.extendsFrom shadow
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Apr 10 17:36:39 CEST 2016
#Thu Dec 07 16:38:37 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.1-all.zip
20 changes: 15 additions & 5 deletions src/main/kotlin/de/randombyte/holograms/Holograms.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import org.spongepowered.api.Sponge
import org.spongepowered.api.command.args.GenericArguments.*
import org.spongepowered.api.command.spec.CommandSpec
import org.spongepowered.api.config.ConfigDir
import org.spongepowered.api.data.DataRegistration
import org.spongepowered.api.event.Listener
import org.spongepowered.api.event.cause.Cause
import org.spongepowered.api.event.cause.entity.spawn.SpawnCause
import org.spongepowered.api.event.cause.EventContext
import org.spongepowered.api.event.cause.entity.spawn.SpawnTypes
import org.spongepowered.api.event.game.GameReloadEvent
import org.spongepowered.api.event.game.state.GameInitializationEvent
Expand All @@ -31,6 +32,7 @@ class Holograms @Inject constructor(
@ConfigDir(sharedRoot = false) val configPath: Path,
val bStats: BStats) {


companion object {
const val NAME = "Holograms"
const val ID = "holograms"
Expand All @@ -39,12 +41,19 @@ class Holograms @Inject constructor(
}

val inputFile: Path = configPath.resolve("input.txt")

@Listener
fun onPreInit(event: GamePreInitializationEvent) {
val spawnCause = Cause.source(SpawnCause.builder().type(SpawnTypes.PLUGIN).build()).build()

val spawnCause = Cause.builder().append(SpawnTypes.PLUGIN).build(EventContext.empty())
Sponge.getServiceManager().setProvider(this, HologramsService::class.java, HologramsServiceImpl(spawnCause))
Sponge.getDataManager().register(HologramData::class.java, HologramData.Immutable::class.java, HologramData.Builder())
DataRegistration.builder()
.dataClass(HologramData::class.java)
.immutableClass(HologramData.Immutable::class.java)
.builder(HologramData.Builder())
.manipulatorId("holograms-data")
.dataName("Holograms Data")
.buildAndRegister(Sponge.getPluginManager().getPlugin(Holograms.ID).get())

}

@Listener
Expand Down Expand Up @@ -97,4 +106,5 @@ class Holograms @Inject constructor(
Files.createFile(this)
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class HologramsServiceImpl(val spawnCause: Cause) : HologramsService {

override fun createHologram(location: Location<out Extent>, text: Text): Optional<Hologram> {
val armorStand = location.createEntity(EntityTypes.ARMOR_STAND)
if (!location.extent.spawnEntity(armorStand, spawnCause)) return Optional.empty()
if (!location.extent.spawnEntity(armorStand)) return Optional.empty()

armorStand.offer(Keys.DISPLAY_NAME, text)
armorStand.offer(Keys.CUSTOM_NAME_VISIBLE, true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class HologramData internal constructor(var isHologram: Boolean = false) : Abstr

class Builder internal constructor() : AbstractDataBuilder<HologramData>(HologramData::class.java, 1), DataManipulatorBuilder<HologramData, Immutable> {


override fun create() = HologramData()

override fun createFrom(dataHolder: DataHolder): Optional<HologramData> = create().fill(dataHolder)
Expand Down

0 comments on commit 5b96fca

Please sign in to comment.