Skip to content

Commit 1fd8dfc

Browse files
committed
[TODO]New language system + Adventure chat
1 parent f611d42 commit 1fd8dfc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1937
-1689
lines changed

src/main/java/org/maxgamer/quickshop/QuickShop.java

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
3131
import org.apache.commons.lang.StringUtils;
3232
import org.bukkit.Bukkit;
33-
import org.bukkit.ChatColor;
3433
import org.bukkit.OfflinePlayer;
3534
import org.bukkit.command.PluginCommand;
3635
import org.bukkit.configuration.ConfigurationSection;
@@ -47,9 +46,9 @@
4746
import org.jetbrains.annotations.NotNull;
4847
import org.jetbrains.annotations.Nullable;
4948
import org.maxgamer.quickshop.api.QuickShopAPI;
50-
import org.maxgamer.quickshop.chat.QuickChat;
51-
import org.maxgamer.quickshop.chat.QuickChatType;
52-
import org.maxgamer.quickshop.chat.platform.minedown.AdventureQuickChat;
49+
//import org.maxgamer.quickshop.chat.QuickChat;
50+
//import org.maxgamer.quickshop.chat.QuickChatType;
51+
//import org.maxgamer.quickshop.chat.platform.minedown.AdventureQuickChat;
5352
import org.maxgamer.quickshop.command.CommandManager;
5453
import org.maxgamer.quickshop.database.*;
5554
import org.maxgamer.quickshop.economy.*;
@@ -67,6 +66,7 @@
6766
import org.maxgamer.quickshop.util.compatibility.CompatibilityManager;
6867
import org.maxgamer.quickshop.util.config.ConfigProvider;
6968
import org.maxgamer.quickshop.util.envcheck.*;
69+
import org.maxgamer.quickshop.util.language.text.TextManager;
7070
import org.maxgamer.quickshop.util.matcher.item.BukkitItemMatcherImpl;
7171
import org.maxgamer.quickshop.util.matcher.item.ItemMatcher;
7272
import org.maxgamer.quickshop.util.matcher.item.QuickShopItemMatcherImpl;
@@ -238,8 +238,8 @@ public class QuickShop extends JavaPlugin {
238238
DisplayDupeRemoverWatcher displayDupeRemoverWatcher;
239239
@Getter
240240
private boolean enabledAsyncDisplayDespawn;
241-
@Getter
242-
private String previewProtectionLore;
241+
// @Getter
242+
// private String previewProtectionLore;
243243
@Getter
244244
private Plugin blockHubPlugin;
245245
@Getter
@@ -255,22 +255,24 @@ public class QuickShop extends JavaPlugin {
255255
private UpdateWatcher updateWatcher;
256256
@Getter
257257
private BuildInfo buildInfo;
258-
@Getter
259-
private QuickChatType quickChatType = QuickChatType.ADVENTURE;
260-
@Getter
261-
private QuickChat quickChat = new AdventureQuickChat();
258+
// @Getter
259+
// private QuickChatType quickChatType = QuickChatType.ADVENTURE;
260+
// @Getter
261+
// private QuickChat quickChat = new AdventureQuickChat();
262262
@Getter
263263
@Nullable
264264
private String currency = null;
265-
@Getter
266-
private ShopControlPanel shopControlPanelManager;
265+
// @Getter
266+
// private ShopControlPanel shopControlPanelManager;
267267
@Getter
268268
private CalendarWatcher calendarWatcher;
269269
@Getter
270270
private Plugin worldEditPlugin;
271271
@Getter
272272
private WorldEditAdapter worldEditAdapter;
273273
private BukkitAudiences adventure;
274+
@Getter
275+
private final TextManager textManager = new TextManager(this);
274276

275277
/**
276278
* Use for mock bukkit
@@ -542,8 +544,8 @@ public void reloadConfig() {
542544
this.priceChangeRequiresFee = this.getConfig().getBoolean("shop.price-change-requires-fee");
543545
this.displayItemCheckTicks = this.getConfig().getInt("shop.display-items-check-ticks");
544546
this.allowStack = this.getConfig().getBoolean("shop.allow-stacks");
545-
this.quickChatType = QuickChatType.fromID(this.getConfig().getInt("chat-type"));
546-
this.quickChat = QuickChatType.createByType(this.quickChatType);
547+
// this.quickChatType = QuickChatType.fromID(this.getConfig().getInt("chat-type"));
548+
// this.quickChat = QuickChatType.createByType(this.quickChatType);
547549
this.currency = this.getConfig().getString("currency");
548550
if (StringUtils.isEmpty(this.currency)) {
549551
this.currency = null;
@@ -787,8 +789,8 @@ public final void onEnable() {
787789
getLogger().info("Original author: Netherfoam, Timtower, KaiNoMood");
788790
getLogger().info("Let's start loading the plugin");
789791
this.adventure = BukkitAudiences.create(this);
790-
getLogger().info("Chat processor selected: " + this.quickChatType.name());
791-
792+
//getLogger().info("Chat processor selected: " + this.quickChatType.name());
793+
getLogger().info("Chat processor selected: Hardcoded Adventure Lib");
792794
/* Process Metrics and Sentry error reporter. */
793795
metrics = new Metrics(this, 3320);
794796

@@ -814,11 +816,11 @@ public final void onEnable() {
814816
MsgUtil.loadItemi18n();
815817
MsgUtil.loadEnchi18n();
816818
MsgUtil.loadPotioni18n();
817-
shopControlPanelManager = new ShopControlPanel(this);
818-
this.previewProtectionLore = MsgUtil.getMessageOfflinePlayer("quickshop-gui-preview", null);
819-
if (this.previewProtectionLore == null || this.previewProtectionLore.isEmpty()) {
820-
this.previewProtectionLore = ChatColor.RED + "FIXME: DON'T SET THIS TO EMPTY STRING";
821-
}
819+
// shopControlPanelManager = new ShopControlPanel(this);
820+
// this.previewProtectionLore = MsgUtil.getMessageOfflinePlayer("quickshop-gui-preview", null);
821+
// if (this.previewProtectionLore == null || this.previewProtectionLore.isEmpty()) {
822+
// this.previewProtectionLore = ChatColor.RED + "FIXME: DON'T SET THIS TO EMPTY STRING";
823+
// }
822824

823825
/* Load 3rd party supports */
824826
load3rdParty();
@@ -1059,7 +1061,7 @@ private void submitMeritcs() {
10591061
metrics.addCustomChart(new Metrics.SimplePie("display_type", () -> DisplayItem.getNowUsing().name()));
10601062
metrics.addCustomChart(new Metrics.SimplePie("itemmatcher_type", () -> this.getItemMatcher().getName()));
10611063
metrics.addCustomChart(new Metrics.SimplePie("use_stack_item", () -> String.valueOf(this.isAllowStack())));
1062-
metrics.addCustomChart(new Metrics.SimplePie("chat_adapter", () -> this.getQuickChatType().name()));
1064+
metrics.addCustomChart(new Metrics.SimplePie("chat_adapter", () -> "Hardcoded Adventure"));
10631065
metrics.addCustomChart(new Metrics.SimplePie("event_adapter", () -> eventAdapter));
10641066
metrics.addCustomChart(new Metrics.SingleLineChart("shops_created_on_all_servers", () -> this.getShopManager().getAllShops().size()));
10651067
// Exp for stats, maybe i need improve this, so i add this.// Submit now!
@@ -1963,4 +1965,8 @@ public void registerCustomCommands() {
19631965
}
19641966
return this.adventure;
19651967
}
1968+
1969+
public @NotNull TextManager text(){
1970+
return textManager;
1971+
}
19661972
}
Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
1-
/*
2-
* This file is a part of project QuickShop, the name is QuickChat.java
3-
* Copyright (C) PotatoCraft Studio and contributors
4-
*
5-
* This program is free software: you can redistribute it and/or modify it
6-
* under the terms of the GNU General Public License as published by the
7-
* Free Software Foundation, either version 3 of the License, or
8-
* (at your option) any later version.
9-
*
10-
* This program is distributed in the hope that it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13-
* for more details.
14-
*
15-
* You should have received a copy of the GNU General Public License
16-
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17-
*
18-
*/
19-
20-
package org.maxgamer.quickshop.chat;
21-
22-
import org.bukkit.command.CommandSender;
23-
import org.bukkit.entity.Player;
24-
import org.bukkit.inventory.ItemStack;
25-
import org.jetbrains.annotations.NotNull;
26-
import org.jetbrains.annotations.Nullable;
27-
import org.maxgamer.quickshop.shop.Shop;
28-
29-
/**
30-
* QuickChat is a system to allow us to processing plain text and also MineDown
31-
*/
32-
public interface QuickChat {
33-
/**
34-
* Send plain text to specified receiver
35-
*
36-
* @param receiver The receiver will receive this message
37-
* @param message The plain text to be sent
38-
*/
39-
void send(@NotNull CommandSender receiver, @Nullable String message);
40-
41-
/**
42-
* Send QuickComponent to specified receiver
43-
*
44-
* @param receiver The receiver will receive this message
45-
* @param component The plain text to be sent
46-
*/
47-
void send(@NotNull CommandSender receiver, @Nullable QuickComponent component);
48-
49-
/**
50-
* Send chat with hover-item to specified receiver
51-
*
52-
* @param player The PLAYER will receive this message
53-
* @param text The text will sent
54-
* @param itemStack The ItemStack will append to text in message
55-
*/
56-
void sendItemHologramChat(
57-
@NotNull Player player,
58-
@NotNull String text,
59-
@NotNull ItemStack itemStack);
60-
61-
@NotNull QuickComponent getItemHologramChat(@NotNull Shop shop, @NotNull ItemStack itemStack, @NotNull Player player, @NotNull String message);
62-
63-
/**
64-
* Create chat with hover-item to specified receiver
65-
*
66-
* @param player The PLAYER will receive this message
67-
* @param text The text will sent
68-
* @param itemStack The ItemStack will append to text in message
69-
* @return The QuickComponent created by this method
70-
*/
71-
@NotNull QuickComponent getItemTextComponent(@NotNull Player player, @NotNull ItemStack itemStack, @NotNull String text);
72-
73-
/**
74-
* Send click-run-command chat to specified receiver
75-
*
76-
* @param receiver The PLAYER will receive this message
77-
* @param message The text will sent
78-
* @param hoverText The will show when hover on chat
79-
* @param command The command when click to be run
80-
*/
81-
void sendExecutableChat(@NotNull CommandSender receiver, @NotNull String message, @NotNull String hoverText, @NotNull String command);
82-
83-
/**
84-
* Send click-suggest-command chat to specified receiver
85-
*
86-
* @param receiver The PLAYER will receive this message
87-
* @param message The text will sent
88-
* @param command The command when click to be suggest
89-
*/
90-
void sendSuggestedChat(@NotNull CommandSender receiver, @NotNull String message, @NotNull String hoverText, @NotNull String command);
91-
92-
}
1+
///*
2+
// * This file is a part of project QuickShop, the name is QuickChat.java
3+
// * Copyright (C) PotatoCraft Studio and contributors
4+
// *
5+
// * This program is free software: you can redistribute it and/or modify it
6+
// * under the terms of the GNU General Public License as published by the
7+
// * Free Software Foundation, either version 3 of the License, or
8+
// * (at your option) any later version.
9+
// *
10+
// * This program is distributed in the hope that it will be useful, but WITHOUT
11+
// * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12+
// * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13+
// * for more details.
14+
// *
15+
// * You should have received a copy of the GNU General Public License
16+
// * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
// *
18+
// */
19+
//
20+
//package org.maxgamer.quickshop.chat;
21+
//
22+
//import org.bukkit.command.CommandSender;
23+
//import org.bukkit.entity.Player;
24+
//import org.bukkit.inventory.ItemStack;
25+
//import org.jetbrains.annotations.NotNull;
26+
//import org.jetbrains.annotations.Nullable;
27+
//import org.maxgamer.quickshop.shop.Shop;
28+
//
29+
///**
30+
// * QuickChat is a system to allow us to processing plain text and also MineDown
31+
// */
32+
//public interface QuickChat {
33+
// /**
34+
// * Send plain text to specified receiver
35+
// *
36+
// * @param receiver The receiver will receive this message
37+
// * @param message The plain text to be sent
38+
// */
39+
// void send(@NotNull CommandSender receiver, @Nullable String message);
40+
//
41+
// /**
42+
// * Send QuickComponent to specified receiver
43+
// *
44+
// * @param receiver The receiver will receive this message
45+
// * @param component The plain text to be sent
46+
// */
47+
// void send(@NotNull CommandSender receiver, @Nullable QuickComponent component);
48+
//
49+
// /**
50+
// * Send chat with hover-item to specified receiver
51+
// *
52+
// * @param player The PLAYER will receive this message
53+
// * @param text The text will sent
54+
// * @param itemStack The ItemStack will append to text in message
55+
// */
56+
// void sendItemHologramChat(
57+
// @NotNull Player player,
58+
// @NotNull String text,
59+
// @NotNull ItemStack itemStack);
60+
//
61+
// @NotNull QuickComponent getItemHologramChat(@NotNull Shop shop, @NotNull ItemStack itemStack, @NotNull Player player, @NotNull String message);
62+
//
63+
// /**
64+
// * Create chat with hover-item to specified receiver
65+
// *
66+
// * @param player The PLAYER will receive this message
67+
// * @param text The text will sent
68+
// * @param itemStack The ItemStack will append to text in message
69+
// * @return The QuickComponent created by this method
70+
// */
71+
// @NotNull QuickComponent getItemTextComponent(@NotNull Player player, @NotNull ItemStack itemStack, @NotNull String text);
72+
//
73+
// /**
74+
// * Send click-run-command chat to specified receiver
75+
// *
76+
// * @param receiver The PLAYER will receive this message
77+
// * @param message The text will sent
78+
// * @param hoverText The will show when hover on chat
79+
// * @param command The command when click to be run
80+
// */
81+
// void sendExecutableChat(@NotNull CommandSender receiver, @NotNull String message, @NotNull String hoverText, @NotNull String command);
82+
//
83+
// /**
84+
// * Send click-suggest-command chat to specified receiver
85+
// *
86+
// * @param receiver The PLAYER will receive this message
87+
// * @param message The text will sent
88+
// * @param command The command when click to be suggest
89+
// */
90+
// void sendSuggestedChat(@NotNull CommandSender receiver, @NotNull String message, @NotNull String hoverText, @NotNull String command);
91+
//
92+
//}

0 commit comments

Comments
 (0)