parent
378a557ee1
commit
897a45be11
@ -1,19 +1,31 @@ |
|||||||
package net.deliciousreya.minecraftportal |
package net.deliciousreya.minecraftportal |
||||||
|
|
||||||
import org.bukkit.plugin.PluginDescriptionFile |
import org.bukkit.Material |
||||||
|
import org.bukkit.event.EventHandler |
||||||
|
import org.bukkit.event.block.BlockPlaceEvent |
||||||
|
import org.bukkit.event.player.PlayerJoinEvent |
||||||
|
import org.bukkit.inventory.ItemStack |
||||||
import org.bukkit.plugin.java.JavaPlugin |
import org.bukkit.plugin.java.JavaPlugin |
||||||
import org.bukkit.plugin.java.JavaPluginLoader |
|
||||||
import java.io.File |
|
||||||
|
|
||||||
class MinecraftPortalPlugin( |
class MinecraftPortalPlugin() : JavaPlugin() |
||||||
loader: JavaPluginLoader, |
|
||||||
description: PluginDescriptionFile, |
|
||||||
dataFolder: File, |
|
||||||
file: File |
|
||||||
) : JavaPlugin(loader, description, dataFolder, file) |
|
||||||
{ |
{ |
||||||
override fun onEnable() { |
override fun onEnable() { |
||||||
super.onEnable() |
super.onEnable() |
||||||
logger.info("Loaded the portal plugin!") |
logger.info("Loaded the portal plugin!") |
||||||
|
for (player in server.onlinePlayers) { |
||||||
|
player.inventory.setItem(0, ItemStack(Material.GLASS, 10)) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@EventHandler |
||||||
|
fun onPlayerJoin(e: PlayerJoinEvent) { |
||||||
|
e.player.inventory.setItem(0, ItemStack(Material.GLASS, 10)) |
||||||
|
} |
||||||
|
|
||||||
|
@EventHandler |
||||||
|
fun onBlockPlaced(e: BlockPlaceEvent) { |
||||||
|
if (e.block.type.equals(Material.GLASS)) { |
||||||
|
logger.info("put down glass at " + e.block.location + " in " + e.block.world) |
||||||
|
} |
||||||
} |
} |
||||||
} |
} |
Loading…
Reference in new issue