Make /plot rate GUI items customizable

Bye bye legacy items :)
This commit is contained in:
NotMyFault 2021-05-21 16:48:34 +02:00
parent 7775cd0073
commit 17f91c8eb9
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
3 changed files with 19 additions and 41 deletions

View File

@ -177,17 +177,6 @@ public class Rate extends SubCommand {
TranslatableCaption.of("ratings.rating_applied"),
Template.of("plot", plot.getId().toString())
);
if (Permissions
.hasPermission(this.getPlayer(), Permission.PERMISSION_COMMENT)) {
Command command =
MainCommand.getInstance().getCommand(Comment.class);
if (command != null) {
getPlayer().sendMessage(
TranslatableCaption.of("tutorial.comment_this"),
Template.of("plot", "/plot rate")
);
}
}
}
return false;
}
@ -195,15 +184,15 @@ public class Rate extends SubCommand {
return true;
}
};
inventory.setItem(0, new PlotItemStack(35, (short) 12, 0, "0/8"));
inventory.setItem(1, new PlotItemStack(35, (short) 14, 1, "1/8"));
inventory.setItem(2, new PlotItemStack(35, (short) 1, 2, "2/8"));
inventory.setItem(3, new PlotItemStack(35, (short) 4, 3, "3/8"));
inventory.setItem(4, new PlotItemStack(35, (short) 5, 4, "4/8"));
inventory.setItem(5, new PlotItemStack(35, (short) 9, 5, "5/8"));
inventory.setItem(6, new PlotItemStack(35, (short) 11, 6, "6/8"));
inventory.setItem(7, new PlotItemStack(35, (short) 10, 7, "7/8"));
inventory.setItem(8, new PlotItemStack(35, (short) 2, 8, "8/8"));
inventory.setItem(0, new PlotItemStack(Settings.Ratings.BLOCK_0, 0, "0/8"));
inventory.setItem(1, new PlotItemStack(Settings.Ratings.BLOCK_1, 1, "1/8"));
inventory.setItem(2, new PlotItemStack(Settings.Ratings.BLOCK_2, 2, "2/8"));
inventory.setItem(3, new PlotItemStack(Settings.Ratings.BLOCK_3, 3, "3/8"));
inventory.setItem(4, new PlotItemStack(Settings.Ratings.BLOCK_4, 4, "4/8"));
inventory.setItem(5, new PlotItemStack(Settings.Ratings.BLOCK_5, 5, "5/8"));
inventory.setItem(6, new PlotItemStack(Settings.Ratings.BLOCK_6, 6, "6/8"));
inventory.setItem(7, new PlotItemStack(Settings.Ratings.BLOCK_7, 7, "7/8"));
inventory.setItem(8, new PlotItemStack(Settings.Ratings.BLOCK_8, 8, "8/8"));
inventory.openInventory();
}
};

View File

@ -609,6 +609,16 @@ public class Settings extends Config {
public static boolean USE_LIKES = false;
@Comment("Rating categories")
public static List<String> CATEGORIES = new ArrayList<>();
@Comment("The blocks to use for the rating GUI if categories are set above")
public static String BLOCK_0 = "brown_wool";
public static String BLOCK_1 = "red_wool";
public static String BLOCK_2 = "orange_wool";
public static String BLOCK_3 = "yellow_wool";
public static String BLOCK_4 = "lime_wool";
public static String BLOCK_5 = "cyan_wool";
public static String BLOCK_6 = "blue_wool";
public static String BLOCK_7 = "purple_wool";
public static String BLOCK_8 = "magenta_wool";
}

View File

@ -28,7 +28,6 @@ package com.plotsquared.core.plot;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import com.sk89q.worldedit.world.registry.LegacyMapper;
public class PlotItemStack {
@ -37,26 +36,6 @@ public class PlotItemStack {
private final String[] lore;
private final ItemType type;
/**
* @param id Legacy numerical item ID
* @param data Legacy numerical item data
* @param amount Amount of items in the stack
* @param name The display name of the item stack
* @param lore The item stack lore
* @deprecated Use {@link #PlotItemStack(String, int, String, String...)}
*/
@Deprecated
public PlotItemStack(
final int id, final short data, final int amount,
final String name, final String... lore
) {
this.amount = amount;
this.name = name;
this.lore = lore;
this.type = LegacyMapper.getInstance().getItemFromLegacy(id, data);
}
/**
* @param id String ID
* @param amount Amount of items in the stack