1
0
mirror of https://bitbucket.org/HeshamTB/greet.git synced 2024-11-22 11:22:16 +01:00

Merge pull request #5 from HeshamTB/dev

Dev
This commit is contained in:
HeshamTB 2018-05-05 01:20:37 +03:00 committed by GitHub
commit 164f10ab19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 37 additions and 39 deletions

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src">
<attributes>
<attribute name="ignore_optional_problems" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="C:/Users/Hesham/Desktop/spigot-1.12.2.jar"/> <classpathentry kind="lib" path="C:/Users/Hesham/Desktop/spigot-1.12.2.jar"/>
<classpathentry kind="lib" path="/home/hesham/eclipse-hesham/greet/libs/spigot-1.12.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -23,10 +23,10 @@ public class commands extends JavaPlugin {
public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) { public boolean onCommand(CommandSender sender, Command cmd, String commandlabel, String[] args) {
String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ] String greetprefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ]
Player p = (Player) sender; Player p = (Player) sender;
//use sender class
if(cmd.getName().equalsIgnoreCase("opcheck")) { if(cmd.getName().equalsIgnoreCase("opcheck")) {
String pName = p.getDisplayName(); String pName = p.getDisplayName();

View File

@ -5,22 +5,28 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerBedEnterEvent; import org.bukkit.event.player.PlayerBedEnterEvent;
import org.bukkit.event.player.PlayerBedLeaveEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
public class events implements Listener { public class events implements Listener {
String prefix = ChatColor.AQUA + "[" + ChatColor.BLUE + "5radl" + ChatColor.AQUA + "] "; //[ 5radl ] private final String PREFIX = ChatColor.AQUA + "[" + ChatColor.BLUE + "5radl" + ChatColor.AQUA + "] "; //[ 5radl ]
Player p;
ChatColor aqua = ChatColor.AQUA;
ChatColor gray = ChatColor.GRAY;
@EventHandler @EventHandler
public void player(PlayerJoinEvent e) { public void player(PlayerJoinEvent e) {
Player p = e.getPlayer(); p = e.getPlayer();
String pName = p.getDisplayName(); String pName = p.getDisplayName();
e.setJoinMessage(prefix + ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.AQUA + " joined 5radl Server!"); e.setJoinMessage(PREFIX + gray + p.getName().toLowerCase() + aqua + " joined 5radl Server!");
p.sendMessage(ChatColor.AQUA +"Hello " + pName + ", Welcome to 5radl Server"); p.sendMessage(aqua +"Hello " + pName + ", Welcome to 5radl Server");
p.sendMessage(ChatColor.GRAY + "Online Players :"); p.sendMessage(gray + "Online Players :");
int i = 1; int i = 1;
for(Player player : Bukkit.getOnlinePlayers()) { for(Player player : Bukkit.getOnlinePlayers()) {
@ -28,20 +34,28 @@ public class events implements Listener {
i++; i++;
} }
p.sendMessage(ChatColor.AQUA +"Type"+ ChatColor.GREEN +" (/help greet) "+ ChatColor.AQUA+ "for list of new commands"); //p.sendMessage(aqua +"Type"+ ChatColor.GREEN +" (/help greet) "+ aqua+ "for list of new commands");
} }
@EventHandler @EventHandler
public void Quit(PlayerQuitEvent e ) { public void Quit(PlayerQuitEvent e ) {
Player p = e.getPlayer();
e.setQuitMessage(prefix +ChatColor.GRAY + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server"); p = e.getPlayer();
e.setQuitMessage(PREFIX + gray + p.getName().toLowerCase() + ChatColor.DARK_RED + " left the server");
} }
public void player(PlayerBedEnterEvent e) { //Changed TRY! @EventHandler
Player p = e.getPlayer(); public void player(PlayerBedLeaveEvent e) {
p.sendMessage("aaaaaaaaaaa");
p = e.getPlayer();
Bukkit.getWorld("world").setFullTime(1); Bukkit.getWorld("world").setFullTime(1);
Bukkit.getConsoleSender().sendMessage(prefix +"Good Morning!"); p.sendMessage(PREFIX+" Good Morning!");
} }
@EventHandler
public void player(PlayerItemConsumeEvent e) {e.getPlayer().sendMessage(ChatColor.BOLD+"nom nom nom!");}
} }

View File

@ -1,19 +0,0 @@
package i.hesh.greet;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public class sender {
private static final String PREFIX = ChatColor.AQUA + "[" + ChatColor.BLUE + "greet" + ChatColor.AQUA + "] "; //[ greet ]
/** 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() {}
}