plugin/src/main/java/us/camin/api/events/ChatEvent.java
2023-07-01 19:57:42 +02:00

39 lines
1.3 KiB
Java

package us.camin.api.events;
/*
This file is part of Caminus
Caminus 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.
Caminus 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 Caminus. If not, see <http://www.gnu.org/licenses/>.
*/
import org.json.*;
import java.util.*;
public class ChatEvent extends Event {
public String message;
public String sender;
public static ChatEvent fromJSON(JSONObject obj) throws JSONException {
ChatEvent ret = new ChatEvent();
ret.message = obj.getString("message");
ret.sender = obj.getString("sender");
return ret;
}
public JSONWriter toJSON(JSONWriter writer) throws JSONException {
writer.key("message").value(this.message);
writer.key("sender").value(this.sender);
return writer;
}
public String jsonName() { return "chat"; }
static { Event.registerHandler("chat", ChatEvent.class); }
}