Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed default admin password behavior, crouching animation

  • Loading branch information...
commit ee0f06c8c2ec08e8b7683048cf97d75550c2a2c5 1 parent ede3f23
Marko Viitanen authored
7 files/config.cfg
View
@@ -43,8 +43,9 @@ net.port = 25565;
# Server administrator authentication password
# Used for core commands like shutdown and loadplugin
-# NOTE: This is not yet used for anything. Work in progress.
-system.admin.password = "password";
+# using "/auth password" will make you an admin
+# NOTE: default "CHANGEME" is ignored, so change this only if you want to use it.
+system.admin.password = "CHANGEME";
# 0 = Normal Map
# 1 = Nether Map
@@ -71,7 +72,7 @@ strings.server_full = "Server is currently full";
# Physics options (water/lava)
system.physics.enabled = false;
-# Redstone options
+# Redstone options (EXPERIMENTAL)
system.redstone.enabled = true;
# Enable PvP ?
29 include/metadata.h
View
@@ -1,5 +1,32 @@
+/*
+ Copyright (c) 2013, The Mineserver Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the The Mineserver Project nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
#ifndef _METAINFO_H
-#define _MATAINFO_H
+#define _METAINFO_H
#include <vector>
#include "packets.h"
4 include/protocol.h
View
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2012, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -306,7 +306,7 @@ class Protocol
return ret;
}
- static Packet updateHealth(int health, int food=20)
+ static Packet updateHealth(int health, int food=15)
{
Packet ret;
ret << (int8_t)PACKET_UPDATE_HEALTH << (int16_t)health << (int16_t)food << (float)5.0;
2  plugins/commands/commands.cpp
View
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2011, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
31 plugins/flatpermissions/flatpermissions.cpp
View
@@ -5,7 +5,7 @@ g++ -shared flatpermissions.o -o flatpermissions.so
*/
/*
- Copyright (c) 2010, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -56,26 +56,35 @@ void loginPost(const char* userIn){
std::ifstream file;
file.open("permissions.txt", std::ios::in);
std::string line;
- mineserver->logger.log(6, "plugin.flatpermissions", "opening permissions.txt!");
- if(file.is_open()){
- mineserver->logger.log(6, "plugin.flatpermissions", "opened permissions.txt!");
- while(file.good()){
+ if(file.is_open())
+ {
+ while(file.good())
+ {
std::string msg;
std::getline(file, msg);
- if(msg.size()>1){
+ if(msg.size()>1)
+ {
std::string name, rank;
std::istringstream line(msg);
std::getline(line,name,':');
std::getline(line,rank);
- if(name.compare(std::string(userIn))==0){
+ if(name.compare(std::string(userIn))==0)
+ {
std::transform(rank.begin(), rank.end(), rank.begin(), ::tolower);
- if(rank.compare("admin")==0 || rank.compare("admins")==0){
+ if(rank.compare("admin")==0 || rank.compare("admins")==0)
+ {
mineserver->permissions.setAdmin(userIn);
- }else if(rank.compare("op")==0 || rank.compare("ops")==0){
+ }
+ else if(rank.compare("op")==0 || rank.compare("ops")==0)
+ {
mineserver->permissions.setOp(userIn);
- }else if(rank.compare("member")==0 || rank.compare("members")==0){
+ }
+ else if(rank.compare("member")==0 || rank.compare("members")==0)
+ {
mineserver->permissions.setMember(userIn);
- }else{
+ }
+ else
+ {
mineserver->permissions.setGuest(userIn);
}
break;
8 src/chat.cpp
View
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2012, The Mineserver Project
+ Copyright (c) 2013, The Mineserver Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -173,15 +173,15 @@ void Chat::handleCommand(User* user, std::string msg, const std::string& timeSta
std::string command = cmd[0];
cmd.pop_front();
+ //Converting to char* array for plugins
char** param = new char *[cmd.size()];
-
for (uint32_t i = 0; i < cmd.size(); i++)
{
param[i] = (char*)cmd[i].c_str();
}
- // If hardcoded auth command!
- if (command == "auth" && param[0] == ServerInstance->config()->sData("system.admin.password"))
+ // If hardcoded auth command, ignore default password "CHANGEME"
+ if (command == "auth" && cmd[0] != "CHANGEME" && cmd[0] == ServerInstance->config()->sData("system.admin.password"))
{
user->serverAdmin = true;
SET_ADMIN(user->permissions);
15 src/items/food.cpp
View
@@ -2,6 +2,7 @@
#include "packets.h"
#include "protocol.h"
#include "map.h"
+#include "metadata.h"
bool ItemFood::affectedItem(int item) const
{
@@ -50,21 +51,25 @@ void ItemFood::onRightClick(User* user, Item* item)
healammount = 4;
break;
}
+
int newhealth = user->health + healammount;
if (newhealth > 20)
{
newhealth = 20;
}
-
+
user->sethealth(newhealth);
- //ToDo: fix animation
-
//Accept eating
user->buffer << Protocol::entityStatus(user->UID, 9);
- //Eating animation (should work but doesn't)
- Packet pkt = Protocol::animation(user->UID, 5);
+ //Eating animation
+ MetaData meta;
+ MetaDataElemByte *element = new MetaDataElemByte(0,0x10);
+ meta.set(element);
+ Packet pkt = Protocol::animation(user->UID,5);
+ //pkt << Protocol::entityMetadata(user->UID, meta);
+ //ToDo: add timer stop animation
sChunk* chunk = ServerInstance->map(user->pos.map)->getChunk(blockToChunk((int32_t)user->pos.x), blockToChunk((int32_t)user->pos.z));
if (chunk != NULL)
27 src/metadata.cpp
View
@@ -1,3 +1,30 @@
+/*
+ Copyright (c) 2013, The Mineserver Project
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of the The Mineserver Project nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
#include "metadata.h"
void MetaDataElemByte::output(Packet& p) const
12 src/packets.cpp
View
@@ -368,6 +368,8 @@ int PacketHandler::entity_crouch(User* user)
{
int32_t EID;
int8_t action;
+ MetaData meta;
+ MetaDataElemByte *element;
user->buffer >> EID >> action;
Packet pkt;
@@ -377,13 +379,17 @@ int PacketHandler::entity_crouch(User* user)
switch(action)
{
//Crouch
- case 1:
- pkt << Protocol::animation(user->UID, 104);
+ case 1:
+ element = new MetaDataElemByte(0,0x02);
+ meta.set(element);
+ pkt << Protocol::animation(user->UID, 104) << Protocol::entityMetadata(user->UID,meta);
packetData = true;
break;
//Uncrouch
case 2:
- pkt << Protocol::animation(user->UID, 105);
+ element = new MetaDataElemByte(0,0x00);
+ meta.set(element);
+ pkt << Protocol::animation(user->UID, 105) << Protocol::entityMetadata(user->UID,meta);
packetData = true;
break;
default:
3  src/user.cpp
View
@@ -1148,11 +1148,12 @@ void User::checkEnvironmentDamage()
uint8_t type = 0, meta = 0;
int16_t d = 0;
-
+ /*
if (type == BLOCK_CACTUS && LOADBLOCK(pos.x, yVal, pos.z))
{
d = 1;
}
+ */
const double xbit = pos.x - std::floor(pos.x);
const double zbit = pos.z - std::floor(pos.z);
Please sign in to comment.
Something went wrong with that request. Please try again.