- Баллы
- 36
- Имя в Minecraft
- Welester
package yas;
import java.io.File;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class closet extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
public void onEnable(){
File config = new File(getDataFolder() + File.separator + "config.yml");
if(!config.exists()){
getLogger().info("Creating new config files...");
getConfig().options().copyDefaults(true);
saveDefaultConfig();
}
Bukkit.getPluginManager().registerEvents(this, this);
getCommand("balance").setExecutor(new commands(this));
}
public void onDisable(){
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
for(String s : getConfig().getStringList(".Name")){
if(s.equalsIgnoreCase("Name")){
config.set(p.getPlayer().getName() + ".Name",e.getPlayer().getName());
config.set(p.getPlayer().getName() + ".money",100);
config.set(p.getPlayer().getName() + ".Job", 0);
config.set(p.getPlayer().getName() + ".JobType", 0);
saveConfig();
}
}
}
@EventHandler
public void onBlockBreak(BlockBreakEvent e){
Player p = e.getPlayer();
}
}
import java.io.File;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public class closet extends JavaPlugin implements Listener {
FileConfiguration config = getConfig();
public void onEnable(){
File config = new File(getDataFolder() + File.separator + "config.yml");
if(!config.exists()){
getLogger().info("Creating new config files...");
getConfig().options().copyDefaults(true);
saveDefaultConfig();
}
Bukkit.getPluginManager().registerEvents(this, this);
getCommand("balance").setExecutor(new commands(this));
}
public void onDisable(){
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e){
Player p = e.getPlayer();
p.playSound(p.getLocation(), Sound.NOTE_PIANO, 1, 1);
for(String s : getConfig().getStringList(".Name")){
if(s.equalsIgnoreCase("Name")){
config.set(p.getPlayer().getName() + ".Name",e.getPlayer().getName());
config.set(p.getPlayer().getName() + ".money",100);
config.set(p.getPlayer().getName() + ".Job", 0);
config.set(p.getPlayer().getName() + ".JobType", 0);
saveConfig();
}
}
}
@EventHandler
public void onBlockBreak(BlockBreakEvent e){
Player p = e.getPlayer();
}
}
Имя игрока:
Name: Игрок
money: 100
Job: 1
JobType: 0
Name: Игрок
money: 100
Job: 1
JobType: 0
Если возможно, то как сделать в if?