mirror of
https://github.com/Threnklyn/MinecraftChat.git
synced 2026-05-19 04:43:28 +02:00
Init
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
node_modules/
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/**
|
||||||
|
* chat.alexkvazos.com
|
||||||
|
*
|
||||||
|
* Minecraft web-based chat client
|
||||||
|
* @copyright AlexKvazos 2015
|
||||||
|
*/
|
||||||
|
|
||||||
|
// create new express application
|
||||||
|
var express = require('express');
|
||||||
|
var app = express();
|
||||||
|
var server = require('http').createServer(app);
|
||||||
|
var io = require('socket.io')(server);
|
||||||
|
|
||||||
|
// handle root requests
|
||||||
|
app.get('/', function(req, res, next) {
|
||||||
|
res.sendFile(__dirname + '/views/index.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
// public folder serves static content
|
||||||
|
app.use('/static', express.static('public'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// initialize http and socket servers
|
||||||
|
app.listen(3000, function() {
|
||||||
|
console.log('> Server running on port 3000')
|
||||||
|
});
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
"name": "Chat",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "Minecraft chat client",
|
||||||
|
"main": "app.js",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "^2.1.3",
|
||||||
|
"express": "^4.12.3",
|
||||||
|
"mineflayer": "^1.1.0",
|
||||||
|
"socket.io": "^1.3.5"
|
||||||
|
},
|
||||||
|
"devDependencies": {},
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"start": "node app.js"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git@github.com:MCBoard/chat.alexkvazos.com.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"minecraft",
|
||||||
|
"chat",
|
||||||
|
"client",
|
||||||
|
"web"
|
||||||
|
],
|
||||||
|
"author": "AlexKvazos",
|
||||||
|
"license": "Propietary Software",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/MCBoard/chat.alexkvazos.com/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/MCBoard/chat.alexkvazos.com"
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
body {
|
||||||
|
padding-top: 80px;
|
||||||
|
}
|
||||||
|
#buffer {
|
||||||
|
font-family: 'Source Code Pro';
|
||||||
|
position: absolute;
|
||||||
|
top: 51px;
|
||||||
|
bottom: 40px;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
color: #D6D6D6;
|
||||||
|
padding: 0 20px;
|
||||||
|
}
|
||||||
|
#chat {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 100px;
|
||||||
|
height: 40px;
|
||||||
|
background: #171717;
|
||||||
|
}
|
||||||
|
#send {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 40px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
#chat input {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
width: 100%;
|
||||||
|
height: 40px;
|
||||||
|
padding: 0 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
#chat input:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
#send input {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border: none;
|
||||||
|
background: #264369;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 10px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 100;
|
||||||
|
}
|
||||||
|
#send input:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
var app = angular.module('chat', []);
|
||||||
|
|
||||||
|
$('#buffer').append('<br>');
|
||||||
|
$('#buffer').append('Welcome to AlexKvazos\'s Minecraft Chat App');
|
||||||
|
$('#buffer').append('<br>');
|
||||||
|
$('#buffer').append('> Press connect to connect to a Minecraft server and start chatting!');
|
||||||
|
$('#buffer').append('<br><br>');
|
||||||
|
$('#buffer').append('<i>Note: This application only works with 1.8 Minecraft servers.</i>');
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
|||||||
|
process.env.DEBUG = 'bot';
|
||||||
|
process.stdout.write('\033c');
|
||||||
|
console.log('> MineFlayer Initializing');
|
||||||
|
|
||||||
|
var mineflayer = require('mineflayer');
|
||||||
|
var log = require('debug')('bot');
|
||||||
|
|
||||||
|
var bot = mineflayer.createBot({
|
||||||
|
host: 'play.koonkraft.net',
|
||||||
|
port: 25565,
|
||||||
|
username: 'alexth',
|
||||||
|
password: 'alexth123'
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.on('login', function() {
|
||||||
|
bot.chat('/prison');
|
||||||
|
});
|
||||||
|
|
||||||
|
bot.on('message', function(message) {
|
||||||
|
var buffer = '';
|
||||||
|
message.extra.forEach(function(data) {
|
||||||
|
var text = data.text;
|
||||||
|
if (text) {
|
||||||
|
text = text.replace(/§k/ig, '');
|
||||||
|
text = text.replace(/§l/ig, '');
|
||||||
|
buffer += text;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
buffer = buffer.replace(/§([0-9abcdef])([^§]*)/ig, function replace(x, y, z) {
|
||||||
|
return '<span class="color-'+y+'">'+z+'</span>';
|
||||||
|
});
|
||||||
|
process.stdout.write(buffer + '<br>\n');
|
||||||
|
});
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Minecraft Chat | AlexKvazos</title>
|
||||||
|
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
|
||||||
|
<link rel="stylesheet" href="//bootswatch.com/cyborg/bootstrap.min.css">
|
||||||
|
<link rel="stylesheet" href="/static/css/style.css">
|
||||||
|
</head>
|
||||||
|
<body ng-app="chat">
|
||||||
|
|
||||||
|
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
|
||||||
|
<a class="navbar-brand" href="/">Minecraft Chat</a>
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="#" data-toggle="modal" data-target="#connectModal">Connect</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav pull-right">
|
||||||
|
<li><a style="color:#9E0F06">Not Connected</a></li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="buffer">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form>
|
||||||
|
<div id="chat">
|
||||||
|
<input type="text" ng-model="chat" placeholder="Type to chat...">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="send">
|
||||||
|
<input type="submit" value="Chat">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- Modal -->
|
||||||
|
<div class="modal fade" id="connectModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel">Connect to Minecraft server</h4>
|
||||||
|
<p>This application only works with 1.8 Minecraft servers.</p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Minecraft Username</label>
|
||||||
|
<input type="text" ng-model="username" class="form-control" placeholder="Steve">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Minecraft Password</label>
|
||||||
|
<input type="password" ng-model="password" class="form-control" placeholder="">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Server IP</label>
|
||||||
|
<input type="password" ng-model="ip" class="form-control" placeholder="mc.server.com">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Server Port (Leave empty if unknown)</label>
|
||||||
|
<input type="password" ng-model="port" class="form-control" placeholder="25565">
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-primary" data-dismiss="modal">Connect</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
|
||||||
|
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
|
||||||
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
|
||||||
|
<script src="/static/js/lib/socket.io.js"></script>
|
||||||
|
<script src="/static/js/app.js"></script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user