1
0
mirror of https://bitbucket.org/HeshamTB/greet.git synced 2024-12-26 08:15:30 +01:00

Merge pull request #4 from HeshamTB/dev

Dev
This commit is contained in:
HeshamTB 2018-05-03 14:54:04 +03:00 committed by GitHub
commit 5fcd47575d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 39 deletions

View File

@ -31,8 +31,6 @@ public class commands extends JavaPlugin {
String pName = p.getDisplayName(); String pName = p.getDisplayName();
p.sendMessage(greetprefix + ChatColor.AQUA + "Hello " + pName+"! " ); p.sendMessage(greetprefix + ChatColor.AQUA + "Hello " + pName+"! " );
if (p.isOp()) { if (p.isOp()) {
p.sendMessage(greetprefix+ChatColor.GREEN +"You are an Operator"); p.sendMessage(greetprefix+ChatColor.GREEN +"You are an Operator");
//p.giveExp(5); //p.giveExp(5);
@ -41,37 +39,24 @@ public class commands extends JavaPlugin {
p.sendMessage(greetprefix + ChatColor.GREEN +"You are not an Operator"); p.sendMessage(greetprefix + ChatColor.GREEN +"You are not an Operator");
} }
} }
if(cmd.getName().equalsIgnoreCase("count")) { if(cmd.getName().equalsIgnoreCase("count")) {
//p.sendMessage(hesh());
int i = 1; int i = 1;
p.sendMessage(greetprefix + ChatColor.GRAY + "Online Players :"); p.sendMessage(greetprefix + ChatColor.GRAY + "Online Players :");
for(Player player : Bukkit.getOnlinePlayers()) { for(Player player : Bukkit.getOnlinePlayers()) {
p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName()); p.sendMessage(ChatColor.RED + "" + i + "- " + player.getName());
i++; i++;
} }
} }
if(cmd.getName().equalsIgnoreCase("kit1") && p.isOp()) {
if(cmd.getName().equalsIgnoreCase("kit1")) { p.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
ItemStack kit1p = new ItemStack(Material.STONE_PICKAXE); p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
ItemStack kit1s = new ItemStack(Material.STONE_SWORD); p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
ItemStack kit1a = new ItemStack(Material.STONE_AXE); p.getInventory().addItem(new ItemStack(Material.STONE_SWORD));
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 & /*if(cmd.getName().equalsIgnoreCase("setspwan")) { // TODO: give option of new arg to set cords &
p.setBedSpawnLocation(p.getLocation()); p.setBedSpawnLocation(p.getLocation());
@ -80,14 +65,4 @@ public class commands extends JavaPlugin {
}*/ //failed to respwan (bed obstructed) }*/ //failed to respwan (bed obstructed)
return true; return true;
} }
public String hesh() {
String Players;
Players = Bukkit.getServer().getOnlinePlayers().toString();
return Players;
}
} }

View File

@ -1,15 +1,18 @@
package i.hesh.greet; package i.hesh.greet;
import org.bukkit.*; import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class sender { public class sender {
private static final String PREFIX = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ] private static final String PREFIX = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ]
public static void sendToPlayer(Player p, String msg, ChatColor c) {
p.sendMessage( PREFIX + c + msg); /** Sends a chat message to the Player*/
public static void sendToPlayer(Player player, String msg, ChatColor color) {
player.sendMessage( PREFIX + color + msg);
} }
/**Sends a chat message to all online players*/
public static void sendToAll() {} public static void sendToAll() {}