Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- joinevent
- @EventHandler
- public void onJoinFFA(PlayerJoinEvent e){
- Player p = e.getPlayer();
- String message = cfg.getString("messages.JoinMessage");
- message = message.replaceAll("%player%", p.getName());
- e.setJoinMessage(ChatColor.translateAlternateColorCodes('&', message));
- main
- package de.manugun.ffa;
- import java.io.File;
- import java.io.IOException;
- import org.bukkit.configuration.file.YamlConfiguration;
- import org.bukkit.plugin.java.JavaPlugin;
- public class Main extends JavaPlugin{
- public static String prefix = "§8[§aFFA§8] §7";
- public void onEnable(){
- loadListeners();
- loadCommands();
- createFile();
- }
- private void loadCommands() {
- getCommand("reload").setExecutor(new ReloadCommand());
- getCommand("setspawn").setExecutor(new SetSpawnCommand());
- getCommand("spawn").setExecutor(new SpawnCommand());
- getCommand("ping").setExecutor(new PingCommand());
- getCommand("ffa").setExecutor(new FFACommand());
- getCommand("shop").setExecutor(new ShopCommand());
- getCommand("addcoins").setExecutor(new AddCoinsCommand());
- getCommand("stats").setExecutor(new StatsCommand());
- getCommand("coins").setExecutor(new CoinsCommand());
- getCommand("setshop").setExecutor(new setVillagerShop());
- }
- private void loadListeners() {
- getServer().getPluginManager().registerEvents(new JoinEvent(), this);
- getServer().getPluginManager().registerEvents(new BuildEvent(), this);
- getServer().getPluginManager().registerEvents(new FoodEvent(), this);
- getServer().getPluginManager().registerEvents(new KillEvent(), this);
- getServer().getPluginManager().registerEvents(new RespawnListener(), this);
- getServer().getPluginManager().registerEvents(new KillstreakEvent(), this);
- getServer().getPluginManager().registerEvents(new ShopCommand(), this);
- getServer().getPluginManager().registerEvents(new VillagerShop(), this);
- getServer().getPluginManager().registerEvents(new CoinManager(), this);
- getServer().getPluginManager().registerEvents(new StatsManager(), this);
- }
- public static void createFile() {
- File file = new File("plugins//FFA//messages.yml");
- File ordner = new File("plugins//FFA");
- if(!ordner.exists()) {
- ordner.mkdirs();
- }
- if(!file.exists()) {
- try {
- file.createNewFile();
- } catch (IOException e) {
- e.printStackTrace();
- }
- YamlConfiguration cfg = YamlConfiguration.loadConfiguration(file);
- cfg.addDefault("Messages.JoinMessage", "&8[&aFFA&8] &a%player% &7hat FFA betreten");
- cfg.options().copyDefaults(true);
- try {
- cfg.save(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement