forked from Geoffrey/Geoffrey-MC-Plugin
Added add_item and add_resident commands + better logging
+ Added error logging to console + Re-did plugin.yml to have a usage for each command + Handle multiple word location names bettermaster
parent
d834c95b00
commit
f92a0c98bf
8
pom.xml
8
pom.xml
|
@ -137,14 +137,6 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>8</source>
|
||||
<target>8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -5,6 +5,7 @@ import com.zerohighdef.geoffrey.GeoffreyMC;
|
|||
import com.zerohighdef.geoffrey.Models.GeoffreyLocation;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyAPICallback;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyCommandError;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -28,7 +29,7 @@ public class AddLocationCommand extends GeoffreyCommand{
|
|||
Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
if (args.length > 0) {
|
||||
params.put("name", String.join(" ", args));
|
||||
params.put("name", StringUtils.join(args, " "));
|
||||
}
|
||||
|
||||
Player player = ((Player) sender).getPlayer();
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.google.gson.JsonElement;
|
|||
import com.zerohighdef.geoffrey.GeoffreyMC;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyAPICallback;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyCommandError;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -21,7 +22,7 @@ public class FindCommand extends GeoffreyCommand {
|
|||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (args.length > 0) {
|
||||
String locationName = String.join(" ", args);
|
||||
String locationName = StringUtils.join(args, " ");
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
|
||||
params.put("search", locationName);
|
||||
|
|
|
@ -27,7 +27,6 @@ public class RegisterCommand extends GeoffreyCommand{
|
|||
Player player = ((Player) sender).getPlayer();
|
||||
|
||||
params.put("player_name", player.getName());
|
||||
params.put("discord_uuid", "");
|
||||
|
||||
RunCommand("register", params, Method.POST , new CommandCallback(sender));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.google.gson.JsonElement;
|
|||
import com.zerohighdef.geoffrey.GeoffreyMC;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyAPICallback;
|
||||
import com.zerohighdef.geoffrey.Objects.GeoffreyCommandError;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -22,7 +23,7 @@ public class SellingCommand extends GeoffreyCommand {
|
|||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
|
||||
if (args.length > 0) {
|
||||
String item = String.join(" ", args);
|
||||
String item = StringUtils.join(args, " ");
|
||||
String commandName;
|
||||
|
||||
if (command.getName().contains("price")) {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.zerohighdef.geoffrey;
|
||||
|
||||
import com.zerohighdef.geoffrey.Commands.AddLocationCommand;
|
||||
import com.zerohighdef.geoffrey.Commands.FindCommand;
|
||||
import com.zerohighdef.geoffrey.Commands.RegisterCommand;
|
||||
import com.zerohighdef.geoffrey.Commands.SellingCommand;
|
||||
import com.zerohighdef.geoffrey.Commands.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
@ -41,6 +38,12 @@ public final class GeoffreyMC extends JavaPlugin {
|
|||
|
||||
RegisterCommand registerCommand = new RegisterCommand(this);
|
||||
this.getCommand("geoffrey_register").setExecutor(registerCommand);
|
||||
|
||||
AddItemCommand addItemCommand = new AddItemCommand(this);
|
||||
this.getCommand("geoffrey_add_item").setExecutor(addItemCommand);
|
||||
|
||||
AddResidentCommand addResidentCommand = new AddResidentCommand(this);
|
||||
this.getCommand("geoffrey_add_resident").setExecutor(addResidentCommand);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,11 +12,12 @@ import org.bukkit.command.CommandSender;
|
|||
import xyz.etztech.core.web.ICallback;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public abstract class GeoffreyAPICallback implements ICallback {
|
||||
protected CommandSender commandSender;
|
||||
protected HashMap<String, String> errors = new HashMap<>();
|
||||
private Logger log = Logger.getLogger( "Minecraft" );
|
||||
|
||||
|
||||
public GeoffreyAPICallback(CommandSender commandSender) {
|
||||
|
@ -40,6 +41,9 @@ public abstract class GeoffreyAPICallback implements ICallback {
|
|||
if (errors.containsKey(error)) {
|
||||
errorMessage = errors.get(error);
|
||||
}
|
||||
else {
|
||||
log.info("[Geoffrey] " + object.get("error").getAsString() + " " + object.get("error_message").getAsString());
|
||||
}
|
||||
|
||||
commandSender.sendMessage(ChatColor.RED + errorMessage);
|
||||
throw new GeoffreyCommandError();
|
||||
|
|
|
@ -7,52 +7,65 @@ commands:
|
|||
geoffrey_find:
|
||||
description: Finds a location in Geoffrey
|
||||
aliases: [find, find_location]
|
||||
usage: /find [location name]
|
||||
geoffrey_selling:
|
||||
description: Finds an item for sale in Geoffrey
|
||||
aliases: [selling]
|
||||
usage: /selling [item name]
|
||||
geoffrey_selling_price:
|
||||
description: Finds an item for sale in Geoffrey, sorted by price
|
||||
aliases: [selling_price]
|
||||
usage: /selling_price [item name]
|
||||
geoffrey_add_base:
|
||||
description: Adds a base to Geoffrey
|
||||
aliases: [add_base]
|
||||
permission: geoffrey.add
|
||||
usage: Adds a base at your current location to Geoffrey
|
||||
usage: /add_base [base name]
|
||||
geoffrey_add_shop:
|
||||
description: Adds a shop to Geoffrey
|
||||
aliases: [add_shop]
|
||||
permission: geoffrey.add
|
||||
usage: Adds a shop at your current location to Geoffrey
|
||||
usage: /add_shop [shop name]
|
||||
geoffrey_add_farm:
|
||||
description: Adds a public farm to Geoffrey
|
||||
aliases: [add_farm]
|
||||
permission: geoffrey.add
|
||||
usage: Adds a farm at your current location to Geoffrey
|
||||
usage: /add_farm [farm name]
|
||||
geoffrey_add_attraction:
|
||||
description: Adds an attraction to Geoffrey
|
||||
aliases: [add_attraction]
|
||||
permission: geoffrey.add
|
||||
usage: Adds an attraction at your current location to Geoffrey
|
||||
usage: /add_attraction [attraction name]
|
||||
geoffrey_add_town:
|
||||
description: Adds a town to Geoffrey
|
||||
aliases: [add_town]
|
||||
permission: geoffrey.add
|
||||
usage: Adds a town at your current location to Geoffrey
|
||||
usage: /add_town [town name]
|
||||
geoffrey_add_market:
|
||||
description: Adds a market to Geoffrey
|
||||
aliases: [add_market]
|
||||
permission: geoffrey.add
|
||||
usage: Adds a market at your current location to Geoffrey
|
||||
usage: /add_market [market name]
|
||||
geoffrey_register:
|
||||
description: Registers a player for Geoffrey
|
||||
aliases: [register]
|
||||
permission: geoffrey.register
|
||||
usage: Registers you in Geoffrey
|
||||
usage: /register
|
||||
geoffrey_add_item:
|
||||
description: Adds an item to a shop in Geoffrey
|
||||
aliases: [add_item]
|
||||
permission: geoffrey.add
|
||||
usage: /add_item [item name] [amount per price] [price] [shop name]
|
||||
geoffrey_add_resident:
|
||||
description: Adds a resident to a tow
|
||||
aliases: [add_resident]
|
||||
permission: geoffrey.add
|
||||
usage: /add_resident [resident Name] [town name]
|
||||
|
||||
permissions:
|
||||
add:
|
||||
description: Permission to add things to Geoffrey
|
||||
default: false
|
||||
register:
|
||||
description: Permission to register in Geoffrey
|
||||
description: Permission to register for Geoffrey
|
||||
default: false
|
||||
|
|
Loading…
Reference in New Issue