commit 96991cb81d29e7358f0224ade955ae2d97302d9f Author: HeshamTB <38921037+HeshamTB@users.noreply.github.com> Date: Wed May 2 21:27:38 2018 +0300 Initial commit diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..c1544f0 --- /dev/null +++ b/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.project b/.project new file mode 100644 index 0000000..c37f58f --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + greet + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/README.md b/README.md new file mode 100644 index 0000000..a0e8c5b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# minecraft-greet diff --git a/bin/i/hesh/greet/commands.class b/bin/i/hesh/greet/commands.class new file mode 100644 index 0000000..41307e1 Binary files /dev/null and b/bin/i/hesh/greet/commands.class differ diff --git a/bin/i/hesh/greet/events.class b/bin/i/hesh/greet/events.class new file mode 100644 index 0000000..234bef7 Binary files /dev/null and b/bin/i/hesh/greet/events.class differ diff --git a/plugin.yml b/plugin.yml new file mode 100644 index 0000000..8da7983 --- /dev/null +++ b/plugin.yml @@ -0,0 +1,18 @@ +name: greet +version: 0.3 +main: i.hesh.greet.commands +author: Don + +commands: + opcheck: + usage: / + description: Check op status. + count: + usage: / + description: returns online player list. + kit1: + usage: / + description: Basic survival kit. + setspwan: + usage: / + description: sets your current location as bed spwan. \ No newline at end of file diff --git a/src/i/hesh/greet/commands.java b/src/i/hesh/greet/commands.java new file mode 100644 index 0000000..b82b6cb --- /dev/null +++ b/src/i/hesh/greet/commands.java @@ -0,0 +1,92 @@ +package i.hesh.greet; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.command.Command; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.plugin.java.JavaPlugin; + +public class commands extends JavaPlugin { + + public void onEnable() { + + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.AQUA + "greet plugin is Enabled"); + Bukkit.getServer().getPluginManager().registerEvents(new events(), this); + + } + public void onDisable() { + Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.RED + "Plugin greet is disabled"); + } + + + public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { + String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ] + Player p = (Player) sender; + + if(cmd.getName().equalsIgnoreCase("opcheck")) { + + String pName = p.getDisplayName(); + p.sendMessage(greetprefix + ChatColor.AQUA + "Hello " + pName+"! " ); + + + if (p.isOp()) { + p.sendMessage(greetprefix+ChatColor.GREEN +"You are an Operator"); + //p.giveExp(5); + } + else { + + p.sendMessage(greetprefix + ChatColor.GREEN +"You are not an Operator"); + } + + + } + if(cmd.getName().equalsIgnoreCase("count")) { + //p.sendMessage(hesh()); + + int i = 1; + p.sendMessage(greetprefix + ChatColor.GRAY + "Online Players :"); + for(Player player : Bukkit.getOnlinePlayers()) { + + p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName()); + i++; + } + + + + } + + if(cmd.getName().equalsIgnoreCase("kit1")) { + ItemStack kit1p = new ItemStack(Material.STONE_PICKAXE); + ItemStack kit1s = new ItemStack(Material.STONE_SWORD); + ItemStack kit1a = new ItemStack(Material.STONE_AXE); + ItemStack kit1t = new ItemStack(Material.TORCH,5); + + p.sendMessage( greetprefix + ChatColor.AQUA + "Survival Kit"); + + p.getInventory().addItem(kit1p); + p.getInventory().addItem(kit1s); + p.getInventory().addItem(kit1a); + p.getInventory().addItem(kit1t); + + } + /*if(cmd.getName().equalsIgnoreCase("setspwan")) { // TODO: give option of new arg to set cords & + p.setBedSpawnLocation(p.getLocation()); + p.sendMessage(ChatColor.GREEN +"Your bed Spwan has been updated to currnet location"); + + }*/ //failed to respwan (bed obstructed) + return true; + } + + + public String hesh() { + String Players; + Players = Bukkit.getServer().getOnlinePlayers().toString(); + + + return Players; + } + +} diff --git a/src/i/hesh/greet/events.java b/src/i/hesh/greet/events.java new file mode 100644 index 0000000..c9bc821 --- /dev/null +++ b/src/i/hesh/greet/events.java @@ -0,0 +1,51 @@ +package i.hesh.greet; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerBedEnterEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +public class events implements Listener { + + String prefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "5radl" + ChatColor.AQUA + "] "; //[ 5radl ] + + @EventHandler + public void player(PlayerJoinEvent e) { + + Player p = e.getPlayer(); + e.setJoinMessage(prefix + ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.AQUA + " joined 5radl Server!"); + String pName = p.getDisplayName(); + p.sendMessage(ChatColor.AQUA +"Hello " + pName + ", Welcome to 5radl Server"); + //p.sendMessage(ChatColor.AQUA +"Online Players are "+ Bukkit.getOnlinePlayers()); + + + p.sendMessage(ChatColor.GRAY + "Online Players :"); + int i = 1; + for(Player player : Bukkit.getOnlinePlayers()) { + p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName()); + i++; + } + p.sendMessage(ChatColor.AQUA +"Type"+ ChatColor.GREEN +" (/help greet) "+ ChatColor.AQUA+ "for list of new commands"); + + } + @EventHandler + public void Quit(PlayerQuitEvent e ) { + Player p = e.getPlayer(); + e.setQuitMessage(prefix +ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server"); + } + + public void player(PlayerBedEnterEvent e) { //Changed TRY! + Player p = e.getPlayer(); + p.sendMessage("aaaaaaaaaaa"); + Bukkit.getWorld("world").setFullTime(1); + Bukkit.getConsoleSender().sendMessage(prefix +"Good Morning!"); + } + + + +} +