Merged with released L2J-Unity files.
This commit is contained in:
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/AccessLevel.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/AccessLevel.java
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class AccessLevel implements ITelnetCommand
|
||||
{
|
||||
private AccessLevel()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "accesslevel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "AccessLevel <player name> <access level>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length < 2) || args[0].isEmpty() || !Util.isDigit(args[1]))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(args[0]);
|
||||
if (player != null)
|
||||
{
|
||||
final int level = Integer.parseInt(args[1]);
|
||||
player.setAccessLevel(level, true, true);
|
||||
return "Player " + player.getName() + "'s access level has been changed to: " + level;
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new AccessLevel());
|
||||
}
|
||||
}
|
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Ban.java
vendored
Normal file
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Ban.java
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Ban implements ITelnetCommand
|
||||
{
|
||||
private Ban()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "ban";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Ban <player name> [time in minutes]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.BAN))
|
||||
{
|
||||
return "Player is already banned.";
|
||||
}
|
||||
long time = -1;
|
||||
String reason = "You have been banned by telnet admin.";
|
||||
if (args.length > 1)
|
||||
{
|
||||
final String token = args[1];
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
reason = args[2];
|
||||
for (int i = 3; i < args.length; i++)
|
||||
{
|
||||
reason += " " + args[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objectId, PunishmentAffect.CHARACTER, PunishmentType.BAN, time, reason, "Telnet Admin"));
|
||||
return "Player has been successfully banned.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Ban());
|
||||
}
|
||||
}
|
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/BanChat.java
vendored
Normal file
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/BanChat.java
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author lion
|
||||
*/
|
||||
public class BanChat implements ITelnetCommand
|
||||
{
|
||||
private BanChat()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "ban_chat";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "ban_chat <player name> [time in minutes]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN))
|
||||
{
|
||||
return "Player is already chat banned.";
|
||||
}
|
||||
long time = -1;
|
||||
String reason = "Your chat have been banned by telnet admin.";
|
||||
if (args.length > 1)
|
||||
{
|
||||
final String token = args[1];
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
reason = args[2];
|
||||
for (int i = 3; i < args.length; i++)
|
||||
{
|
||||
reason += " " + args[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objectId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN, time, reason, "Telnet Admin"));
|
||||
return "Player has been successfully banned.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new BanChat());
|
||||
}
|
||||
}
|
176
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Enchant.java
vendored
Normal file
176
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Enchant.java
vendored
Normal file
@@ -0,0 +1,176 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.GMAudit;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Enchant implements ITelnetCommand
|
||||
{
|
||||
private Enchant()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "enchant";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Enchant <player name> <item id> [item amount] [item enchant]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length < 3) || args[0].isEmpty() || !Util.isDigit(args[1]) || !Util.isDigit(args[2]))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(args[0]);
|
||||
if (player != null)
|
||||
{
|
||||
int itemType = Integer.parseInt(args[1]);
|
||||
int enchant = Integer.parseInt(args[2]);
|
||||
enchant = Math.min(enchant, 127);
|
||||
enchant = Math.max(enchant, 0);
|
||||
|
||||
switch (itemType)
|
||||
{
|
||||
case 1:
|
||||
itemType = Inventory.PAPERDOLL_HEAD;
|
||||
break;
|
||||
case 2:
|
||||
itemType = Inventory.PAPERDOLL_CHEST;
|
||||
break;
|
||||
case 3:
|
||||
itemType = Inventory.PAPERDOLL_GLOVES;
|
||||
break;
|
||||
case 4:
|
||||
itemType = Inventory.PAPERDOLL_FEET;
|
||||
break;
|
||||
case 5:
|
||||
itemType = Inventory.PAPERDOLL_LEGS;
|
||||
break;
|
||||
case 6:
|
||||
itemType = Inventory.PAPERDOLL_RHAND;
|
||||
break;
|
||||
case 7:
|
||||
itemType = Inventory.PAPERDOLL_LHAND;
|
||||
break;
|
||||
case 8:
|
||||
itemType = Inventory.PAPERDOLL_LEAR;
|
||||
break;
|
||||
case 9:
|
||||
itemType = Inventory.PAPERDOLL_REAR;
|
||||
break;
|
||||
case 10:
|
||||
itemType = Inventory.PAPERDOLL_LFINGER;
|
||||
break;
|
||||
case 11:
|
||||
itemType = Inventory.PAPERDOLL_RFINGER;
|
||||
break;
|
||||
case 12:
|
||||
itemType = Inventory.PAPERDOLL_NECK;
|
||||
break;
|
||||
case 13:
|
||||
itemType = Inventory.PAPERDOLL_UNDER;
|
||||
break;
|
||||
case 14:
|
||||
itemType = Inventory.PAPERDOLL_CLOAK;
|
||||
break;
|
||||
case 15:
|
||||
itemType = Inventory.PAPERDOLL_BELT;
|
||||
break;
|
||||
default:
|
||||
itemType = 0;
|
||||
break;
|
||||
}
|
||||
final boolean success = setEnchant(player, enchant, itemType);
|
||||
return success ? "Item has been successfully enchanted." : "Failed to enchant player's item!";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
private boolean setEnchant(L2PcInstance activeChar, int ench, int armorType)
|
||||
{
|
||||
// now we need to find the equipped weapon of the targeted character...
|
||||
int curEnchant = 0; // display purposes only
|
||||
L2ItemInstance itemInstance = null;
|
||||
|
||||
// only attempt to enchant if there is a weapon equipped
|
||||
L2ItemInstance parmorInstance = activeChar.getInventory().getPaperdollItem(armorType);
|
||||
if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == armorType))
|
||||
{
|
||||
itemInstance = parmorInstance;
|
||||
}
|
||||
else
|
||||
{
|
||||
// for bows/crossbows and double handed weapons
|
||||
parmorInstance = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
|
||||
if ((parmorInstance != null) && (parmorInstance.getLocationSlot() == Inventory.PAPERDOLL_RHAND))
|
||||
{
|
||||
itemInstance = parmorInstance;
|
||||
}
|
||||
}
|
||||
|
||||
if (itemInstance != null)
|
||||
{
|
||||
curEnchant = itemInstance.getEnchantLevel();
|
||||
|
||||
// set enchant value
|
||||
activeChar.getInventory().unEquipItemInSlot(armorType);
|
||||
itemInstance.setEnchantLevel(ench);
|
||||
activeChar.getInventory().equipItem(itemInstance);
|
||||
|
||||
// send packets
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
iu.addModifiedItem(itemInstance);
|
||||
activeChar.sendPacket(iu);
|
||||
activeChar.broadcastUserInfo();
|
||||
|
||||
// informations
|
||||
activeChar.sendMessage("Changed enchantment of " + activeChar.getName() + "'s " + itemInstance.getItem().getName() + " from " + curEnchant + " to " + ench + ".");
|
||||
activeChar.sendMessage("Admin has changed the enchantment of your " + itemInstance.getItem().getName() + " from " + curEnchant + " to " + ench + ".");
|
||||
|
||||
// log
|
||||
GMAudit.auditGMAction("TelnetAdmin", "enchant", activeChar.getName(), itemInstance.getItem().getName() + "(" + itemInstance.getObjectId() + ") from " + curEnchant + " to " + ench);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Enchant());
|
||||
}
|
||||
}
|
68
trunk/dist/game/data/scripts/handlers/telnethandlers/player/GMList.java
vendored
Normal file
68
trunk/dist/game/data/scripts/handlers/telnethandlers/player/GMList.java
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.AdminData;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class GMList implements ITelnetCommand
|
||||
{
|
||||
private GMList()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "gmlist";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "GMList";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
int i = 0;
|
||||
String gms = "";
|
||||
for (String player : AdminData.getInstance().getAllGmNames(true))
|
||||
{
|
||||
gms += player + ", ";
|
||||
i++;
|
||||
}
|
||||
if (!gms.isEmpty())
|
||||
{
|
||||
gms = gms.substring(0, gms.length() - 2) + ".";
|
||||
}
|
||||
return "There are currently " + i + " GM(s) online..." + Config.EOL + gms;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new GMList());
|
||||
}
|
||||
}
|
95
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Give.java
vendored
Normal file
95
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Give.java
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Give implements ITelnetCommand
|
||||
{
|
||||
private Give()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "give";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Give <player name> <item id> [item amount] [item enchant] [donators]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length < 2) || args[0].isEmpty() || !Util.isDigit(args[1]))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(args[0]);
|
||||
if (player != null)
|
||||
{
|
||||
final int itemId = Integer.parseInt(args[1]);
|
||||
long amount = 1;
|
||||
int enchanted = 0;
|
||||
if (args.length > 2)
|
||||
{
|
||||
String token = args[2];
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
amount = Long.parseLong(token);
|
||||
}
|
||||
if (args.length > 3)
|
||||
{
|
||||
token = args[3];
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
enchanted = Integer.parseInt(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final L2ItemInstance item = ItemTable.getInstance().createItem("Telnet-Admin", itemId, amount, player, null);
|
||||
if (enchanted > 0)
|
||||
{
|
||||
item.setEnchantLevel(enchanted);
|
||||
}
|
||||
player.addItem("Telnet-Admin", item, null, true);
|
||||
return "Item has been successfully given to the player.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Give());
|
||||
}
|
||||
}
|
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Jail.java
vendored
Normal file
94
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Jail.java
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentTask;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Jail implements ITelnetCommand
|
||||
{
|
||||
private Jail()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "jail";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Jail <player name> [time in minutes]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.JAIL))
|
||||
{
|
||||
return "Player is already jailed.";
|
||||
}
|
||||
String reason = "You have been jailed by telnet admin.";
|
||||
long time = -1;
|
||||
if (args.length > 1)
|
||||
{
|
||||
final String token = args[1];
|
||||
if (Util.isDigit(token))
|
||||
{
|
||||
time = Integer.parseInt(token) * 60 * 1000;
|
||||
time += System.currentTimeMillis();
|
||||
}
|
||||
if (args.length > 2)
|
||||
{
|
||||
reason = args[2];
|
||||
for (int i = 3; i < args.length; i++)
|
||||
{
|
||||
reason += " " + args[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
PunishmentManager.getInstance().startPunishment(new PunishmentTask(objectId, PunishmentAffect.CHARACTER, PunishmentType.JAIL, time, reason, "Telnet Admin"));
|
||||
return "Player has been successfully jailed.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Jail());
|
||||
}
|
||||
}
|
67
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Kick.java
vendored
Normal file
67
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Kick.java
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Kick implements ITelnetCommand
|
||||
{
|
||||
private Kick()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "kick";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Kick <player name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(args[0]);
|
||||
if (player != null)
|
||||
{
|
||||
player.logout();
|
||||
return "Player has been successfully kicked.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Kick());
|
||||
}
|
||||
}
|
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Unban.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Unban.java
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Unban implements ITelnetCommand
|
||||
{
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "unban";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Unban <player name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (!PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.BAN))
|
||||
{
|
||||
return "Player is not banned at all.";
|
||||
}
|
||||
PunishmentManager.getInstance().stopPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.BAN);
|
||||
return "Player has been successfully unbanned.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Unban());
|
||||
}
|
||||
}
|
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/UnbanChat.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/UnbanChat.java
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class UnbanChat implements ITelnetCommand
|
||||
{
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "unban_chat";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "unban_chat <player name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (!PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN))
|
||||
{
|
||||
return "Player is not banned at all.";
|
||||
}
|
||||
PunishmentManager.getInstance().stopPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.CHAT_BAN);
|
||||
return "Player chat has been successfully unbanned.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new UnbanChat());
|
||||
}
|
||||
}
|
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Unjail.java
vendored
Normal file
69
trunk/dist/game/data/scripts/handlers/telnethandlers/player/Unjail.java
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package handlers.telnethandlers.player;
|
||||
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.PunishmentManager;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jmobius.gameserver.model.punishment.PunishmentType;
|
||||
import com.l2jmobius.gameserver.network.telnet.ITelnetCommand;
|
||||
import com.l2jmobius.gameserver.network.telnet.TelnetServer;
|
||||
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class Unjail implements ITelnetCommand
|
||||
{
|
||||
@Override
|
||||
public String getCommand()
|
||||
{
|
||||
return "unjail";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUsage()
|
||||
{
|
||||
return "Unjail <player name>";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String handle(ChannelHandlerContext ctx, String[] args)
|
||||
{
|
||||
if ((args.length == 0) || args[0].isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final int objectId = CharNameTable.getInstance().getIdByName(args[0]);
|
||||
if (objectId > 0)
|
||||
{
|
||||
if (!PunishmentManager.getInstance().hasPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.JAIL))
|
||||
{
|
||||
return "Player is not jailed at all.";
|
||||
}
|
||||
PunishmentManager.getInstance().stopPunishment(objectId, PunishmentAffect.CHARACTER, PunishmentType.JAIL);
|
||||
return "Player has been successfully unjailed.";
|
||||
}
|
||||
return "Couldn't find player with such name.";
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
TelnetServer.getInstance().addHandler(new Unjail());
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user