Skip to content

Commit 3c57e56

Browse files
Merge pull request #26 from ParallelMC/staging
v3.3.0
2 parents ecea470 + db47ed8 commit 3c57e56

29 files changed

+2150
-4
lines changed

api/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
group = 'org.parallelmc'
99

10-
version = '3.2.0'
10+
version = '3.3.0'
1111
description = 'A set of utilities and features for use on the Parallel Minecraft server'
1212

1313
java {
@@ -85,6 +85,11 @@ bukkit {
8585
permissionMessage = 'You do not have permission'
8686
aliases = ['cr',]
8787
}
88+
town {
89+
description = 'Base command for all Town commands'
90+
usage = '/town'
91+
permissionMessage = 'You do not have permission'
92+
}
8893
depositexp {
8994
description = 'Deposit exp into the player\' s ender chest '
9095
usage = '/depositexp <amount | all>'

api/src/main/java/parallelmc/parallelutils/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class Constants {
44

5-
public static final Version VERSION = new Version(3, 2, 0);
5+
public static final Version VERSION = new Version(3, 3, 0);
66
public static final String PLUGIN_NAME = "ParallelUtils";
77
public static final String DEFAULT_WORLD = "world2";
88
}

modules/src/main/java/parallelmc/parallelutils/modules/parallelchat/ParallelChat.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ UUID varchar(36) not null,
259259
puPlugin.getCommand("reloademojis").setExecutor(new ParallelReloadEmojis());
260260

261261
this.chatroomCommands = new ChatroomCommands();
262+
puPlugin.getCommand("chatroom").setExecutor(chatroomCommands);
262263
addChatRoomCommand("create", new ParallelCreateChatroom());
263264
addChatRoomCommand("leave", new ParallelLeaveChatroom());
264265
addChatRoomCommand("join", new ParallelJoinChatroom());
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package parallelmc.parallelutils.modules.paralleltowns;
2+
3+
import org.jetbrains.annotations.NotNull;
4+
5+
import java.util.ArrayList;
6+
import java.util.Arrays;
7+
import java.util.List;
8+
9+
public class Config implements parallelmc.parallelutils.Config {
10+
@NotNull
11+
@Override
12+
public List<String> getHardDepends() {
13+
return List.of("ParallelChat");
14+
}
15+
16+
@NotNull
17+
@Override
18+
public List<String> getSoftDepends() {
19+
return new ArrayList<>();
20+
}
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package parallelmc.parallelutils.modules.paralleltowns;
2+
3+
import org.bukkit.Material;
4+
5+
// an item that is displayed in the town list
6+
// simplifies having to store an ItemStack for this feature
7+
public class DisplayItem {
8+
// the item's material
9+
private Material material;
10+
11+
// if the item has any model data
12+
private int modelData;
13+
14+
public DisplayItem(Material material) {
15+
this.material = material;
16+
this.modelData = -1;
17+
}
18+
19+
public DisplayItem(Material material, int modelData) {
20+
this.material = material;
21+
this.modelData = modelData;
22+
}
23+
24+
public Material getMaterial() {
25+
return material;
26+
}
27+
28+
public void setMaterial(Material material) {
29+
this.material = material;
30+
}
31+
32+
public int getModelData() {
33+
return modelData;
34+
}
35+
36+
public void setModelData(int modelData) {
37+
this.modelData = modelData;
38+
}
39+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
package parallelmc.parallelutils.modules.paralleltowns;
2+
3+
import org.bukkit.OfflinePlayer;
4+
import org.bukkit.entity.Player;
5+
import org.bukkit.inventory.Inventory;
6+
import parallelmc.parallelutils.modules.paralleltowns.gui.*;
7+
8+
import java.util.HashMap;
9+
import java.util.UUID;
10+
11+
12+
// helper class to manage all possible menus and submenus of the town gui
13+
public class GUIManager {
14+
// a list of all players with the towns UI open
15+
private final HashMap<UUID, GUIInventory> openGUIs = new HashMap<>();
16+
17+
public void openMainMenuForPlayer(Player player) {
18+
openInventoryForPlayer(player, new MainMenuInventory());
19+
}
20+
21+
public void openOptionsMenuForPlayer(Player player) {
22+
openInventoryForPlayer(player, new OptionsInventory());
23+
}
24+
25+
public void openMembersMenuForPlayer(Player player) {
26+
openInventoryForPlayer(player, new MembersInventory());
27+
}
28+
29+
public void openMemberOptionsMenuForPlayer(Player player, OfflinePlayer edit) {
30+
openInventoryForPlayer(player, new MemberOptionsInventory(edit));
31+
}
32+
33+
public void openTownConfirmationForPlayer(Player player, Town town, ConfirmationAction action) {
34+
openInventoryForPlayer(player, new ConfirmationInventory(town, action));
35+
}
36+
37+
public void openTownMemberConfirmationForPlayer(Player player, Town town, OfflinePlayer townMember, ConfirmationAction action) {
38+
openInventoryForPlayer(player, new ConfirmationInventory(town, townMember, action));
39+
}
40+
41+
public void openTownListMenuForPlayer(Player player) {
42+
openInventoryForPlayer(player, new TownListInventory());
43+
}
44+
45+
private void openInventoryForPlayer(Player player, GUIInventory type) {
46+
type.onOpen(player);
47+
player.openInventory(type.inventory);
48+
openGUIs.put(player.getUniqueId(), type);
49+
}
50+
51+
public boolean openInventoryExists(Inventory input) {
52+
return openGUIs.values().stream().anyMatch(x -> x.inventory.equals(input));
53+
}
54+
55+
public GUIInventory getOpenInventory(Player player) {
56+
return openGUIs.get(player.getUniqueId());
57+
}
58+
59+
public void closeMenu(Player player) {
60+
openGUIs.remove(player.getUniqueId());
61+
}
62+
}

0 commit comments

Comments
 (0)