Skip to content

Commit ab1468d

Browse files
committed
Changes to bedrock player support
1 parent 3c65365 commit ab1468d

File tree

7 files changed

+22
-44
lines changed

7 files changed

+22
-44
lines changed

VotingPlugin/Resources/Config.yml

+5-7
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,11 @@ UseVoteStreaks: true
530530
# If false, storing best totals will be disabled
531531
UseHighestTotals: true
532532

533-
# Enable Geyser prefix support
534-
# May take time before geyser players can vote properly
535-
# If players vote with prefix, then this is probably not needed and
536-
# may work better disabled
537-
# Geyser support is currently hit or miss
538-
GeyserPrefixSupport: false
539-
GeyserPrefix: '*'
533+
# Geyser/Bedrock player support
534+
# Set prefix used for voting
535+
# Players should vote with prefix
536+
# https://github.com/BenCodez/VotingPlugin/wiki/Bedrock-Player-Support
537+
BedrockPlayerPrefix: '.'
540538

541539
# Whether or not to create daily backups. (Only the most recent ones get kept)
542540
CreateBackups: true

VotingPlugin/Resources/bungeeconfig.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,9 @@ BungeeManageTotals: true
106106
# Set DisableBroadcast to true on spigot servers (BungeeSettings.yml) as well
107107
Broadcast: true
108108

109-
# Geyser settings
110-
# This may or may not work
111-
# Does not work on velocity currently
112-
GeyserSupport: false
113-
GeyserPrefix: '.'
109+
# Geyser/bedrock player settings
110+
# https://github.com/BenCodez/VotingPlugin/wiki/Bedrock-Player-Support
111+
BedrockPlayerPrefix: '.'
114112

115113
# Time votes will be cached on proxy
116114
# -1 means no time limit

VotingPlugin/src/com/bencodez/votingplugin/VotingPluginMetrics.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,11 @@ public String call() throws Exception {
324324
}
325325
}));
326326

327-
metrics.addCustomChart(new BStatsMetrics.SimplePie("geyserprefixsupport", new Callable<String>() {
327+
metrics.addCustomChart(new BStatsMetrics.SimplePie("bedrockplayerprefix", new Callable<String>() {
328328

329329
@Override
330330
public String call() throws Exception {
331-
return "" + plugin.getOptions().isGeyserPrefixSupport();
331+
return "" + plugin.getOptions().getBedrockPlayerPrefix();
332332
}
333333
}));
334334

VotingPlugin/src/com/bencodez/votingplugin/bungee/Config.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,8 @@ public boolean getBroadcast() {
3737
return getData().getBoolean("Broadcast", false);
3838
}
3939

40-
public boolean getGeyserSupport() {
41-
return getData().getBoolean("GeyserSupport", false);
42-
}
43-
44-
public String getGeyserPrefix() {
45-
return getData().getString("GeyserPrefix", ".");
40+
public String getBedrockPlayerPrefix() {
41+
return getData().getString("BedrockPlayerPrefix", ".");
4642
}
4743

4844
public boolean getOnlineMode() {

VotingPlugin/src/com/bencodez/votingplugin/bungee/VotingPluginBungee.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -1211,15 +1211,10 @@ public synchronized void vote(String player, String service, boolean realVote, b
12111211
}
12121212

12131213
if (uuid.isEmpty()) {
1214-
if (config.getGeyserSupport()) {
1215-
if (!player.startsWith(config.getGeyserPrefix())) {
1216-
uuid = getUUID(config.getGeyserPrefix() + player);
1217-
player = config.getGeyserPrefix() + player;
1218-
}
1214+
if (player.startsWith(config.getBedrockPlayerPrefix())) {
1215+
getLogger().info("Ignoring vote since unable to get UUID of bedrock player");
1216+
return;
12191217
}
1220-
}
1221-
1222-
if (uuid.isEmpty()) {
12231218
if (config.getAllowUnJoined()) {
12241219
debug("Fetching UUID online, since allowunjoined is enabled");
12251220
UUID u = null;

VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/Config.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,12 @@ public boolean getMultiProxyOneGlobalReward() {
141141
return getBoolean(getNode("MultiProxyOneGlobalReward"), false);
142142
}
143143

144-
public boolean getGeyserSupport() {
145-
return getBoolean(getNode("GeyserSupport"), false);
146-
}
147-
148144
public boolean getPrimaryServer() {
149145
return getBoolean(getNode("PrimaryServer"), false);
150146
}
151147

152-
public String getGeyserPrefix() {
153-
return getString(getNode("GeyserPrefix"), "*");
148+
public String getBedrockPlayerPrefix() {
149+
return getString(getNode("BedrockPlayerPrefix"), ".");
154150
}
155151

156152
public ConfigurationNode getMultiProxyServers(String s) {

VotingPlugin/src/com/bencodez/votingplugin/bungee/velocity/VotingPluginVelocity.java

+5-10
Original file line numberDiff line numberDiff line change
@@ -1247,17 +1247,12 @@ public synchronized void vote(String player, String service, boolean realVote, b
12471247
uuid = getUUID(player);
12481248
}
12491249

1250-
if (uuid.isEmpty()) {
1251-
if (config.getGeyserSupport()) {
1252-
if (!player.startsWith(config.getGeyserPrefix())) {
1253-
uuid = getUUID(config.getGeyserPrefix() + player);
1254-
player = config.getGeyserPrefix() + player;
1255-
}
1256-
}
1257-
}
1258-
12591250
if (uuid.isEmpty()) {
12601251
if (config.getAllowUnJoined()) {
1252+
if (player.startsWith(config.getBedrockPlayerPrefix())) {
1253+
logger.info("Ignoring vote since unable to get UUID of bedrock player");
1254+
return;
1255+
}
12611256
debug("Fetching UUID online, since allowunjoined is enabled");
12621257
UUID u = null;
12631258
try {
@@ -1303,7 +1298,7 @@ public synchronized void vote(String player, String service, boolean realVote, b
13031298
int dailyTotal = getValue(data, "DailyTotal", 1);
13041299
int points = getValue(data, "Points", getConfig().getPointsOnVote());
13051300
int milestoneCount = getValue(data, "MilestoneCount", 1);
1306-
1301+
13071302
int maxVotes = getConfig().getMaxAmountOfVotesPerDay();
13081303
if (maxVotes > 0) {
13091304
LocalDateTime cTime = getBungeeTimeChecker().getTime();

0 commit comments

Comments
 (0)