- 0
Help me with my server!!
-
Posts
-
package custom.events.RandomZoneEvent; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.ScheduledFuture; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.l2jmobius.commons.threads.ThreadPool; import org.l2jmobius.commons.time.SchedulingPattern; import org.l2jmobius.commons.time.TimeUtil; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.managers.ZoneManager; import org.l2jmobius.gameserver.model.StatSet; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.quest.Event; import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneType; import org.l2jmobius.gameserver.model.zone.type.RandomZone; import org.l2jmobius.gameserver.util.Broadcast; /** * Random Zone Event - Activates one random PvP zone temporarily. No modifica la clase de la zona: usa flags PvP en runtime. * @author Juan */ public class RandomZoneEvent extends Event { private static final String CONFIG_FILE = "data/scripts/custom/events/RandomZoneEvent/config.xml"; private static int EVENT_DURATION_MINUTES = 15; private static boolean _isActive = false; private ScheduledFuture<?> _eventTask = null; private final List<ZoneType> _availableZones = new ArrayList<>(); private ZoneType _activeZone = null; public RandomZoneEvent() { loadConfig(); loadZones(); registerZoneListeners(); } /** * Registra listeners a TODAS LAS ZONAS random */ private void registerZoneListeners() { for (ZoneType zone : _availableZones) { addEnterZoneId(zone.getId()); addExitZoneId(zone.getId()); LOGGER.info("[RandomZoneEvent] Registered listener for zone: " + zone.getName()); } } private void loadConfig() { new IXmlReader() { @Override public void load() { parseDatapackFile(CONFIG_FILE); } @Override public void parseDocument(Document doc, File file) { forEach(doc, "event", eventNode -> { final StatSet att = new StatSet(parseAttributes(eventNode)); final String name = att.getString("name"); for (Node node = eventNode.getFirstChild(); node != null; node = node.getNextSibling()) { if ("schedule".equals(node.getNodeName())) { final StatSet attributes = new StatSet(parseAttributes(node)); final String pattern = attributes.getString("pattern"); final SchedulingPattern schedulingPattern = new SchedulingPattern(pattern); final StatSet params = new StatSet(); params.set("Name", name); params.set("SchedulingPattern", pattern); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer("Schedule_" + name, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Event " + name + " scheduled at " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } }); } }.load(); } private void loadZones() { for (ZoneType zone : ZoneManager.getInstance().getAllZones(RandomZone.class)) { if ((zone.getName() != null) && zone.getName().toLowerCase().startsWith("random_zone")) { _availableZones.add(zone); LOGGER.info("[RandomZoneEvent] Loaded zone: " + zone.getName() + " (id=" + zone.getId() + ")"); } } LOGGER.info("[RandomZoneEvent] Total random zones loaded: " + _availableZones.size()); } @Override public void onTimerEvent(String event, StatSet params, Npc npc, Player player) { if (event.startsWith("Schedule_")) { eventStart(null); final SchedulingPattern schedulingPattern = new SchedulingPattern(params.getString("SchedulingPattern")); final long delay = schedulingPattern.getDelayToNextFromNow(); getTimers().addTimer(event, params, delay + 5000, null, null); LOGGER.info("[RandomZoneEvent] Rescheduled for " + TimeUtil.getDateTimeString(System.currentTimeMillis() + delay)); } } @Override public boolean eventStart(Player eventMaker) { if (_isActive) { if (eventMaker != null) { eventMaker.sendMessage("RandomZoneEvent already active."); } return false; } if (_availableZones.isEmpty()) { Broadcast.toAllOnlinePlayers("[RandomZoneEvent] No zones configured."); return false; } _isActive = true; Broadcast.toAllOnlinePlayers("⚔️ Random Zone Event has started!"); _eventTask = ThreadPool.schedule(this::activateRandomZone, 5_000); return true; } private void activateRandomZone() { _activeZone = _availableZones.get(new Random().nextInt(_availableZones.size())); _activeZone.setEnabled(true); Broadcast.toAllOnlinePlayers("🔥 Random Zone Event: " + _activeZone.getName() + " is now PvP for " + EVENT_DURATION_MINUTES + " minutes!"); _eventTask = ThreadPool.schedule(this::eventStop, EVENT_DURATION_MINUTES * 60 * 1000L); } @Override public boolean eventStop() { if (!_isActive) { return false; } _isActive = false; if (_eventTask != null) { _eventTask.cancel(true); _eventTask = null; } if (_activeZone != null) { _activeZone.setEnabled(false); Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended. " + _activeZone.getName() + " is back to normal."); _activeZone = null; } else { Broadcast.toAllOnlinePlayers("🏁 Random Zone Event ended."); } return true; } @Override public void onEnterZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, true); if (creature.isPlayer()) { creature.sendMessage("Esta zona está en modo PvP temporalmente."); } } } @Override public void onExitZone(Creature creature, ZoneType zone) { if (!_isActive || (_activeZone == null)) { return; } if ((zone == _activeZone) && creature.isPlayable()) { creature.setInsideZone(ZoneId.PVP, false); if (creature.isPlayer()) { creature.sendMessage("Abandonaste la zona PvP temporal."); } } } @Override public boolean eventBypass(Player player, String bypass) { return true; } @Override public String onEvent(String event, Npc npc, Player player) { return super.onEvent(event, npc, player); } @Override public String onFirstTalk(Npc npc, Player player) { return null; } public static void main(String[] args) { new RandomZoneEvent(); } } i have this but its not working
-
ZonePvPSpawnBossRadio=0 ZonePvPSpawnBossBarakiel=0 at the Customs.ini in L2Server folder. Im prety sure this is it because i had the same problem with you in cruma 1 floor for example and i couldn't fix it but i fixed it finally by changing these 2 lines
-
Topics

Question
FliperG7
ok ty i i have umbrella's project db which is very cool in localhost but i want to make it online!!so i tried a lot of times!! plz help me! :'(
this is my configs in Logins server!!
Here is my configs in Gameserver
# This is the server configuration file. Here you can set up the connection for your server. # Usually you have to change the ExternalHostname option to # - 127.0.0.1 (if you want to play alone / testing purpose) # - LAN IP* (if you want to play from another computer in the network) # - WAN IP** (if you want to play with friends over internet) # - Questions? => http://l2jfree.com # # * = If you want to get your LAN IP, simply choose "Start" => "Run..." then type "cmd" => "ipconfig" # **= If you want to get you WAN IP, visit http://www.whatismyip.com # =================================================================================================== # ================================================================ # General server setting !!! REQUIRED to configure to everyone !!! # ================================================================ # Bind ip of the gameserver, use 0.0.0.0 to bind on all available IPs GameserverHostname=127.0.0.1 GameserverPort=7777 # This is transmitted to the clients connecting from an external network, so it has to be a public IP or resolvable hostname ExternalHostname=127.0.0.1 # This is transmitted to the client from the same network, so it has to be a local IP or resolvable hostname InternalHostname=127.0.0.1 # Define internal networks (10.0.0.0/8,192.168.0.0/16 is default internal networks) InternalNetworks=127.0.0.1 # Define optional networks and router IPs # IP (200.100.200.100) or fully qualified domain name # (google.com) that resolves to an IP (use ping to determine if a domain resolves). # Format: ip,net/mask;ip,net/mask,net/mask # (mask 192.168.0.0/16 or 192.168.0.0/255.255.0.0 would be 192.168.*.*) # Note: keep InternalNetworks and OptionalNetworks blank for compatibility with older login server OptionalNetworks= # The Loginserver host and port LoginPort=9014 LoginHost=127.0.0.1 # This is the server id that the gameserver will request (i.e. 1 is Bartz) RequestServerID = 1 # If set to true, the login will give an other id to the server if the requested id is allready reserved AcceptAlternateID = True # Database info Driver=com.mysql.jdbc.Driver #Driver=org.hsqldb.jdbcDriver #Driver=com.microsoft.sqlserver.jdbc.SQLServerDriver URL=jdbc:mysql://localhost/l2jdb #URL=jdbc:hsqldb:hsql://localhost/l2jdb #URL=jdbc:sqlserver://localhost/database=l2jdb/user=sa/password= Login=root Password=root MaximumDbConnections=50 # Datapack root directory, defaults to current directory from which the server is started #DatapackRoot=H:/workEclipse/L2J Free/trunk/L2_DataPack_IL # Define character name template # These ones are regular expressions, visit http://www.regular-expressions.info for details # Note: Checking lengths are done server side, but keep it in pattern for future purposes # Character name ( Default [A-Za-z0-9\-]{3,16} ) CnameTemplate=[A-Za-z0-9\-]{3,16} # Pet name ( Default [A-Za-z0-9\-]{3,16} ) PetNameTemplate=[A-Za-z0-9\-]{3,16} # Clan and ally name ( [A-Za-z0-9 \-]{3,16} ) ClanAllyNameTemplate=[A-Za-z0-9 \-]{3,16} # Title ( [A-Za-z0-9 \-\\[\\]\<\>\(\)\!\|]{3,16} ) TitleTemplate=[A-Za-z0-9 \-\\[\\]\<\>\(\)\!\|]{3,16} # Maximum number of chars per account - 0 = illimited - default = 7 CharMaxNumber = 7 # Define how many players are allowed to play simultaneously on your server. MaximumOnlineUsers=100 # Minimum and maximum protocol revision that server allow to connect. # You must keep MinProtocolRevision <= MaxProtocolRevision. MinProtocolRevision = 828 MaxProtocolRevision = 831 #--------------------------------------------- # Safe Reboot configuration #--------------------------------------------- # This will prevent some exploit during restart/shutdown process SafeReboot = True # To use following options, SafeReboot must be set to True # Time in seconds before server complete shutdown/reboot, when # following striction take effect SafeRebootTime = 10 # Disable item enchant SafeRebootDisableEnchant=True # Disable players teleportations SafeRebootDisableTeleport=False # Disable craft and crystallize SafeRebootDisableCreateItem=False # Disable trades and shops SafeRebootDisableTransaction=False # Disable actions between players SafeRebootDisablePcIteraction=False # Disable actions on NPC SafeRebootDisableNpcIteraction=False # Network traffic optimization: minimum time between sending char's hp/mp status update packet. NetworkTrafficOptimization = False NetworkTrafficOptimizationMs = 1100 # Flood Protection # if enabled players which send more then PACKETLIMIT packets in PACKETTIMELIMIT ms will get kicked # warning not tested made a quickhack for squeezed :) FloodProtection = False PacketLimit = 500 PacketTimeLimit = 1100 # ================================================================ # JMX Administration # ================================================================ # Port to connect with l2jmx, -1 to disable jmx completely admin_portJMX=-1 # Port to connect to jmx via HTTP, -1 to disable # disable it if it is not local test # http adaptor is usefull to see if your server is running with l2jbeans, or to see others beans (JRE, logging) # It is also possible to use it if you forbid this port for external host, but you have to be sure nobody can reach this url ! admin_portHTTP=-1 # password for keystore_file, the keystore file should be in config folder. # Comment it or remove the keystore file if you doesn't want to activate secure socket. #keystore_password=password # keystore file # this file is used to store a SSL certificate for your jmx server. # You have to create it with keytool like this : # $JAVA_HOME/bin/keytool -genkey -keyalg "RSA" -keystore myKeystore.jks -storepass myPassword -dname "cn=myhost" # Change myKeystore, myPassword and myhost for your own needs # You have to give this file to all people that will use l2jmx #keystore=keystore.jks # ================================================================ # Legacy Mode for CT1 # ================================================================ LegacyCT1Mode = False CT1AndCT15Mode = Falseok plz fix them with my ip plz
i'll very happy if u answer me asap!!
P.S. my ports are on!! so plz fix them with my ip!! :(
11 answers to this question
Recommended Posts