Skip to content

Commit

Permalink
[VoteUp] Bug 修复.
Browse files Browse the repository at this point in the history
- 修复了上次更改投票ID格式留下的后遗症。
  • Loading branch information
Polar-Pumpkin committed Mar 3, 2020
1 parent 30c2989 commit f04976f
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>net.shoal.sir</groupId>
<artifactId>VoteUp</artifactId>
<version>1.4.2-RELEASE</version>
<version>1.4.3-RELEASE</version>
<packaging>jar</packaging>

<name>VoteUp</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void report(CacheLogType type, Player user) {

List<String> targetVoteList = new ArrayList<>();
for(String voteID : voteIDList) {
String[] dataSet = voteID.split(".");
String[] dataSet = voteID.split("_");
if (dataSet.length < 2) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/shoal/sir/voteup/config/VoteManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public void vote(String voteID, Player user, String reason, ChoiceType type) {
save(vote.data());
CommonUtil.message(locale.getMessage(VoteUp.LOCALE, MessageType.INFO, "Vote", "Vote." + type.toString()), user.getName());

Player starter = Bukkit.getPlayerExact(voteID.split("//.")[0]);
Player starter = Bukkit.getPlayerExact(voteID.split("_")[0]);
if(starter != null && starter.isOnline()) {
String noticeMsg = locale.getMessage(VoteUp.LOCALE, MessageType.INFO, "Vote", "Voted.Starter")
.replace("%Voter%", user.getName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public String getPromptText(ConversationContext context) {
public Prompt acceptInput(ConversationContext context, String input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected Prompt acceptValidatedInput(ConversationContext context, String input)

locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public SetAmountPrompt(Player player) {
protected Prompt acceptValidatedInput(ConversationContext context, Number input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public String getPromptText(ConversationContext context) {
public Prompt acceptInput(ConversationContext context, String input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected boolean isInputValid(ConversationContext context, String input) {
protected Prompt acceptValidatedInput(ConversationContext context, String input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public String getPromptText(ConversationContext context) {
public Prompt acceptInput(ConversationContext context, String input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String getPromptText(ConversationContext context) {
public Prompt acceptInput(ConversationContext context, String input) {
locale = VoteUp.getInstance().getLocale();

if(!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("//.")[0].equalsIgnoreCase(user.getName())) {
if (!user.hasPermission(VoteUpPerm.ADMIN.perm()) || !voteID.split("_")[0].equalsIgnoreCase(user.getName())) {
CommonUtil.message(locale.buildMessage(VoteUp.LOCALE, MessageType.WARN, "&7权限验证失败, 您不具有修改目标投票内容的权限."), user.getName());
return Prompt.END_OF_CONVERSATION;
}
Expand Down

0 comments on commit f04976f

Please sign in to comment.