-
-
Notifications
You must be signed in to change notification settings - Fork 771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PlayerPlotChatEvent #3735
base: main
Are you sure you want to change the base?
Add PlayerPlotChatEvent #3735
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* PlotSquared, a land and world management plugin for Minecraft. | ||
* Copyright (C) IntellectualSites <https://intellectualsites.com> | ||
* Copyright (C) IntellectualSites team and contributors | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
package com.plotsquared.core.events; | ||
|
||
import com.plotsquared.core.player.PlotPlayer; | ||
import com.plotsquared.core.plot.Plot; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* @since TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add since todo to the added methods too. |
||
*/ | ||
public class PlayerPlotChatEvent extends PlotEvent implements CancellablePlotEvent { | ||
|
||
private final PlotPlayer<?> player; | ||
private final String message; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe rather use an adventure component for the message? |
||
private final Set<PlotPlayer<?>> recipients; | ||
private final Set<PlotPlayer<?>> spies; | ||
private Result eventResult; | ||
|
||
public PlayerPlotChatEvent( | ||
PlotPlayer<?> player, | ||
Plot plot, | ||
String message, | ||
Set<PlotPlayer<?>> recipients, | ||
Set<PlotPlayer<?>> spies | ||
) { | ||
super(plot); | ||
this.player = player; | ||
this.message = message; | ||
this.recipients = recipients; | ||
this.spies = spies; | ||
} | ||
|
||
/** | ||
* The player that sent the message. | ||
* | ||
* @return PlotPlayer | ||
*/ | ||
public PlotPlayer<?> getPlayer() { | ||
return this.player; | ||
} | ||
|
||
/** | ||
* The message that was sent. | ||
* | ||
* @return String | ||
*/ | ||
public String getMessage() { | ||
return this.message; | ||
} | ||
|
||
/** | ||
* The message recipients. | ||
* | ||
* @return Set of PlotPlayer | ||
*/ | ||
public Set<PlotPlayer<?>> getRecipients() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should be documented that
Also, the |
||
return this.recipients; | ||
} | ||
|
||
/** | ||
* The message spies. | ||
* | ||
* @return Set of PlotPlayer | ||
*/ | ||
public Set<PlotPlayer<?>> getSpies() { | ||
return this.spies; | ||
} | ||
|
||
@Override | ||
public Result getEventResult() { | ||
return this.eventResult; | ||
} | ||
|
||
@Override | ||
public void setEventResult(final Result eventResult) { | ||
this.eventResult = eventResult; | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -27,6 +27,7 @@ | |||||||
import com.plotsquared.core.events.PlayerClaimPlotEvent; | ||||||||
import com.plotsquared.core.events.PlayerEnterPlotEvent; | ||||||||
import com.plotsquared.core.events.PlayerLeavePlotEvent; | ||||||||
import com.plotsquared.core.events.PlayerPlotChatEvent; | ||||||||
import com.plotsquared.core.events.PlayerPlotDeniedEvent; | ||||||||
import com.plotsquared.core.events.PlayerPlotHelperEvent; | ||||||||
import com.plotsquared.core.events.PlayerPlotTrustedEvent; | ||||||||
|
@@ -80,6 +81,7 @@ | |||||||
|
||||||||
import java.util.ArrayList; | ||||||||
import java.util.List; | ||||||||
import java.util.Set; | ||||||||
import java.util.UUID; | ||||||||
|
||||||||
@DoNotUse | ||||||||
|
@@ -241,6 +243,22 @@ public PlayerLeavePlotEvent callLeave(PlotPlayer<?> player, Plot plot) { | |||||||
return event; | ||||||||
} | ||||||||
|
||||||||
/** | ||||||||
* @since TODO | ||||||||
*/ | ||||||||
Comment on lines
+246
to
+248
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is an internal class. |
||||||||
public PlayerPlotChatEvent callChat( | ||||||||
PlotPlayer<?> player, | ||||||||
Plot plot, | ||||||||
String message, | ||||||||
Set<PlotPlayer<?>> recipients, | ||||||||
Set<PlotPlayer<?>> spies | ||||||||
) { | ||||||||
PlayerPlotChatEvent event = new PlayerPlotChatEvent(player, plot, message, recipients, spies); | ||||||||
callEvent(event); | ||||||||
return event; | ||||||||
} | ||||||||
|
||||||||
|
||||||||
public PlayerPlotDeniedEvent callDenied( | ||||||||
PlotPlayer<?> initiator, Plot plot, UUID player, | ||||||||
boolean added | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
!force
, as the plot chat should happen if the result isFORCE