big push
This commit is contained in:
7
EssentialsLight/.classpath
Normal file
7
EssentialsLight/.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/jmsdesk/Documents/Minecraft Plugins/MC-Plugins/bukkit/spigot-1.13.2.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
1
EssentialsLight/.gitignore
vendored
Normal file
1
EssentialsLight/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/bin/
|
||||
17
EssentialsLight/.project
Normal file
17
EssentialsLight/.project
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>EssentialsLight</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>
|
||||
13
EssentialsLight/.settings/org.eclipse.jdt.core.prefs
Normal file
13
EssentialsLight/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,13 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
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.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
41
EssentialsLight/src/com/jslightham/essentialslight/Main.java
Normal file
41
EssentialsLight/src/com/jslightham/essentialslight/Main.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.jslightham.essentialslight;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.jslightham.essentialslight.commands.BroadcastCommand;
|
||||
import com.jslightham.essentialslight.commands.DayCommand;
|
||||
import com.jslightham.essentialslight.commands.FeedCommand;
|
||||
import com.jslightham.essentialslight.commands.FlyCommand;
|
||||
import com.jslightham.essentialslight.commands.GameMode;
|
||||
import com.jslightham.essentialslight.commands.HealCommand;
|
||||
import com.jslightham.essentialslight.commands.HomeCommand;
|
||||
import com.jslightham.essentialslight.commands.InvseeCommand;
|
||||
import com.jslightham.essentialslight.commands.MsgCommand;
|
||||
import com.jslightham.essentialslight.commands.NightCommand;
|
||||
import com.jslightham.essentialslight.commands.SetSpawnCommand;
|
||||
import com.jslightham.essentialslight.commands.SethomeCommand;
|
||||
import com.jslightham.essentialslight.commands.SpawnCommand;
|
||||
import com.jslightham.essentialslight.commands.TeleportCommand;
|
||||
|
||||
public class Main extends JavaPlugin{
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
saveDefaultConfig();
|
||||
new FlyCommand(this);
|
||||
new TeleportCommand(this);
|
||||
new GameMode(this);
|
||||
new HealCommand(this);
|
||||
new FeedCommand(this);
|
||||
new SetSpawnCommand(this);
|
||||
new SpawnCommand(this);
|
||||
new DayCommand(this);
|
||||
new NightCommand(this);
|
||||
new BroadcastCommand(this);
|
||||
new MsgCommand(this);
|
||||
new InvseeCommand(this);
|
||||
new SethomeCommand(this);
|
||||
new HomeCommand(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class BroadcastCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public BroadcastCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("broadcast").setExecutor(this);
|
||||
plugin.getCommand("bc").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
String msg = "";
|
||||
for(int i = 0; i<args.length; i++) {
|
||||
msg+= args[i] + " ";
|
||||
}
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
player.sendMessage(Utils.chat(plugin.getConfig().getString("Broadcast.broadcastPrefix") + msg));
|
||||
}
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Broadcast.broadcastPrefix") + msg));
|
||||
return true;
|
||||
}else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.broadcast")) {
|
||||
String msg = "";
|
||||
for(int i = 0; i<args.length; i++) {
|
||||
msg+= args[i] + " ";
|
||||
}
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
player.sendMessage(Utils.chat(plugin.getConfig().getString("Broadcast.broadcastPrefix") + msg));
|
||||
}
|
||||
}else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class DayCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public DayCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("day").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
player.getWorld().setTime(1000);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Day.onSet")));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.day")) {
|
||||
p.getWorld().setTime(1000);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Day.onSet")));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class FeedCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public FeedCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("feed").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
String c = "";
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
c += args[i] + " ";
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (c.contains(player.getName())) {
|
||||
player.setFoodLevel(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Feed.setFood")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.feed")) {
|
||||
boolean gmChanged = false;
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (c.contains(player.getName())) {
|
||||
player.setFoodLevel(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Feed.setFood")));
|
||||
gmChanged = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!gmChanged) {
|
||||
p.setFoodLevel(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Feed.setFood")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class FlyCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public FlyCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
plugin.getCommand("fly").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.fly")) {
|
||||
if (p.getAllowFlight()) {
|
||||
p.setFlying(false);
|
||||
p.setAllowFlight(false);
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("FlyCommand.onDisable")));
|
||||
return true;
|
||||
} else {
|
||||
p.setAllowFlight(true);
|
||||
p.setFlying(true);
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("FlyCommand.onEnable")));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class GameMode implements CommandExecutor {
|
||||
private Main plugin;
|
||||
|
||||
public GameMode(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("gm").setExecutor(this);
|
||||
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
/*
|
||||
boolean gmChanged = false;
|
||||
boolean playerOffline = true;
|
||||
try {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (args[0].contains(player.getName())) {
|
||||
playerOffline = false;
|
||||
if (args[1].toLowerCase().contains("c") || args[1].toLowerCase().contains("creative")
|
||||
|| args[1].toLowerCase().contains("s") || args[1].toLowerCase().contains("survival")
|
||||
|| args[1].toLowerCase().contains("a") || args[1].toLowerCase().contains("adventure")
|
||||
|| args[1].toLowerCase().contains("spectator")) {
|
||||
gmChanged = true;
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "c":
|
||||
case "creative":
|
||||
player.setGameMode(org.bukkit.GameMode.CREATIVE);
|
||||
break;
|
||||
case "s":
|
||||
case "survival":
|
||||
player.setGameMode(org.bukkit.GameMode.SURVIVAL);
|
||||
break;
|
||||
case "a":
|
||||
case "adventure":
|
||||
player.setGameMode(org.bukkit.GameMode.ADVENTURE);
|
||||
break;
|
||||
case "spectator":
|
||||
player.setGameMode(org.bukkit.GameMode.SPECTATOR);
|
||||
break;
|
||||
}
|
||||
player.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
if (playerOffline)
|
||||
System.out.println(Utils.chat(plugin.getConfig().getString("playerOffline")));
|
||||
if (!gmChanged) {
|
||||
System.out.println(Utils.chat(plugin.getConfig().getString("invalidGameMode")));
|
||||
}
|
||||
return true;
|
||||
*/
|
||||
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if(args.length < 1) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
return true;
|
||||
}
|
||||
Player g = p;
|
||||
boolean gameModeChanged = false;
|
||||
if (p.hasPermission("essentialslight.gm")) {
|
||||
try {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (args[0].equals(player.getName())) {
|
||||
g = player;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
try {
|
||||
if (args[1].toLowerCase().contains("c") || args[1].toLowerCase().contains("creative")
|
||||
|| args[1].toLowerCase().contains("s") || args[1].toLowerCase().contains("survival")
|
||||
|| args[1].toLowerCase().contains("a")
|
||||
|| args[1].toLowerCase().contains("adventure")
|
||||
|| args[1].toLowerCase().contains("spectator")) {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "c":
|
||||
case "creative":
|
||||
g.setGameMode(org.bukkit.GameMode.CREATIVE);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "s":
|
||||
case "survival":
|
||||
g.setGameMode(org.bukkit.GameMode.SURVIVAL);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "a":
|
||||
case "adventure":
|
||||
g.setGameMode(org.bukkit.GameMode.ADVENTURE);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "spectator":
|
||||
g.setGameMode(org.bukkit.GameMode.SPECTATOR);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
default:
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}catch(Exception e) {
|
||||
if (args[0].toLowerCase().contains("c") || args[0].toLowerCase().contains("creative")
|
||||
|| args[0].toLowerCase().contains("s") || args[0].toLowerCase().contains("survival")
|
||||
|| args[0].toLowerCase().contains("a")
|
||||
|| args[0].toLowerCase().contains("adventure")
|
||||
|| args[0].toLowerCase().contains("spectator")) {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "c":
|
||||
case "creative":
|
||||
g.setGameMode(org.bukkit.GameMode.CREATIVE);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "s":
|
||||
case "survival":
|
||||
g.setGameMode(org.bukkit.GameMode.SURVIVAL);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "a":
|
||||
case "adventure":
|
||||
g.setGameMode(org.bukkit.GameMode.ADVENTURE);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
case "spectator":
|
||||
g.setGameMode(org.bukkit.GameMode.SPECTATOR);
|
||||
g.sendMessage(Utils.chat(plugin.getConfig().getString("GameMode.changedMode")));
|
||||
gameModeChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!gameModeChanged)
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
}
|
||||
|
||||
else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class HealCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public HealCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("heal").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
String c = "";
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
c += args[i] + " ";
|
||||
}
|
||||
if (!(sender instanceof Player)) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (c.contains(player.getName())) {
|
||||
player.setHealth(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Heal.setHealth")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.heal")) {
|
||||
boolean gmChanged = false;
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (c.contains(player.getName())) {
|
||||
player.setHealth(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Heal.setHealth")));
|
||||
gmChanged = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!gmChanged) {
|
||||
p.setHealth(20);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Heal.setHealth")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class HomeCommand implements CommandExecutor{
|
||||
private Main plugin;
|
||||
|
||||
public HomeCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("home").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
}else {
|
||||
Player p = (Player) sender;
|
||||
if(p.hasPermission("essentialslight.feed")) {
|
||||
if(Utils.getLocationFromString(plugin.getConfig().getString("Homes."+p.getUniqueId())) != null) {
|
||||
p.teleport(Utils.getLocationFromString(plugin.getConfig().getString("Homes."+p.getUniqueId())));
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("Homes.onTeleport")));
|
||||
}else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("Homes.noHome")));
|
||||
}
|
||||
}else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class InvseeCommand implements CommandExecutor {
|
||||
private Main plugin;
|
||||
|
||||
public InvseeCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("invsee").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.invsee")) {
|
||||
if(args.length == 1) {
|
||||
Player t = Bukkit.getPlayer(args[0]);
|
||||
if(t == null) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
}else {
|
||||
p.openInventory(t.getInventory());
|
||||
}
|
||||
}else {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
}
|
||||
} else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class MsgCommand implements CommandExecutor {
|
||||
private Main plugin;
|
||||
|
||||
public MsgCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("msg").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
boolean sentMsg = false;
|
||||
if (!(sender instanceof Player)) {
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
} else {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (args[0].equals(player.getName())) {
|
||||
String msg = "";
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
msg += args[i] + " ";
|
||||
}
|
||||
sender.sendMessage(Utils.chat("&6[Me -> " + player.getName() + "] &f" + msg));
|
||||
player.sendMessage(Utils.chat("&6[Console -> Me] &f" + msg));
|
||||
sentMsg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.msg")) {
|
||||
if (args.length < 1) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
} else {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (args[0].equals(player.getName())) {
|
||||
String msg = "";
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
msg += args[i] + " ";
|
||||
}
|
||||
sender.sendMessage(Utils.chat("&6[Me -> " + player.getName() + "] &f" + msg));
|
||||
player.sendMessage(Utils.chat("&6[" + sender.getName() + " -> Me] &f" + msg));
|
||||
sentMsg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!sentMsg)
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class NightCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public NightCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("night").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
player.getWorld().setTime(13000);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Night.onSet")));
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.night")) {
|
||||
p.getWorld().setTime(14000);
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("Night.onSet")));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class SetSpawnCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public SetSpawnCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
|
||||
plugin.getCommand("setspawn").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
} else {
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.setspawn")) {
|
||||
plugin.getConfig().set("spawnLocation", Utils.getStringFromLocation(p.getLocation()));
|
||||
plugin.saveConfig();
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("SetSpawn.spawnSet")));
|
||||
} else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class SethomeCommand implements CommandExecutor{
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public SethomeCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("sethome").setExecutor(this);
|
||||
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
}
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.sethome")) {
|
||||
plugin.getConfig().set("Homes."+p.getUniqueId(), Utils.getStringFromLocation(p.getLocation()));
|
||||
plugin.saveConfig();
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("Homes.homeSet")));
|
||||
} else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class SpawnCommand implements CommandExecutor{
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public SpawnCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("spawn").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
}else {
|
||||
Player p = (Player) sender;
|
||||
if(p.hasPermission("essentialslight.spawn")) {
|
||||
if(Utils.getLocationFromString(plugin.getConfig().getString("spawnLocation")) != null) {
|
||||
p.teleport(Utils.getLocationFromString(plugin.getConfig().getString("spawnLocation")));
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("Spawn.onTeleport")));
|
||||
}else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("Spawn.noSpawn")));
|
||||
}
|
||||
|
||||
}else {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("permissionMessage")));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jslightham.essentialslight.commands;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.jslightham.essentialslight.Main;
|
||||
import com.jslightham.essentialslight.utils.Utils;
|
||||
|
||||
public class TeleportCommand implements CommandExecutor {
|
||||
|
||||
private Main plugin;
|
||||
|
||||
public TeleportCommand(Main plugin) {
|
||||
this.plugin = plugin;
|
||||
plugin.getCommand("tphere").setExecutor(this);
|
||||
}
|
||||
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(Utils.chat(plugin.getConfig().getString("errorMessage")));
|
||||
return true;
|
||||
}
|
||||
|
||||
Player p = (Player) sender;
|
||||
if (p.hasPermission("essentialslight.tphere")) {
|
||||
try {
|
||||
@SuppressWarnings("unused")
|
||||
String mentionedPlayer = args[0];
|
||||
} catch (Exception e) {
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("missingArguments")));
|
||||
return true;
|
||||
}
|
||||
boolean isTeleported = false;
|
||||
try {
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (args[0].contains(player.getName())) {
|
||||
isTeleported = true;
|
||||
player.teleport(p);
|
||||
player.sendMessage(Utils.chat(plugin.getConfig().getString("TeleportCommand.onTeleport")));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
if (!isTeleported)
|
||||
p.sendMessage(Utils.chat(plugin.getConfig().getString("playerOffline")));
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jslightham.essentialslight.utils;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
public class Utils {
|
||||
|
||||
public static String chat (String s) {
|
||||
return ChatColor.translateAlternateColorCodes('&', s);
|
||||
}
|
||||
|
||||
public static String getStringFromLocation(Location loc) {
|
||||
return loc.getWorld().getName() + ":" + loc.getX() + ":" + loc.getY() + ":" + loc.getZ() + ":" + loc.getYaw() + ":" + loc.getPitch() ;
|
||||
}
|
||||
public static Location getLocationFromString(String s) {
|
||||
if (s == null || s.trim() == "") {
|
||||
return null;
|
||||
}
|
||||
final String[] parts = s.split(":");
|
||||
if (parts.length == 6) {
|
||||
World w = Bukkit.getServer().getWorld(parts[0]);
|
||||
double x = Double.parseDouble(parts[1]);
|
||||
double y = Double.parseDouble(parts[2]);
|
||||
double z = Double.parseDouble(parts[3]);
|
||||
float yaw = Float.parseFloat(parts[4]);
|
||||
float pitch = Float.parseFloat(parts[5]);
|
||||
return new Location(w, x, y, z, yaw, pitch);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
55
EssentialsLight/src/config.yml
Normal file
55
EssentialsLight/src/config.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
#Message Sent to Console When Command Cannot Be Run By Console
|
||||
errorMessage: '&3&bEssentialsLight &7&l> &4You are unable to execute this command!'
|
||||
|
||||
#Message Sent to Player When Missing Permissions
|
||||
permissionMessage: '&3&bEssentialsLight &7&l> &4You do not have permission to run this command!'
|
||||
|
||||
#Message Sent When Command is Missing Arguments
|
||||
missingArguments: '&3&bEssentialsLight &7&l> &4Command Missing Arguments!'
|
||||
|
||||
#Message Sent When Player is Not Online
|
||||
playerOffline: '&3&bEssentialsLight &7&l> &4That player is offline!'
|
||||
|
||||
#Spawn Location
|
||||
spawnLocation: ''
|
||||
|
||||
#/fly
|
||||
FlyCommand:
|
||||
onEnable: '&3&bEssentialsLight &7&l> &aFlying Enabled!'
|
||||
onDisable: '&3&bEssentialsLight &7&l> &aFlying Disabled!'
|
||||
|
||||
#/tphere
|
||||
TeleportCommand:
|
||||
onTeleport: '&3&bEssentialsLight &7&l> &aTeleporting you'
|
||||
|
||||
#/gm
|
||||
GameMode:
|
||||
changedMode: '&3&bEssentialsLight &7&l> &aGameMode Changed'
|
||||
invalidGameMode: '&3&bEssentialsLight &7&l> &4Invalid GameMode'
|
||||
#/heal
|
||||
Heal:
|
||||
setHealth: '&3&bEssentialsLight &7&l> &aHealed Player'
|
||||
#/feed
|
||||
Feed:
|
||||
setFood: '&3&bEssentialsLight &7&l> &aFed Player'
|
||||
#/setspawn
|
||||
SetSpawn:
|
||||
spawnSet: '&3&bEssentialsLight &7&l> &aSpawn has been set!'
|
||||
#/spawn
|
||||
Spawn:
|
||||
onTeleport: '&3&bEssentialsLight &7&l> &aTeleporting you to the spawn!'
|
||||
noSpawn": '&3&bEssentialsLight &7&l> &4There is no spawn!'
|
||||
#/day
|
||||
Day:
|
||||
onSet: '&3&bEssentialsLight &7&l> &aSet time to day!'
|
||||
#/night
|
||||
Night:
|
||||
onSet: '&3&bEssentialsLight &7&l> &aSet time to Night!'
|
||||
#/broadcast
|
||||
Broadcast:
|
||||
broadcastPrefix: '&c[Broadcast] &f'
|
||||
#/sethome, /home
|
||||
Homes:
|
||||
homeSet: '&3&bEssentialsLight &7&l> &aSet home location!'
|
||||
onTeleport: '&3&bEssentialsLight &7&l> &aTeleporting you to your home!'
|
||||
noHome: '&3&bEssentialsLight &7&l> &4You have no Home!'
|
||||
22
EssentialsLight/src/plugin.yml
Normal file
22
EssentialsLight/src/plugin.yml
Normal file
@@ -0,0 +1,22 @@
|
||||
name: EssentialsLight
|
||||
version: 1.0.0
|
||||
author: jslightham
|
||||
main: com.jslightham.essentialslight.Main
|
||||
description: A Light Version of the Essentials Plugin
|
||||
|
||||
commands:
|
||||
fly:
|
||||
tphere:
|
||||
gm:
|
||||
heal:
|
||||
feed:
|
||||
setspawn:
|
||||
spawn:
|
||||
day:
|
||||
night:
|
||||
broadcast:
|
||||
bc:
|
||||
msg:
|
||||
invsee:
|
||||
sethome:
|
||||
home:
|
||||
Reference in New Issue
Block a user