From 96991cb81d29e7358f0224ade955ae2d97302d9f Mon Sep 17 00:00:00 2001 From: HeshamTB <38921037+HeshamTB@users.noreply.github.com> Date: Wed, 2 May 2018 21:27:38 +0300 Subject: [PATCH] Initial commit --- .classpath | 7 ++ .gitattributes | 2 + .project | 17 +++++ .settings/org.eclipse.jdt.core.prefs | 11 ++++ README.md | 1 + bin/i/hesh/greet/commands.class | Bin 0 -> 4047 bytes bin/i/hesh/greet/events.class | Bin 0 -> 3221 bytes plugin.yml | 18 ++++++ src/i/hesh/greet/commands.java | 92 +++++++++++++++++++++++++++ src/i/hesh/greet/events.java | 51 +++++++++++++++ 10 files changed, 199 insertions(+) create mode 100644 .classpath create mode 100644 .gitattributes create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 README.md create mode 100644 bin/i/hesh/greet/commands.class create mode 100644 bin/i/hesh/greet/events.class create mode 100644 plugin.yml create mode 100644 src/i/hesh/greet/commands.java create mode 100644 src/i/hesh/greet/events.java 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 0000000000000000000000000000000000000000..41307e12508d3d36e6f83812b170c3f1c6e5ace3 GIT binary patch literal 4047 zcmaJ@>wgs08GcS~GrJiOfW?`p5WmEH@KvkzbYD7_qh=yv^2wc-+T1H=SV#II`>LWQrpsvTx z=($1NG39$8tSXF|uE2FYWxYuVsJ4}~v^xFN`N|0e zYZ#7~uAFXVu16$-wOFShCU9-Y!Ok(AW^=Zq;U+XPp&bVXIs{gR zgP7MzNT4@pxEUK*2|b^uqXI2WJqvbIBgc(QA<-NXmAH~n(M(6Z>c{*d$4oco=XzA) zZ<6@8EQ0kht^zAhwrYsuR@Say`}z!(DO_+aK&izWu|>gc0vke^xLSHO+>SPZT9*O$ z8m_Bn*;w`AxaS-kl%?LPVH?{0n);2~t6Mz7nl_f!G-&e@CDwAgz>1R2G$swJ;6{-^ zq!xFgL&2K_)`q+<2c%&aIt7+GM%Hu-hLiL_1hzJXtLs6>d!&YCIEnC931~vjTg0|@ zo35M-*-m>j?3GPZ*`M64qFZ2@GU!-=V1j&Cey_cE^$a9c^b1sbKB_nxXuj?t;RSL&}LwHSb*;h40wl(txoJe`y#rIj%aCXUncq@F7psbc~+huidupOhumgSr?O5x5$U9p@1TJ!gN#IA`2gp`F)#)6EeTmd;62gJ{9+} zfrsp3Om~c!ZpBi0!_f=2qv9PL{<#gyE|hM*lK>gJXcZ*n0~+4tm27W+$B>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Wi^1;@DwBZ6K?f~4tw}7 v2Xv`7(|?v7^_QMaPf+4Bl0UwK%*l|Kqm{mPkRy$6e`lPM%>Ln>`RD%uHgPS) literal 0 HcmV?d00001 diff --git a/bin/i/hesh/greet/events.class b/bin/i/hesh/greet/events.class new file mode 100644 index 0000000000000000000000000000000000000000..234bef7fb823d91edc1b254ddf7ac732eab082be GIT binary patch literal 3221 zcma)8`BxKH6#gFDL>N({qPUK2RaWDU6-o<;paNDb zzVDmVBIr3ip3|QG(4YDbwf1|H#3U$U&PitS-n;jH_q*S{Gk^bg>30Adaalv2z+5Xb zB;!MoK~G9QB1fd-$2AlP%sy(4m=W7_1|z%sj>>*tLykUTw6332Nsl$;DEAC52 zdICi;PYzfo1i~E|+aBMuoWXkTHdv13HwxreRQ3uKw75}OjC{=0F$2XKW(h2qY}TBx z?5OmLQHq%}5XL+Wa|PyQVQ3jL{TA1DJstB=Mz>9S_B9EVb=>Goy>hfrM>!S|j~Rrqcwg7E&$G+AO?hq*4 z^vT34u6J8M0|GTVG=v0Zby$wcXsxC$f;S$w}oV8o1{h1 ztBT#KV|!5Sw(h0_C1}S^4LbxDPK8v*E>(ApiFKL7?2!g^>gZByCBEC?9+zH=8J8j4 z%c#atmOw_0Kt4u~^hTt&LXp|6qetN?jZ0sZsZ++|=AcyZ_vz?W-bxu^n-y0TRe?gd zkF{@?w(S}r+|PQ}82hE&?+#1DcXJ{rFNbs-Rsl-l?4p$S5RQ=E-HuI6MzSh#V{0)? z^lRu7n3I)rb1+17L_wL(CX}RE%8LA?#h&mjJHj5fIfE#s`VtJn(lEq+2^hp%dz-`%=R zHSLHR3CEQZcU<49nGtf5U0!P_0FUT+6sK72Av4|;#Nv3oKZM5_d+*7ZR6(B5@uUh; z*w)?J+7-gnY;>c7W801y!Pu^3y`CXs1FmP-9LI(`U^w!)!O{)0zu10)9Ow3i>e{KA zndf5yi>B@+Vu>lq@Sw#n)jYGuH~Wuunz8hV*^{tH+_V!!9ZOG;V!Wr{n!}PbeQL)lN^%wSb(CYo{BE z%`)2RP-L03K2~XcB2b+r{~L_99K#SkV{e(6PY7R-_T#Q+M^!_8rQ>US!?f8s`__JnQkqPYVs7Pc=7mq) z?98TPlXWZZaT8v@+-|AIVo6{SU!xiyEBFM>=eLkws0S&33wY1h68@I(-$1a>m!_(V z(5o(^^uR^T9>tt7EC??i!_rY0>h|{FHdtNB+cB*E4b|sqpNCrhmeLEL(|0L0@VX}W zr($kI1Z#N}ScmmIy@B^d{I`);#uwkyM&mWFdJLO7s}+E%3#cAP{Y5m5VjF|kOrTAW z#*Pez-AN2%*u%}e0$nw^$oF%%Hfh%a=T9`5OXg0rK42kdw+Ljlla49x|08bYPW%#hbdsnYy%mUUPqs1srtH4hM zx54U}EDVax{D95%WDuCks?9?kU;Y|VhCVF9DJ;fmEWtS}#UEIPzj*%-3?cZ+r5JA{ zvt%;GxVk%wXUTOT{>5{6p6oZ`PrN`CF75s%T062KM~@wHni;+u+xcaq7E;oM{)tt6OLOnr5bmXY+G zPK!9s;)5Wq4XL!0xIW~H67-oAmO5hjsIw;gX;7N*=i~UYcmm(%V;n!{sx16#x(dJL saSWt2T}BW<6@RNS6E#>!o;DMZVmb+_?i!>zLK+Vst-l6oBJgzSfA%^%@&Et; literal 0 HcmV?d00001 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!"); + } + + + +} +