Created
December 27, 2020 12:43
-
-
Save NightSling/9ffb36d1e8e4a439c2d0b26dd50bb8a0 to your computer and use it in GitHub Desktop.
Ah all
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.crackpixel.daysling.generator; | |
import com.grinderwolf.swm.api.SlimePlugin; | |
import com.grinderwolf.swm.api.world.SlimeWorld; | |
import org.bukkit.Bukkit; | |
import org.bukkit.Location; | |
import org.bukkit.World; | |
import org.bukkit.entity.Player; | |
import org.bukkit.event.EventHandler; | |
import org.bukkit.event.Listener; | |
import org.bukkit.event.player.PlayerJoinEvent; | |
public class Generator implements Listener { | |
@EventHandler | |
public void onPlayerJoin(PlayerJoinEvent e){ | |
Player player = e.getPlayer(); | |
if(!player.hasPlayedBefore()){ | |
SlimePlugin generator = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager"); | |
SlimeWorld world = (SlimeWorld) Bukkit.getWorld("housingplot"); | |
generator.generateWorld(world.clone(String.format("%s_plot", player.getUniqueId()))); | |
World world1 = Bukkit.getWorld(String.format("%s_plot", player.getUniqueId())); | |
Location location = new Location(world1, world1.getSpawnLocation().getX(),world1.getSpawnLocation().getY() ,world1.getSpawnLocation().getZ()); | |
player.teleport(location); | |
} | |
World world1 = Bukkit.getWorld(String.format("%s_plot", player.getUniqueId())); | |
Location location = new Location(world1, world1.getSpawnLocation().getX(),world1.getSpawnLocation().getY() ,world1.getSpawnLocation().getZ()); | |
player.teleport(location); | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.crackpixel.daysling; | |
import net.crackpixel.daysling.generator.Generator; | |
import org.bukkit.plugin.java.JavaPlugin; | |
import java.util.logging.Level; | |
public final class HousingGenerator extends JavaPlugin { | |
public HousingGenerator instance = this; | |
@Override | |
public void onEnable() { | |
// Plugin startup logic | |
this.getLogger().log(Level.INFO, "Plugin is Ready To Yoink!"); | |
this.getServer().getPluginManager().registerEvents(new Generator(), this); | |
} | |
@Override | |
public void onDisable() { | |
// Plugin shutdown logic | |
this.getLogger().log(Level.WARNING, "Plugin is Disabled!"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: HousingGenerator | |
version: ${project.version} | |
main: net.crackpixel.daysling.HousingGenerator | |
prefix: [Housing] | |
depend: [slimeworldgenerator, worldguard, placeholderapi] | |
authors: [daysling, Dreechu] | |
website: https://crackpixel.net |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment