music/plugin cmds

This commit is contained in:
boy0001 2015-02-22 18:26:17 +11:00
parent 2e5fee41ef
commit e8a698816a
2 changed files with 9 additions and 6 deletions

View File

@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.ItemMeta;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.listeners.PlotPlusListener; import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import com.intellectualcrafters.plot.object.BukkitPlayer;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
@ -41,12 +42,12 @@ public class MusicSubcommand extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer player, final String... args) { public boolean execute(final PlotPlayer player, final String... args) {
Location loc = plr.getLocation(); Location loc = player.getLocation();
final Plot plot = MainUtil.getPlot(loc); final Plot plot = MainUtil.getPlot(loc);
if (plot == null) { if (plot == null) {
return !sendMessage(plr, C.NOT_IN_PLOT); return !sendMessage(player, C.NOT_IN_PLOT);
} }
if (!plot.hasRights(player)) { if (!plot.isAdded(player.getUUID())) {
sendMessage(player, C.NO_PLOT_PERMS); sendMessage(player, C.NO_PLOT_PERMS);
return true; return true;
} }
@ -59,7 +60,8 @@ public class MusicSubcommand extends SubCommand {
stack.setItemMeta(itemMeta); stack.setItemMeta(itemMeta);
inventory.addItem(stack); inventory.addItem(stack);
} }
player.openInventory(inventory); // FIXME unchecked casting
((BukkitPlayer) player).player.openInventory(inventory);
return true; return true;
} }
} }

View File

@ -32,6 +32,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.PlotSquared;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.TaskManager;
public class plugin extends SubCommand { public class plugin extends SubCommand {
public static String downloads, version; public static String downloads, version;
@ -90,12 +91,12 @@ public class plugin extends SubCommand {
@Override @Override
public boolean execute(final PlotPlayer plr, final String... args) { public boolean execute(final PlotPlayer plr, final String... args) {
Bukkit.getScheduler().runTaskAsynchronously(PlotSquared.getMain(), new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
final ArrayList<String> strings = new ArrayList<String>() { final ArrayList<String> strings = new ArrayList<String>() {
{ {
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.getMain().getDescription().getVersion())); add(String.format("&c>> &6PlotSquared (Version: %s)", PlotSquared.IMP.getVersion()));
add(String.format("&c>> &6Made by Citymonstret and Empire92")); add(String.format("&c>> &6Made by Citymonstret and Empire92"));
add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177")); add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
add(String.format("&c>> &cNewest Version (Spigot): %s", version)); add(String.format("&c>> &cNewest Version (Spigot): %s", version));