Skip to content

Commit

Permalink
Merge pull request #25 from Pishka/log_inil
Browse files Browse the repository at this point in the history
Log inil
  • Loading branch information
1061911 authored Oct 26, 2017
2 parents 6af33af + 5e049ec commit 3f651f8
Show file tree
Hide file tree
Showing 11 changed files with 237 additions and 19 deletions.
2 changes: 1 addition & 1 deletion forge 1.7.10/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ buildscript {

apply plugin: 'forge'

version = "0.7.1.27"
version = "0.7.1.28"
group= "minedonate" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "minedonate"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
public class MineDonate {

public static final String MODID = "MineDonate" ;
public static final String VERSION = "0.7.1.27" ;
public static final String VERSION = "0.7.1.28" ;

public static boolean m_Enabled = false;

Expand Down
28 changes: 20 additions & 8 deletions forge 1.7.10/src/main/java/ru/alastar/minedonate/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import java.awt.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
Expand Down Expand Up @@ -107,7 +108,7 @@ public static boolean classExists ( String name, net . minecraft . launchwrapper

try {

return cl . findResource ( name . replace ( ".", "/" ) . concat ( ".class" ) ) != null ;
return cl . findResource ( name. replace ( ".", "/" ) . concat ( ".class" ) ) != null ;

} catch ( Throwable tw ) { tw . printStackTrace ( ) ; }

Expand Down Expand Up @@ -141,29 +142,40 @@ public static boolean loadLib ( String [ ] args, net . minecraft . launchwrapper

URL url ;

InputStream is = Utils . class . getResourceAsStream ( args [ 1 ] ) ;
InputStream is = Utils . class . getResourceAsStream ( "/" + args [ 1 ] ) ;

if ( is == null ) {

String p = Utils . class . getProtectionDomain ( ) . getCodeSource ( ) . getLocation ( ) . getPath ( ) ;

p = p . split ( "!" ) [ 0 ] ;
p = p . substring ( p . indexOf ( ":/" ) + 2 ) ;

p = ( new File ( p ) . getParentFile ( ) . getAbsolutePath ( ) + File . separator + "libs" + File . separator + args [ 1 ] ) ;

p = ( new File ( p ) . getParentFile ( ) . getAbsolutePath ( ) + File . separator + "libs" + File . separator + args [ 1 ] ) ;

File f = new File ( p ) ;

if ( ! f . exists ( ) ) {

throw new FileNotFoundException ( ) ;

}

url = new File ( p ) . toURI ( ) . toURL ( ) ;

} else {

url = Utils . class . getResource ( args [ 1 ] ) ;
url = Utils . class . getResource ( "/" + args [ 1 ] ) ;

is . close ( ) ;

}
System.err.println(url);
cl . addURL ( url ) ;

for(URL u:cl.getURLs()){
System.err.println(u);
}
} catch ( Exception ex ) {

MineDonate . logError ( "Error load library[" + args [ 1 ] + "]!" ) ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import ru.alastar.minedonate.MineDonate;
import ru.alastar.minedonate.network.packets.BuyResponsePacket;


Expand All @@ -22,7 +23,7 @@ public BuyResponsePacketHandler(){
@Override
public IMessage onMessage ( BuyResponsePacket message, MessageContext ctx ) {

Minecraft . getMinecraft ( ) . thePlayer . addChatMessage ( new ChatComponentText ( EnumChatFormatting . AQUA + " [MineDonate] " + EnumChatFormatting.RESET + message . status ) ) ;
Minecraft . getMinecraft ( ) . thePlayer . addChatMessage ( new ChatComponentText ( EnumChatFormatting . AQUA + " [MineDonate] " + EnumChatFormatting.RESET + MineDonate.cfgUI.lang.get(message . status) ) ) ;

return null ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import ru.alastar.minedonate.MineDonate;
import ru.alastar.minedonate.gui.ShopGUI;
import ru.alastar.minedonate.network.manage.packets.ManageResponsePacket;

Expand All @@ -21,7 +22,7 @@ public IMessage onMessage ( ManageResponsePacket message, MessageContext ctx ) {
ShopGUI . instance . setLoading ( false ) ;
ShopGUI . instance . initGui ( ) ;

Minecraft . getMinecraft ( ) . thePlayer . addChatMessage ( new ChatComponentText ( EnumChatFormatting . AQUA + " [MineDonate] " + EnumChatFormatting.RESET + message.type + "> " + message.code + "> " + message.status ) ) ;
Minecraft . getMinecraft ( ) . thePlayer . addChatMessage ( new ChatComponentText ( EnumChatFormatting . AQUA + " [MineDonate] " + EnumChatFormatting.RESET + MineDonate.cfgUI.lang.get(message.type, message.code, message.status ) ) ) ;

//System.err.println(message.type + "> " + message.code + "> " + message.status );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public class ManageResponsePacket implements IMessage {
public ResponseStatus status ;

public ManageResponsePacket ( ) { }


public ManageResponsePacket ( ResponseType _type, ResponseCode _code, ResponseStatus _status ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ public void drawDebug ( MCGuiAccessible _gs, int mouseX, int mouseY ) {

for ( ContextMenu cmm : menus ) {

cmm . drawDebug ( _gs, mouseX, mouseY ) ;
if ( cmm != null ) {
cmm . drawDebug ( _gs, mouseX, mouseY ) ;
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ public GuiAbstractItemEntry updateDrawData ( ) {

limitLine = MineDonate.cfgUI.cats.entities.itemLeft + info.limit;

ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);
if ( cmm != null ) {
ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);
}

updateDataNeed = true ;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@ public GuiAbstractItemEntry updateDrawData ( ) {
limitLine = MineDonate . cfgUI . cats . itemsAndBlocks . itemLeft + info . limit ;
stackCountLine = Integer . toString ( info . modified * info.stack_data.getInteger("Count") ) ;

ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);

if ( cmm != null ) {
ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);
}

updateDataNeed = true ;

return this ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ public GuiAbstractItemEntry updateDrawData ( ) {

}

ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);

if ( cmm != null ) {
ShopGUI.instance.getContextMenuManager().addNewMenu(cmm);
}

updateDataNeed = true ;

return this ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package ru.log_inil.mc.minedonate.localData.ui;

import java.util.HashMap;
import java.util.Map;

import ru.alastar.minedonate.network.manage.packets.ManageResponsePacket;
import ru.alastar.minedonate.network.manage.packets.ManageResponsePacket.ResponseCode;
import ru.alastar.minedonate.network.manage.packets.ManageResponsePacket.ResponseStatus;
import ru.alastar.minedonate.network.manage.packets.ManageResponsePacket.ResponseType;
import ru.alastar.minedonate.network.packets.BuyResponsePacket;
import ru.alastar.minedonate.network.packets.BuyResponsePacket.Status;

public class DataOfUILang {

public String editEntityMerch ;
Expand All @@ -19,6 +29,8 @@ public class DataOfUILang {
public String shopFreezer ;
public String shopFreezReason ;

public Map < String, String > actions ;

public DataOfUILang ( ) {

editEntityMerch = "Edit this" ;
Expand All @@ -38,7 +50,192 @@ public DataOfUILang ( ) {
shopFreezer = "Freezer: ";
shopFreezReason = "Reason: ";

actions = new HashMap < > ( ) ;

ManageResponsePacket.ResponseType type;
ManageResponsePacket.ResponseCode code;

type = ManageResponsePacket.ResponseType.OBJ;
code = ManageResponsePacket.ResponseCode.ADD;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Added!" ) ;

//

type = ManageResponsePacket.ResponseType.OBJ;
code = ManageResponsePacket.ResponseCode.APPEND;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_CAT_NOTFOUND, "Category not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ENTRY_NOTFOUND, "Object not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Appended!" ) ;

//

type = ManageResponsePacket.ResponseType.SHOP;
code = ManageResponsePacket.ResponseCode.CREATE;

add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_CREATE_BAN, "You banned!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_CREATE_LIMIT, "You can't create many shops!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Created!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;

//

type = ManageResponsePacket.ResponseType.OBJ;
code = ManageResponsePacket.ResponseCode.REMOVE;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_CAT_NOTFOUND, "Category not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ENTRY_NOTFOUND, "Object not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Deleted!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;

//

type = ManageResponsePacket.ResponseType.SHOP;
code = ManageResponsePacket.ResponseCode.REMOVE;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Deleted!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;

//

type = ManageResponsePacket.ResponseType.OBJ;
code = ManageResponsePacket.ResponseCode.EDIT;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_CAT_NOTFOUND, "Category not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ENTRY_NOTFOUND, "Object not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Edited!" ) ;

//

type = ManageResponsePacket.ResponseType.SHOP;
code = ManageResponsePacket.ResponseCode.UNFREEZ;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Unfreezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.ERRROR_ACCOUNT_NO_FREEZED, "Shop no freezed!" ) ;

type = ManageResponsePacket.ResponseType.SHOP;
code = ManageResponsePacket.ResponseCode.FREEZ;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.ERRROR_ACCOUNT_ALREADY_FREEZED, "Shop already freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;

//

type = ManageResponsePacket.ResponseType.ACCOUNT;
code = ManageResponsePacket.ResponseCode.UNFREEZ;

add ( actions, type, code, ResponseStatus.ERROR_ACCOUNT_NOTFOUND, "Account not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Unfreezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERRROR_ACCOUNT_NO_FREEZED, "Account no freezed!" ) ;

type = ManageResponsePacket.ResponseType.ACCOUNT;
code = ManageResponsePacket.ResponseCode.FREEZ;

add ( actions, type, code, ResponseStatus.ERROR_ACCOUNT_NOTFOUND, "Account not found!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.ERRROR_ACCOUNT_ALREADY_FREEZED, "Account already freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;

//

type = ManageResponsePacket.ResponseType.ENTITY;
code = ManageResponsePacket.ResponseCode.ADD;

add ( actions, type, code, ResponseStatus.ENTITY_SELECT_START, "Entity select start!" ) ;
add ( actions, type, code, ResponseStatus.ENTITY_SELECT_STOP, "Entity select stop!" ) ;

//

type = ManageResponsePacket.ResponseType.SHOP;
code = ManageResponsePacket.ResponseCode.RENAME;

add ( actions, type, code, ResponseStatus.ENTITY_SELECT_START, "Entity select start!" ) ;
add ( actions, type, code, ResponseStatus.ENTITY_SELECT_STOP, "Entity select stop!" ) ;

add ( actions, type, code, ResponseStatus.ERROR_SHOP_NOTFOUND, "Shop not found!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_SHOP_FREEZED, "Shop freezed!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_UNKNOWN, "Unknown error!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ACCESS_DENIED, "Access denied!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Renamed!" ) ;

////

//

type = ManageResponsePacket.ResponseType.ENTITY;
code = ManageResponsePacket.ResponseCode.SELECT;

add ( actions, type, code, ResponseStatus.ERROR_ENTITY_CHECK_LIVINGBASE, "No valid entity!" ) ;
add ( actions, type, code, ResponseStatus.ERROR_ENTITY_CHECK_INIT, "Can't init entity object!" ) ;
add ( actions, type, code, ResponseStatus.OK, "Selected!" ) ;

////

actions . put ( "BUY>" + BuyResponsePacket.Status.SUCCESSFUL.name(), "Buyed!" ) ;
actions . put ( "BUY>" + BuyResponsePacket.Status.ERROR_CANT_BUY.name(), "Can't buy!" ) ;
actions . put ( "BUY>" + BuyResponsePacket.Status.ERROR_NOT_ENOUGH_MONEY.name(), "Not enough money!" ) ;
actions . put ( "BUY>" + BuyResponsePacket.Status.ERROR_SHOP_FREEZED.name(), "Shop freezed!" ) ;
actions . put ( "BUY>" + BuyResponsePacket.Status.ERROR_UNKNOWN.name(), "Unknown error!" ) ;

}

public void add ( Map < String, String > m, ManageResponsePacket.ResponseType type, ManageResponsePacket.ResponseCode code, ManageResponsePacket.ResponseStatus status, String text ) {

m . put ( type . name ( ) + ">" + code . name ( ) + ">" + status . name ( ), text ) ;

}

public String get ( ManageResponsePacket.ResponseType type, ManageResponsePacket.ResponseCode code, ManageResponsePacket.ResponseStatus status ) {

String r = actions . get ( type . name ( ) + ">" + code . name ( ) + ">" + status . name ( ) ) ;

if ( r != null ) {

return r ;

}

return type . name ( ) + "> " + code . name ( ) + "> " + status . name ( ) ;

}

public String get ( BuyResponsePacket.Status type ) {

String r = actions . get ( "BUY>" + type . name ( ) ) ;

if ( r != null ) {

return r ;

}

return type . name ( ) ;

}
}

0 comments on commit 3f651f8

Please sign in to comment.