- Katılım
- 26 Şubat 2021
- Mesajlar
- 107
- Elmaslar
- 36
- Puan
- 6.675
- Konum
- Türkiye
- Minecraft
- wtfrankjs
Discord:
wtfrankjs
Merhaba dostlar ben bir plugin kodluyorum ve pluginde oyunucuyu Random Bir Alana ışınlaması işlemi gerçekleşiyor.
Fakat bir sorun var bu pek güvenli değil ayrıca Y kordinatını otomatik atamıyor.
Kodu aşağıya bırakıyorum eğer su / lav vb tehlikeli blokların üstüne ışınlamaması ve y yi oto ayarlamasını sağlayabilen bir arkadaş varsa çok mutlu olurum :)
Fakat bir sorun var bu pek güvenli değil ayrıca Y kordinatını otomatik atamıyor.
Kodu aşağıya bırakıyorum eğer su / lav vb tehlikeli blokların üstüne ışınlamaması ve y yi oto ayarlamasını sağlayabilen bir arkadaş varsa çok mutlu olurum :)
Kod:
//Random Location spawner
public Location Randomlocation(World world) {
Location result=null;
if (p.getConfig().getInt("settings.random.count")==100) {
result = new Location(world, RandomNumber(1000), 70, RandomNumber(1000));
world.getBlockAt(result.getBlockX(), result.getBlockY(), result.getBlockZ()).setType(Material.AIR);
world.loadChunk(result.getChunk());
world.getBlockAt(result.getBlockX(), result.getBlockY()-1, result.getBlockZ()).setType(Material.AIR);
world.getBlockAt(result.getBlockX(), result.getBlockY()+1, result.getBlockZ()).setType(Material.AIR);
}else if (p.getConfig().getInt("settings.random.count")==1000) {
result = new Location(world, RandomNumber(10000), 70, RandomNumber(10000));
world.loadChunk(result.getChunk());
world.getBlockAt(result.getBlockX(), result.getBlockY(), result.getBlockZ()).setType(Material.AIR);
world.getBlockAt(result.getBlockX(), result.getBlockY()-1, result.getBlockZ()).setType(Material.AIR);
world.getBlockAt(result.getBlockX(), result.getBlockY()+1, result.getBlockZ()).setType(Material.AIR);
}else {
p.getServer().getConsoleSender().sendMessage("Config'te count kismini 100 veya 1000 olarak ayarlayınız.");
p.getServer().getPluginManager().disablePlugin(p);
}
return result;
}