First commit

This commit is contained in:
2018-09-03 00:09:38 +02:00
commit 0c4601070f
8 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,19 @@
package cz.marwland.mc.core;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerLoginEvent;
public class EventListener implements Listener {
private final MarwCore plugin;
public EventListener(MarwCore plugin) {
this.plugin = plugin;
}
@EventHandler
public void normalLogin(PlayerLoginEvent event) {
plugin.getServer().broadcastMessage("Welcome " + event.getPlayer().getDisplayName() + "!");
}
}

View File

@ -0,0 +1,19 @@
package cz.marwland.mc.core;
import org.bukkit.plugin.java.JavaPlugin;
import cz.marwland.mc.core.cmd.First;
public class MarwCore extends JavaPlugin {
@Override
public void onEnable() {
getCommand("first").setExecutor(new First(this));
getServer().getPluginManager().registerEvents(new EventListener(this), this);
getLogger().info("Enabled!");
}
@Override
public void onDisable() {
}
}

View File

@ -0,0 +1,22 @@
package cz.marwland.mc.core.cmd;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import cz.marwland.mc.core.MarwCore;
public class First implements CommandExecutor {
private final MarwCore plugin;
public First(MarwCore plugin) {
this.plugin = plugin;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
plugin.getLogger().info("Hello?");
sender.sendMessage("henlo");
return false;
}
}