Beispiel #1
0
static
bool
cdsurvivalproxy_ClientProcess (CDServer* server, CDClient* client, SVPacket* packet) {
	switch (packet->type) {
		case SVDisconnect: {
			SVPacketDisconnect* data = (SVPacketDisconnect*) packet->data;

			CD_ServerKick(server, client, CD_CloneString(data->request.reason));
		} break;

		case SVListPing: {
			SVPacketDisconnect pkt = {
				.ping = {
				   .description = CD_CreateStringFromCString("Craftd Proxy\u00A70\u00A70")
				}
			};
			SVPacket  packet = { SVPing, SVDisconnect, (CDPointer) &pkt };
			
			cdsurvivalproxy_ClientSendPacket(client, &packet);
		} break;

		default: {
			//send the packet straight to our server
			cdsurvivalproxy_ClientProxyPacket(client, packet);
		}	
	}
	
	//SV_DestroyPacket(packet);
	
	return true;
}
Beispiel #2
0
static
CDString*
cdadmin_ColoredNick (CDPlayer* player) {
	switch (cdadmin_GetPlayerAuthLevel(player)) {
		case CDLevelAdmin: {
			return MC_StringColor(CD_CloneString(player->username), MCColorRed);
		} break;

		case CDLevelModerator: {
			return MC_StringColor(CD_CloneString(player->username), MCColorBlue);
		} break;

		default: {
			return CD_CloneString(player->username);
		}
	}
}
Beispiel #3
0
static
bool
cdsurvivalproxy_ProxyProcess (CDServer* server, CDClient* client, SVPacket* packet) {
	switch (packet->type) {
		case SVDisconnect: {
			SVPacketDisconnect* data = (SVPacketDisconnect*) packet->data;

			CD_ServerKick(server, client, CD_CloneString(data->request.reason));
		} break;

		default: {
			//send the packet straight to our client
			cdsurvivalproxy_ClientSendPacket(client, packet);
		}
	}
	
	return true;
}
Beispiel #4
0
MCString
MC_StringColorRange (MCString self, MCStringColor color, size_t a, size_t b)
{
    if (self->external) {
        CDString* tmp = self;
        self          = CD_CloneString(tmp);
        CD_DestroyString(tmp);
    }

    CDString* start = CD_CreateStringFromFormat("§%x", color);
    CDString* end   = CD_CreateStringFromCString(MC_COLOR_WHITE);

    assert(self);
    assert(a < b);
    assert(a >= 0 && b <= CD_StringLength(self));

    CD_InsertString(self, end, b);
    CD_InsertString(self, start, a);

    CD_DestroyString(start);
    CD_DestroyString(end);

    return self;
}