Commit c572dcda authored by Harmonic's avatar Harmonic

Added Staff Chat by Beny

parent 7d1f069a
Name: Staff Chat
Author: Beny
This plugin allows staff members to see a chat window to communicate with other staff members through group chat in PM.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.krews.plugins</groupId>
<artifactId>staffchat</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>com.eu.habbo</groupId>
<artifactId>Habbo</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
Name: Staff Chat
Author: Beny
This plugin allows staff members to see a chat window to communicate with other staff members through group chat in PM.
package org.krews.plugins.staffchat;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.plugin.EventHandler;
import com.eu.habbo.plugin.EventListener;
import com.eu.habbo.plugin.HabboPlugin;
import com.eu.habbo.plugin.events.users.UserLoginEvent;
/**
* @author Beny.
*/
public class Main extends HabboPlugin implements EventListener {
@Override
public void onEnable() {
Emulator.getPluginManager().registerEvents(this, this);
}
public void onDisable() throws Exception {
}
public boolean hasPermission(Habbo habbo, String s) {
return false;
}
@EventHandler
public static void onUserLoginEvent(UserLoginEvent event) throws Exception {
if(event.habbo.hasPermission("acc_staff_chat")) {
StaffChatBuddy buddy = new StaffChatBuddy(-1, "Staff Chat", "", (short) 0, event.habbo.getHabboInfo().getId());
buddy.setLook("ADM");
buddy.setOnline(true);
event.habbo.getMessenger().addBuddy(buddy);
}
}
}
package org.krews.plugins.staffchat;
import com.eu.habbo.Emulator;
import com.eu.habbo.habbohotel.commands.CommandHandler;
import com.eu.habbo.habbohotel.messenger.Message;
import com.eu.habbo.habbohotel.messenger.MessengerBuddy;
import com.eu.habbo.habbohotel.users.Habbo;
import com.eu.habbo.habbohotel.users.HabboGender;
import com.eu.habbo.messages.ServerMessage;
import com.eu.habbo.messages.outgoing.friends.FriendChatMessageComposer;
/**
* @author Beny.
*/
public class StaffChatBuddy extends MessengerBuddy {
public StaffChatBuddy(int id, String username, String look, Short relation, int userOne) {
super(id, username, look, relation, userOne);
}
@Override
public void run() {
}
@Override
public void onMessageReceived(Habbo from, String message) {
if(message.startsWith(":"))
{
CommandHandler.handleCommand(from.getClient(), message);
return;
}
Message chatMessage = new Message(from.getHabboInfo().getId(), this.getId(), message);
Emulator.getGameServer().getGameClientManager().sendBroadcastResponse(new FriendChatMessageComposer(chatMessage, this.getId(), from.getHabboInfo().getId()).compose(), "acc_staff_chat", from.getClient());
}
@Override
public void serialize(ServerMessage message) {
message.appendInt(this.getId());
message.appendString(this.getUsername());
message.appendInt(this.getGender().equals(HabboGender.M) ? 0 : 1);
message.appendBoolean(true);
message.appendBoolean(false); //IN ROOM
message.appendString(this.getLook());
message.appendInt(0);
message.appendString("");
message.appendString("");
message.appendString("");
message.appendBoolean(true); //Offline messaging.
message.appendBoolean(false);
message.appendBoolean(false);
message.appendShort(0);
}
}
{
"main" : "org.krews.plugins.staffchat.Main",
"name" : "Staff Chat",
"author" : "Krews.org"
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment