mirror of
https://bitbucket.org/HeshamTB/greet.git
synced 2024-11-21 23:22:16 +01:00
Initial commit
This commit is contained in:
commit
96991cb81d
7
.classpath
Normal file
7
.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<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="lib" path="C:/Users/Hesham/Desktop/spigot-1.12.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
17
.project
Normal file
17
.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>greet</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
11
.settings/org.eclipse.jdt.core.prefs
Normal file
11
.settings/org.eclipse.jdt.core.prefs
Normal file
@ -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
|
BIN
bin/i/hesh/greet/commands.class
Normal file
BIN
bin/i/hesh/greet/commands.class
Normal file
Binary file not shown.
BIN
bin/i/hesh/greet/events.class
Normal file
BIN
bin/i/hesh/greet/events.class
Normal file
Binary file not shown.
18
plugin.yml
Normal file
18
plugin.yml
Normal file
@ -0,0 +1,18 @@
|
||||
name: greet
|
||||
version: 0.3
|
||||
main: i.hesh.greet.commands
|
||||
author: Don
|
||||
|
||||
commands:
|
||||
opcheck:
|
||||
usage: /<command>
|
||||
description: Check op status.
|
||||
count:
|
||||
usage: /<command>
|
||||
description: returns online player list.
|
||||
kit1:
|
||||
usage: /<command>
|
||||
description: Basic survival kit.
|
||||
setspwan:
|
||||
usage: /<command>
|
||||
description: sets your current location as bed spwan.
|
92
src/i/hesh/greet/commands.java
Normal file
92
src/i/hesh/greet/commands.java
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
51
src/i/hesh/greet/events.java
Normal file
51
src/i/hesh/greet/events.java
Normal file
@ -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!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user